Install FFmpeg with Netflix VMAF Support
This guide provides a step-by-step walkthrough on how to build and
install FFmpeg with native support for the Netflix VMAF (Video
Multi-Method Assessment Fusion) library from source. By linking
libvmaf with FFmpeg, you can measure perceptual video
quality directly using command-line filters. The instructions below
cover installing the necessary system dependencies, compiling and
installing libvmaf, and building FFmpeg with the
--enable-libvmaf configuration flag on an Ubuntu or
Debian-based Linux system.
1. Install Build Dependencies
Before compiling, update your package lists and install the build
tools and libraries required for compiling both libvmaf and
FFmpeg.
sudo apt update
sudo apt install -y \
build-essential \
git \
meson \
ninja-build \
nasm \
yasm \
pkg-config \
libtool \
cmake \
libx264-dev \
libx265-dev2. Build and Install libvmaf
FFmpeg requires the libvmaf shared or static library to
enable its VMAF filter. Clone the official repository and build it using
Meson and Ninja.
cd /usr/local/src
sudo git clone --depth 1 https://github.com/Netflix/vmaf.git
cd vmaf/libvmaf
sudo meson setup build --buildtype release
sudo ninja -vC build
sudo ninja -vC build installOnce installed, update the shared library cache so the dynamic linker
can find libvmaf:
sudo ldconfigVerify that pkg-config detects the library:
pkg-config --modversion libvmaf3. Download and Compile FFmpeg
Next, clone the FFmpeg source repository, configure it with
libvmaf enabled, and compile the binaries.
cd /usr/local/src
sudo git clone --depth 1 https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
sudo ./configure \
--prefix=/usr/local \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--enable-libvmaf \
--enable-libx264 \
--enable-libx265 \
--extra-libs="-lpthread -lm" \
--ld="g++"
sudo make -j$(nproc)
sudo make install4. Verify the Installation
Confirm that the newly compiled FFmpeg binary has the VMAF filter enabled by querying the filter list:
ffmpeg -filters | grep libvmafIf the installation was successful, the output will display:
... libvmaf VV->V Calculate the VMAF score.
5. Running a VMAF Test
To calculate the VMAF score between a distorted video and a reference video, run the following command:
ffmpeg -i distorted.mp4 -i reference.mp4 -filter_complex libvmaf -f null -FFmpeg will process the frames and output the average VMAF score directly to your terminal.