Installation
Requirements
Section titled “Requirements”- PHP ≥ 8.4 (non-thread-safe builds are what we test; ZTS should work but is untested).
- FFmpeg ≥ 7.0 shared libraries present at runtime —
libavformat,libavcodec,libavutil,libswscale,libswresample. Developed and tested against FFmpeg 7.1. - A C toolchain +
phpize(the PHP development headers) for the source / PIE builds.
Install the FFmpeg libraries with your package manager:
# macOSbrew install ffmpeg
# Debian / Ubuntusudo apt install libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libswresample-devInstall
Section titled “Install”PIE (recommended) — coming with the first release
Section titled “PIE (recommended) — coming with the first release”PIE is the PHP Foundation’s modern extension installer (the successor to PECL). Once ext-ffmpeg is published:
pie install artisan-build/ext-ffmpegPIE compiles the extension against your PHP and FFmpeg and enables it for you. If FFmpeg
isn’t auto-detected via pkg-config, point PIE at it:
pie install artisan-build/ext-ffmpeg --with-ffmpeg=/path/to/ffmpeg/prefixFrom source — works today
Section titled “From source — works today”git clone https://github.com/artisan-build/ext-ffmpegcd ext-ffmpeg/extphpize./configure # or: ./configure --with-ffmpeg="$(brew --prefix ffmpeg)"makesudo make installconfigure finds FFmpeg via pkg-config; if your FFmpeg isn’t on the default
PKG_CONFIG_PATH, pass --with-ffmpeg=<prefix> (a directory containing lib/pkgconfig).
Prebuilt binary — planned
Section titled “Prebuilt binary — planned”Prebuilt .so files (per PHP version / OS / architecture) will be attached to
GitHub Releases. These will be
self-contained — FFmpeg is statically bundled in, so you do not need FFmpeg
installed on the system. Drop the matching ffmpeg.so into your PHP extension_dir and
enable it (below). This is the path for managed hosts (e.g. Laravel Cloud) where you can
load a custom extension but can’t install system binaries.
Enable & verify
Section titled “Enable & verify”Add the extension to your php.ini (PIE does this automatically):
extension=ffmpegThen confirm it’s loaded:
php -m | grep ffmpegphp -r 'var_dump(extension_loaded("ffmpeg"));'Now head to the Introduction for a 60-second tour.
An Artisan Build project.
Built on FFmpeg — an independent binding, not affiliated with or endorsed by the FFmpeg project. Support FFmpeg.