Build FFmpeg
Interfacing with the Quadra device can be through several frameworks, including FFmpeg.
Supported Versions
- 3.27
- 4.3.1
- 5.1.2
- 6.1
- 7.1
- 7.1.3
- 8.0.1
- 8.1
Only FFmpeg 4.3.1 is fully supported in Windows and Android.
Download FFmpeg
To clone the GitHub FFmpeg repository from the command line, run the command and specify which n<version> (for Example 4.3.1) you require from the list of supported FFmpeg versions.
git clone -b n<version> --depth=1 https://github.com/FFmpeg/FFmpeg.git FFmpeg
Example:
git clone -b n4.3.1 --depth=1 https://github.com/FFmpeg/FFmpeg.git FFmpeg
Patch FFmpeg
- Copy the FFmpeg patch file from the untarred SW release package to the
FFmpeg/folder, depending on which official<version>of FFmpeg was downloaded.
cp Quadra_SW_V*/FFmpeg-n<version>_netint_v*.diff FFmpeg/
Example:
cp Quadra_SW_V*/FFmpeg-n4.3.1_netint_v*.diff FFmpeg/
- Change to the
FFmpeg/folder:
cd FFmpeg/
- Apply the relevant NETINT patch to the FFMpeg
<version>, for Example 4.3.1
patch -t -p 1 < FFmpeg-n<version>_netint_v*.diff
Example
patch -t -p 1 < FFmpeg-n4.3.1_netint_v*.diff
Build FFmpeg
- Run the
build_ffmpeg.shscript with the following command lines (these will build with Quadra by default):
sudo make clean
bash build_ffmpeg.sh
The sudo make clean command line above may return with an error if there are no previous build files to clean up. If you see a similar error message to the one below and you in the correct directory, if there are no existing build files then this is expected.
Makefile:167: /tests/Makefile: No such file or directory make: *** No rule to make target '/tests/Makefile'. Stop.
- Now install FFmpeg with Quadra to the system, with the following command:
sudo make install
Build with LGPL License
By default, when FFmpeg is built using the build_ffmpeg.sh script, it will be configured with the following flags:
--enable-gpl --enable-nonfree
FFmpeg can be built to qualify for the LGPL license. To do this the following flags need to be disabled. To disable the flags, FFmpeg needs to be configured manually i.e. not using the build_ffmpeg.sh script. To view the default configuration set by the build_ffmpeg.sh script, use the steps below:
- Go to the FFmpeg directory (directory name depends on the FFmpeg version) with the following command:
cd FFmpeg
- Clean the folder for compilation with the following command:
sudo make clean
- Get the configuration:
bash build_ffmpeg.sh –dry
The response for the above command should look like this :
./configure --pkg-config-flags=--static --enable-gpl --enable-nonfree --extra-ldflags=-lm --extra-ldflags=-ldl --enable-ni_quadra --disable-ni_logan --disable-filter=drawtext_ni_quadra --enable-pic --enable-pthreads --extra-libs=-lpthread --enable-encoders --enable-decoders --enable-avfilter --enable-muxers --enable-demuxers --enable-parsers --disable-debug --disable-ffplay --disable-ffprobe --disable-libx264 --disable-libx265 --disable-libaom --disable-libvpx --disable-libxml2 --disable-libsrt --disable-cuda-nvcc --disable-cuda --disable-cuvid --disable-nvdec --disable-nvenc --disable-libvmaf --enable-static --disable-shared --extra-cflags=-UNI_DEC_GSTREAMER_SUPPORT --extra-cflags=-UNI_MEASURE_LATENCY
To build FFmpeg to comply with the LGPL license, change the following flags from
--enable-gpl --enable-nonfree
to
--disable-gpl --disable-nonfree
Now the configure command need to be executed:
./configure --pkg-config-flags=--static --disable-gpl --disable-nonfree --extra-ldflags=-lm --extra-ldflags=-ldl --enable-ni_quadra --disable-ni_logan --disable-filter=drawtext_ni_quadra --enable-pic --enable-pthreads --extra-libs=-lpthread --enable-encoders --enable-decoders --enable-avfilter --enable-muxers --enable-demuxers --enable-parsers --disable-debug --disable-ffplay --disable-ffprobe --disable-libx264 --disable-libx265 --disable-libaom --disable-libvpx --disable-libxml2 --disable-libsrt --disable-cuda-nvcc --disable-cuda --disable-cuvid --disable-nvdec --disable-nvenc --disable-libvmaf --enable-static --disable-shared --extra-cflags=-UNI_DEC_GSTREAMER_SUPPORT --extra-cflags=-UNI_MEASURE_LATENCY
Once FFmpeg is configured it needs to be built and installed on the system using the following steps:
- Build FFmpeg with the command:
make
- Install FFmpeg to the host $PATH with the following command:
sudo make install
The build_ffmpeg.sh script with the --dry flag can be used with other custom configurations as shown in Section 4.2.9 (Step 3). The --dry flag can also be added at the end of the build_ffmpeg.sh script to get the configuration
For example
bash build_ffmpeg.sh --quadra –-logan –-dry
The above command will print out the FFmpeg configuration with the Quadra and Logan libraries enabled. The above step can be followed with an install of FFmpeg with the LGPL license, with Quadra and Logan features also enabled.