Using Aurora1 with FFmpeg

To use Aurora1 with FFmpeg, you need to invoke the encoder using the parameter libwzav1 in your command line.

  • ./ffmpeg -h encoder=libwzav1
Encoder libwzav1 [Visionular AV1]:
    General capabilities: dr1 delay threads
    Threading capabilities: other
    Supported pixel formats: yuv420p yuv422p yuv444p gbrp yuv420p10le yuv422p10le yuv444p10le yuv420p12le yuv422p12le yuv444p12le gbrp10le gbrp12le gray gray10le gray12le
libwzav1 encoder AVOptions:
  -end-usage         <int>        E..V....... Wzav1 rc mode (from 0 to 3) (default 0)
  -wzav1-sp          <int>        E..V....... Wzav1 preset (from 0 to 22) (default 0)
  -lag-in-frames     <int>        E..V....... Number of frames to look ahead at for alternate reference frame selection (from -1 to INT_MAX) (default -1)
  -crf               <int>        E..V....... Select the quality for constant quality mode (from -1 to 6400) (default -1)
  -fpp               <int>        E..V....... Frame Parallel encoding (from -1 to 8) (default -1)
  -fp-scale          <int>        E..V....... First pass optimize (from -1 to 1) (default -1)
  -hdr-cll           <string>     E..V....... Enable hdr cll metadata
  -hdr-mdcv          <string>     E..V....... Enable hdr mdcv metadata
  -wzav1-params      <string>     E..V....... Set libwzav1 options using a :-separated list of key=value pairs

Note:

  • A list of all the parameters that can be passed using the configuration string wzav1-params can be found in API parameters.

Integrating Aurora1's SDK to FFmpeg

The following instructions use FFmpeg n8.1 as an example. Assume $HOME is the working directory.

Step 1: Check out FFmpeg n8.1 and apply the Aurora AV1 patch

Clone the FFmpeg repository, check out the n8.1 tag, and apply the provided patch:

cd $HOME
git clone https://git.ffmpeg.org/ffmpeg.git

cd $HOME/ffmpeg
git checkout n8.1

cp -r $HOME/wzav1-sdk/ffmpeg_src/* $HOME/ffmpeg/
git apply wzav1_ffmpeg-n8.1_patch.diff

Step 2: Add the Aurora AV1 SDK dependency

Create a dep directory under the FFmpeg project and copy the entire wzav1-sdk directory into it:

cd $HOME/ffmpeg
mkdir -p ./dep
cp -r $HOME/wzav1-sdk/ ./dep/

Step 3: Build FFmpeg

Make the build script executable and run it:

chmod +x ./build.sh
./build.sh

Step 4: Locate the FFmpeg binary

After a successful build, the FFmpeg binary can be found at:

$HOME/ffmpeg/out/bin/ffmpeg

Note:

When integrating the AV1 SDK without using the build.sh script, perform the following additional steps.

  • Configure the pkg-config files

Update the prefix value in the SDK .pc files (for example, lib/pkgconfig/wzav1.pc) to the absolute path of the Aurora1 SDK directory, and set the PKG_CONFIG_PATH environment variable. For example,

sed -i "s@^prefix=\(\S\+\)@prefix=$HOME/wzav1-sdk@g" $HOME/wzav1-sdk/lib/pkgconfig/*.pc
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOME/wzav1-sdk/lib/pkgconfig
  • Set the library and include paths

Set the LD_LIBRARY_PATH, LIBRARY_PATH, and C_INCLUDE_PATH environment variables to the SDK's library and include directories. For example,

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/wzav1-sdk/lib
export LIBRARY_PATH=$LIBRARY_PATH:$HOME/wzav1-sdk/lib
export C_INCLUDE_PATH=$C_INCLUDE_PATH:$HOME/wzav1-sdk/include
  • Add the required configure options

Add the following options to the configure command. Note that --enable-libwzav1 must be specified together with these options:

--extra-libs="-lpthread -lstdc++ -lm" \
--extra-cflags="-msse4 -std=c99 -D_GNU_SOURCE" \
--enable-libwzav1 \