Compile FFmpeg with VMAF Support
This guide provides a step-by-step walkthrough on how to compile
FFmpeg with support for Netflix’s Video Multi-Method Assessment Fusion
(VMAF) library. You will learn how to install the necessary build
dependencies, compile and install the libvmaf library from
source, configure and compile FFmpeg with VMAF enabled, and verify that
the installation was successful.
Step 1: Install Build Dependencies
Before compiling, you need to install the essential compilation tools, libraries, and package managers. On a Debian/Ubuntu-based system, run the following command:
sudo apt update
sudo apt install -y build-essential git meson ninja-build yasm nasm pkg-configStep 2: Compile and Install libvmaf
FFmpeg requires the libvmaf library to be installed on
your system. You can build it directly from the official Netflix
repository.
Clone the VMAF repository:
git clone --depth 1 https://github.com/Netflix/vmaf.git cd vmaf/libvmafConfigure the build using Meson:
meson build --buildtype releaseCompile and install the library:
ninja -v -C build sudo ninja -v -C build installUpdate the shared library cache so the system recognizes the newly installed library:
sudo ldconfig
Step 3: Configure PKG_CONFIG_PATH
FFmpeg needs to locate the libvmaf installation using
pkg-config. Ensure the path where libvmaf.pc
was installed is in your environment variables.
Typically, it is installed in
/usr/local/lib/x86_64-linux-gnu/pkgconfig or
/usr/local/lib/pkgconfig. Add it to your path:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATHStep 4: Download and Compile FFmpeg
With libvmaf installed, you can now compile FFmpeg.
Clone the FFmpeg source code:
git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git cd ffmpegConfigure the FFmpeg build. You must include the
--enable-gpland--enable-libvmafflags:./configure --enable-gpl --enable-libvmaf --enable-version3Compile FFmpeg utilizing all available CPU cores:
make -j$(nproc)Install the compiled FFmpeg binary:
sudo make install
Step 5: Verify the Installation
To confirm that FFmpeg has been successfully compiled with VMAF support, check if the VMAF filter is available by running:
ffmpeg -filters | grep vmafIf the installation was successful, the output will display the
libvmaf filter.