- How do I install protonemedia/php-ffmpeg in a Laravel app?
- Install it with composer require protonemedia/php-ffmpeg, then instantiate FFMpeg\FFMpeg directly in your code. There is no service provider or config file to publish, because the library is framework-agnostic and configured through its constructor. You also need the ffmpeg and ffprobe binaries installed on the machine or container that runs the code.
- Is protonemedia/php-ffmpeg compatible with Laravel 10 and 11 or PHP 8.2+?
- There is no official guarantee. The last release was January 2022, so the fork predates PHP 8.2 and Laravel 10/11 and may hit dependency conflicts with newer Symfony Process or PSR packages. Test it in a throwaway branch first, and if you adopt it, pin the version and keep a patch path or fall back to upstream php-ffmpeg/php-ffmpeg.
- Is protonemedia/php-ffmpeg still maintained, or should I use php-ffmpeg/php-ffmpeg instead?
- For a new project, php-ffmpeg/php-ffmpeg, the actively maintained upstream from Alchemy, is the safer default. The Protonemedia package is a fork that has had no releases in about three years, very little adoption, and no expected CVE or PHP-version response. Use it only if you specifically need a change that exists only in the fork, and wrap it behind your own interface so you can swap it later.
- Does protonemedia/php-ffmpeg bundle the FFmpeg and FFprobe binaries?
- No. The PHP package only shells out to ffmpeg and ffprobe, so you must provision the binaries yourself, typically by baking a pinned build into your Docker image or server image. That also means binary security updates are your responsibility and are decoupled from the Composer package version.
- How do I generate a video thumbnail in Laravel with this package?
- Open the video with FFMpeg::open(), then grab a frame and save it as an image. That is the standard path for generating a thumbnail, and it works with local paths or a downloaded temp copy of a file stored on S3. Run it in a queued job rather than in the request cycle for large uploads.
- How do I convert a video to MP4 or another format with protonemedia/php-ffmpeg?
- Use FFMpeg::open() to load the input, then call the save() method with a format object such as an X264 codec or one from the library's Format namespace. Transcoding is CPU-bound, so dispatch it to a dedicated queue worker and write to a temporary disk before publishing the result to S3 or your CDN.
- How do I run FFmpeg transcoding in a Laravel queue job?
- Create a job that opens the file, runs the transcode or thumbnail operation, and writes the output to a temp disk, then stores it permanently and updates your model on success. Dispatch the job to a dedicated media queue supervised by Horizon so long transcodes do not block your default queue. Give the job an explicit timeout and a retry policy that will not re-run expensive work blindly.
- Can I resize, crop, or watermark a video with this package?
- Yes. The library exposes fluent filters for resizing, cropping, and watermarking video, and it also supports extracting the audio track. Filters are chained on the opened media before the save call. Keep in mind that available filters and codecs depend on how the underlying FFmpeg binary was compiled, so verify support in your container image.
- How do I stop FFmpeg transcoding jobs from exhausting CPU or disk in production?
- Set explicit timeouts on the FFmpeg process, cap the media queue's concurrency to a small number, and validate file size and duration before dispatching a job. Write outputs to a bounded temp disk and clean up on failure, because a single malicious upload can otherwise fill disk or starve workers. The library does not enforce these limits for you, so the guardrails belong in your job and infrastructure configuration.
- What are the licensing implications of using FFmpeg in a Laravel SaaS product?
- The PHP package is MIT-licensed, but the FFmpeg binary is LGPL or GPL depending on how it was compiled and which codecs were enabled. If you distribute the build or host outputs as a SaaS, make a deliberate decision about GPL components such as libx264. Many teams standardise on an LGPL build and avoid GPL-only encoders where policy requires it.