Compile FFmpeg with SVT-HEVC Support

This guide provides a straightforward, step-by-step walkthrough on how to compile FFmpeg from source with enabled support for the SVT-HEVC (Scalable Video Technology for HEVC) encoder. By compiling FFmpeg with this library, you can leverage Intel’s highly optimized H.265/HEVC encoder for high-performance video compression on modern CPU architectures.

Step 1: Install Required Dependencies

Before starting, you must install the build tools, compilers, and libraries required to compile both SVT-HEVC and FFmpeg. Run the following command on Debian/Ubuntu-based systems:

sudo apt update
sudo apt install -y build-essential cmake git yasm nasm pkg-config

Step 2: Build and Install SVT-HEVC

You need to compile and install the SVT-HEVC library first so that FFmpeg can link against it during its own compilation process.

  1. Clone the official SVT-HEVC repository:

    git clone https://github.com/OpenVisualCloud/SVT-HEVC.git
    cd SVT-HEVC
  2. Create a build directory and compile the source:

    mkdir build
    cd build
    cmake -DCMAKE_BUILD_TYPE=Release ..
    make -j$(nproc)
  3. Install the library to your system:

    sudo make install
    sudo ldconfig

Step 3: Configure and Compile FFmpeg

Now, download the FFmpeg source code and configure it to enable the SVT-HEVC encoder.

  1. Clone the FFmpeg repository:

    cd ~/
    git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
    cd ffmpeg
  2. Configure the build. You must explicitly include the --enable-libsvthevc flag. You also need --enable-gpl as SVT-HEVC support requires GPL licensing terms within FFmpeg.

    Depending on where SVT-HEVC was installed, you may need to export the PKG_CONFIG_PATH so the configure script can find the library:

    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

    Run the configure script:

    ./configure --enable-gpl --enable-libsvthevc --enable-nonfree
  3. Compile and install FFmpeg:

    make -j$(nproc)
    sudo make install

Step 4: Verify the Installation

To verify that FFmpeg was compiled successfully and supports the SVT-HEVC encoder, run the following command:

ffmpeg -encoders | grep svt

If the installation was successful, the output will list the SVT-HEVC encoder:

V..... libsvt_hevc          SVT-HEVC(Scalable Video Technology for HEVC) encoder (codec hevc)