Compile FFmpeg with SVT-AV1 Support
This guide provides a step-by-step walkthrough on how to compile FFmpeg from source with the SVT-AV1 (Scalable Video Technology AV1) encoder enabled. By building FFmpeg with SVT-AV1 support, you can leverage high-performance, open-source AV1 video encoding directly within your command-line media workflows.
Step 1: Install Build Dependencies
First, update your package manager and install the necessary build tools, compilers, and libraries.
On Debian/Ubuntu-based systems, run:
sudo apt update
sudo apt install -y autoconf automake build-essential cmake git libtool pkg-config yasm nasmNote: Ensure your nasm version is 2.15 or higher, as
SVT-AV1 requires a modern assembler for optimizations.
Step 2: Build and Install SVT-AV1
To enable SVT-AV1 in FFmpeg, you must first compile and install the
SVT-AV1 library (libsvtav1) on your system.
Clone the official SVT-AV1 repository:
git clone https://gitlab.com/AOMediaCodec/SVT-AV1.git cd SVT-AV1Create a build directory and navigate into it:
mkdir build && cd buildConfigure the build using CMake:
cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_DEC=OFF -DBUILD_SHARED_LIBS=OFF(Setting
BUILD_SHARED_LIBS=OFFcompiles it as a static library, which is easier to link into FFmpeg).Compile and install the library:
make -j$(nproc) sudo make installUpdate the shared library cache:
sudo ldconfig
Step 3: Download and Compile FFmpeg
Now you can compile FFmpeg and link it with the newly installed
libsvtav1.
Clone the FFmpeg source code:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg-source cd ffmpeg-sourceConfigure the build. You must include the
--enable-libsvtav1flag along with--enable-gpland--enable-nonfree(required for certain dependencies):./configure \ --pkg-config-flags="--static" \ --enable-gpl \ --enable-nonfree \ --enable-libsvtav1If you installed SVT-AV1 to a custom path, you may need to export the
PKG_CONFIG_PATHvariable before running the configure script (e.g.,export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig").Compile FFmpeg using all available CPU cores:
make -j$(nproc)Install the newly compiled FFmpeg binary:
sudo make install
Step 4: Verify the Installation
To verify that FFmpeg has been successfully compiled with SVT-AV1 support, check the available encoders using the following command:
ffmpeg -encoders | grep svtIf the installation was successful, the output will display the SVT-AV1 encoder:
V..... libsvtav1 SVT-AV1(Scalable Video Technology for AV1) encoder (codec av1)