How to Update Libaom inside an Existing FFmpeg Build?

Updating the libaom version within an existing FFmpeg build requires a partial or full recompilation of the binaries because external encoder libraries are typically compiled statically into FFmpeg. The process involves pulling the latest codebase from the Alliance for Open Media (AOM) repository, compiling the updated library using CMake, and then reconfiguring and rebuilding FFmpeg to link against the new version. Because FFmpeg cannot dynamically hot-swap statically linked internal libraries on the fly, a full source rebuild of these components is necessary to ensure stability and compatibility with the newest AV1 encoding features.

Step 1: Prepare the Build Environment

Before starting, ensure that your environment paths are set up properly so that your build system knows where to find the newly compiled local binaries and pkg-config configurations.

mkdir -p ~/ffmpeg_sources ~/ffmpeg_build ~/bin
export PATH="$HOME/bin:$PATH"
export PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"

Step 2: Download and Compile the Latest Libaom

Navigate to your sources directory, pull down the latest stable source code for libaom, and use CMake to generate the updated static library.

cd ~/ffmpeg_sources
git -C aom pull 2> /dev/null || git clone --depth 1 https://aomedia.googlesource.com/aom
mkdir -p aom_build
cd aom_build

cmake -G "Unix Makefiles" \
  -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" \
  -DENABLE_SHARED=off \
  -DENABLE_NASM=on \
  -DENABLE_DOCS=off \
  -DENABLE_TESTS=off \
  ../aom

make -j$(nproc)
make install

Once the new libaom version is installed to your build directory, you must reconfigure and compile FFmpeg. This tells FFmpeg’s config script to look at your updated pkg-config paths and overwrite the previous build.

cd ~/ffmpeg_sources
# Download a new snapshot or navigate to your existing source directory
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg

./configure \
  --prefix="$HOME/ffmpeg_build" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I$HOME/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  --bindir="$HOME/bin" \
  --enable-gpl \
  --enable-libaom \
  --enable-nonfree

make -j$(nproc)
make install

Step 4: Verify the Update

After the compilation finishes successfully, check that your local FFmpeg binary is utilizing the updated version of libaom.

ffmpeg -version

Look at the configuration output printed in the terminal. The output will confirm whether --enable-libaom is present and show the active library compilation date or version tag to ensure the update was applied.