PHP-FFMpeg

Object-oriented PHP library that drives the FFmpeg binary for audio and video processing.

Library
Composer
vv1.4.0
5,016stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
53/100Fair
Development Activity4
Maintenance20
Community88
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
80/100Excellent
Architecture84
Code Quality80
Innovation74
Learning Curve82

PHP-FFMpeg is an object-oriented PHP library that wraps the FFmpeg and FFProbe command-line binaries behind a fluent, discoverable API. Instead of hand-building shell commands, you open a media file and chain filters and formats: resize, rotate, watermark, clip, concatenate, extract frames, and transcode video or audio into formats like X264, WebM, or MP3.

The library detects the FFmpeg/FFProbe binaries on the system PATH (or takes explicit paths), streams progress events, and probes media metadata via FFProbe. It requires a working FFmpeg installation and shells out to it through Symfony Process, making it a convenient, testable abstraction for media transcoding in PHP applications.

What You Get

  • A fluent API to open media and chain filters (resize, rotate, clip, watermark, concatenate)
  • Transcoding to formats such as X264, WebM, Ogg, and MP3
  • Frame extraction and thumbnail generation at given timecodes
  • Media metadata probing via an FFProbe wrapper
  • Progress events and configurable binary paths and timeouts

Common Use Cases

  • Transcoding uploaded videos into web-friendly formats and resolutions
  • Generating thumbnail images or preview frames from video files
  • Extracting audio or applying filters like resize, rotate, or watermark

Under The Hood

Architecture - The library is organized under the FFMpeg\ namespace (src/FFMpeg) with a facade FFMpeg::create() entry point, media abstractions (Video, Audio), a Filters system, Format classes (X264, WebM, Mp3, etc.), Coordinate helpers (Dimension, TimeCode), and an FFProbe wrapper; it builds on the bundled Alchemy\BinaryDriver for locating and invoking binaries. Tech Stack - PHP 8.0 through 8.5, depending on symfony/process for execution, symfony/cache and psr/log, evenement for events, and spatie/temporary-directory; it requires the external FFmpeg and FFProbe binaries at runtime. Code Quality - The repo has a PHPUnit suite split into Unit, Functional, and component tests with a CI workflow, and a maintained CHANGELOG, indicating solid test coverage for a binary-driver library. API Design - The API is fluent and expressive: open a file, chain filters(), pick a Format, and save(), with clear value objects for dimensions and timecodes keeping typical transcoding tasks concise.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search