ritechoice23/laravel-fluent-ffmpeg 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ritechoice23/laravel-fluent-ffmpeg

最新稳定版本:1.5.0

Composer 安装命令:

composer require ritechoice23/laravel-fluent-ffmpeg

包简介

A fluent, chainable API for working with FFmpeg in Laravel applications

README 文档

README

Laravel Fluent FFmpeg Thumbnail

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads Buy Me A Coffee

A fluent, chainable API for working with FFmpeg in Laravel applications. Process videos and audio with an elegant, expressive syntax.

Installation

composer require ritechoice23/laravel-fluent-ffmpeg

Publish the configuration:

php artisan vendor:publish --tag=fluent-ffmpeg-config

Quick Start

use Ritechoice23\FluentFFmpeg\Facades\FFmpeg;

// Basic video conversion
FFmpeg::fromPath('video.mp4')
    ->videoCodec('libx264')
    ->audioCodec('aac')
    ->resolution(1920, 1080)
    ->save('output.mp4');

// Or using the global helper
ffmpeg()->fromPath('video.mp4')
    ->videoCodec('libx264')
    ->save('output.mp4');

// Extract audio
FFmpeg::fromPath('video.mp4')
    ->extractAudio()
    ->save('audio.mp3');

// Create GIF
FFmpeg::fromPath('video.mp4')
    ->clip('00:00:05', '00:00:10')
    ->toGif(['fps' => 15, 'width' => 480])
    ->save('animation.gif');

// Advanced HLS Streaming (Multi-bitrate)
FFmpeg::fromPath('video.mp4')
    ->exportForHLS()
    ->addFormat('1080p')
    ->addFormat('720p')
    ->addFormat('480p')
    ->save('stream.m3u8');

// Extract multiple clips
FFmpeg::fromPath('video.mp4')
    ->clips([
        ['start' => '00:00:10', 'end' => '00:00:20'],
        ['start' => '00:01:30', 'end' => '00:02:00'],
        ['start' => '00:03:45', 'end' => '00:04:15'],
    ])
    ->save('highlight.mp4'); // Outputs: highlight_1.mp4, highlight_2.mp4, highlight_3.mp4

// Video composition with intro, outro, and watermark
FFmpeg::fromPath('video.mp4')
    ->withIntro('intro.mp4')
    ->withOutro('outro.mp4')
    ->withWatermark('logo.png', 'bottom-right')
    ->save('branded.mp4');

// Process all videos in a directory
FFmpeg::fromDirectory('/path/to/videos')
    ->resize(1920, 1080)
    ->withWatermark('logo.png', 'top-right')
    ->save('/path/to/output/');

// Add text overlay (supports multiple overlays!)
FFmpeg::fromPath('video.mp4')
    ->withText('Title', ['position' => 'top-center', 'font_size' => 36])
    ->withText('Subtitle', ['position' => 'center', 'font_size' => 24])
    ->withText('© 2024', ['position' => 'bottom-right', 'font_size' => 14])
    ->save('output.mp4');

// Generate audio waveforms for visualization
FFmpeg::fromPath('audio.mp3')
    ->audioCodec('aac')
    ->withPeaks(samplesPerPixel: 512, normalizeRange: [0, 1])
    ->save('output.m4a');
// Outputs: output.m4a + output-peaks.json

Features

  • Fluent API - Chainable, expressive syntax
  • Audio Waveforms - Generate waveform data for visualization
  • Multi-Clip Extraction - Extract multiple clips with auto-numbering
  • Directory Processing - Process multiple files from a directory
  • Multiple Text Overlays - Add multiple styled text overlays with positioning and timing
  • Video Composition - Add intro, outro, and watermarks to clips
  • 20+ Filters - Effects, transformations, overlays
  • Multiple Formats - MP4, HLS, DASH, GIF, and more
  • Media Probing - Get detailed video/audio information
  • Laravel Disks - Save to S3, local, or any disk
  • Progress Tracking - Real-time progress with broadcasting
  • Queue Support - Process videos in background
  • Smart Defaults - Sensible defaults from config
  • Events - Track processing lifecycle
  • Fully Tested - 228+ passing tests

Documentation

Requirements

  • PHP 8.2+
  • Laravel 10.0+
  • FFmpeg 4.0+

Testing

composer test

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 334
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 68
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 68
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-26