Compile FFmpeg with libuavs3e and libuavs3d

This guide provides a step-by-step walkthrough on how to compile FFmpeg from source with support for the libuavs3e (AVS3 video encoder) and libuavs3d (AVS3 video decoder) libraries. By compiling these libraries and linking them to FFmpeg, you will be able to encode and decode video files using the third-generation Audio Video Coding Standard (AVS3) within your media workflows.

Prerequisites

Before beginning, ensure your system has the necessary build tools, CMake, and Git installed. On Debian/Ubuntu-based systems, you can install these dependencies by running:

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

Step 1: Build and Install libuavs3e (Encoder)

The libuavs3e library is the open-source AVS3 video encoder. Follow these steps to clone, compile, and install it:

  1. Clone the repository from GitHub:

    git clone https://github.com/uavs3/uavs3e.git
    cd uavs3e
  2. Create a build directory and navigate into it:

    mkdir -p build/linux
    cd build/linux
  3. Configure the build with CMake, enabling shared libraries:

    cmake ../.. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
  4. Compile and install the library:

    make -j$(nproc)
    sudo make install

Step 2: Build and Install libuavs3d (Decoder)

The libuavs3d library is the open-source AVS3 video decoder. Follow these steps to clone, compile, and install it:

  1. Clone the repository from GitHub:

    git clone https://github.com/uavs3/uavs3d.git
    cd uavs3d
  2. Create a build directory and navigate into it:

    mkdir -p build/linux
    cd build/linux
  3. Configure the build with CMake, enabling shared libraries:

    cmake ../.. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
  4. Compile and install the library:

    make -j$(nproc)
    sudo make install

Step 3: Configure and Compile FFmpeg

To compile FFmpeg with support for these libraries, you must point the build system to the newly installed pkg-config files and enable the corresponding configuration flags.

  1. Update your environmental variables so the FFmpeg configuration script can locate the newly installed libraries:

    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
    export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
  2. Clone the official FFmpeg repository:

    git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
    cd ffmpeg
  3. Configure the FFmpeg build. You must include --enable-gpl, --enable-libuavs3e, and --enable-libuavs3d:

    ./configure \
      --enable-gpl \
      --enable-libuavs3e \
      --enable-libuavs3d \
      --extra-libs=-lpthread \
      --extra-libs=-lm
  4. Compile FFmpeg using all available CPU cores:

    make -j$(nproc)
  5. Install the compiled FFmpeg binaries to your system:

    sudo make install
    sudo ldconfig

Step 4: Verify the Installation

To confirm that FFmpeg has been successfully compiled with AVS3 encoding and decoding support, run the following commands: