How to Compile FFmpeg with VMAF
This guide provides a straightforward, step-by-step walkthrough on
how to compile and install FFmpeg with support for Netflix’s Video
Multi-Method Assessment Fusion (VMAF) library. You will learn how to
install the necessary build dependencies, compile the
libvmaf library from source, and configure FFmpeg to enable
this video quality measurement tool on a Linux-based system (such as
Ubuntu or Debian).
Step 1: Install Build Dependencies
Before compiling, you must install the required build tools, compilers, and packages. Run the following command in your terminal:
sudo apt update && sudo apt install -y \
build-essential \
git \
cmake \
nasm \
yasm \
pkg-config \
ninja-build \
python3 \
python3-pip \
python3-setuptools \
python3-wheelNext, install meson, which is the build system used by
the VMAF repository:
pip3 install mesonStep 2: Compile and Install libvmaf
Now you need to clone the official Netflix VMAF repository, configure the build directory using Meson, and compile the library.
Clone the repository and navigate to the
libvmafdirectory: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 using Ninja:
ninja -C build sudo ninja -C build installUpdate the run-time linker bindings so your system recognizes the newly installed library:
sudo ldconfig
Step 3: Configure and Compile FFmpeg
With libvmaf installed, you can now download and compile
FFmpeg.
Navigate out of the VMAF directory and clone the FFmpeg source code:
cd ../.. git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git cd ffmpegConfigure FFmpeg with VMAF support. You must explicitly enable both
--enable-gpland--enable-libvmaf:./configure --enable-gpl --enable-version3 --enable-libvmafNote: If your system has trouble finding the VMAF library during configuration, you may need to define the path to your pkg-config files:
export PKG_CONFIG_PATH=/usr/local/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATHCompile FFmpeg using all available CPU cores:
make -j$(nproc)Install the newly compiled FFmpeg binary to your system:
sudo make install
Step 4: Verify the Installation
To confirm that FFmpeg has been successfully installed and includes the VMAF filter, run the following command:
ffmpeg -filters | grep vmafIf the installation was successful, the terminal will output the
details of the libvmaf filter, indicating that FFmpeg is
ready to perform video quality analysis.