- What Laravel and PHP versions does pbmedia/laravel-ffmpeg support?
- The package officially supports Laravel 10 and PHP 8.1+. While Laravel 9.x may work, it’s unsupported. PHP 8.2+ features are compatible, but no explicit optimizations exist for newer PHP versions.
- How do I install FFmpeg binaries for this package?
- FFmpeg must be installed system-wide and added to your PATH. Use `ffmpeg -version` to verify. For Docker, include FFmpeg in your container. The package reads the binary path from `FFMPEG_BINARIES` in your `.env` if needed.
- Can I use this package for HLS streaming with AES-128 encryption?
- Yes, the package includes built-in support for HLS generation with AES-128 encryption and optional key rotation. Configure encryption keys in the `laravel-ffmpeg.php` config file after publishing the package.
- How do I handle video processing in production to avoid timeouts?
- Use Laravel Queues (Redis, database) to process videos asynchronously. Wrap FFmpeg operations in a Laravel Job class and dispatch it via `ProcessVideoJob::dispatch()`. This prevents HTTP timeouts and optimizes resource usage.
- Does this package support multi-input/output concatenation or timelapses?
- Yes, the package supports concatenating multiple video inputs into a single output and processing image sequences for timelapses. Use the `FFMpeg` facade to chain inputs and apply filters like `concat` or `fps` for frame rate adjustments.
- How do I store processed videos on cloud storage like S3?
- Leverage Laravel’s Filesystem to save outputs to any configured disk (local, S3, etc.). Use `Storage::disk('s3')->put()` or similar methods to write processed files. The package integrates seamlessly with Laravel’s storage system.
- What happens if FFmpeg fails during processing? Can I implement fallbacks?
- FFmpeg errors throw exceptions, which you can catch and handle (e.g., retry logic or fallback to alternative libraries like `ffmpeg-php`). The package doesn’t include built-in fallbacks, but you can wrap operations in try-catch blocks for custom recovery.
- How do I test FFmpeg-dependent code in my Laravel app?
- Mock FFmpeg calls using PHPUnit’s mocking features or libraries like `Mockery`. Create temporary files for testing and verify outputs with assertions. Avoid relying on actual FFmpeg binaries in unit tests; use in-memory storage or stubbed responses.
- Can I use this package for generating video thumbnails or sprites?
- Yes, the package supports frame/thumbnail exports, mosaics, sprites, and tiles. Use methods like `$video->frame()` or `$video->filters()->complex()` to generate thumbnails or composite images. Configure output dimensions and formats in the filters chain.
- What are the alternatives to pbmedia/laravel-ffmpeg for Laravel video processing?
- Alternatives include direct use of `PHP-FFMpeg` (no Laravel integration) or `spatie/laravel-ffmpeg` (older, less maintained). For simpler needs, consider `league/ffmpeg` or `ffmpeg-php`. However, this package offers tighter Laravel integration and modern features like HLS encryption.