Overview
In order to use NETINT Quadra encoding and decoding features using FFmpeg, the user needs the following minimum steps:
Clone an FFmpeg Repository
Get a Quadra Release Package with libxcoder and patch files
Patch the FFmpeg installation
Compile libxcoder
Compile FFmpeg
Run the FFmpeg command in a second command window
Full instructions are given below.
There is a compatibility issue between FFmpeg 4.3.x’s doc generator and texinfo v7.2-1 tool in the latest MSYS2. Use command pacman -Q texinfo to check the version of texinfo tool. To solve this, please downgrade the version of the texinfo tool with the following command.
pacman -U https://repo.msys2.org/msys/x86_64/texinfo-7.1-1-x86_64.pkg.tar.zst
Download the FFmpeg Repository
Start an MSYS2 Mingw64 terminal. There are two methods for installing FFmpeg. The first is to clone the repository from GitHub, and the second is to download and install a tarball from the FFmpeg website.
Sourcing FFmpeg from GitHub
To clone the FFmpeg repository from GitHub, you need to specify the correct FFmpeg version. Once example is FFmpeg version 4.3.1. Using the Mingw64 command line, run the following
cd C: cd msys64/home/nvme git clone -b n4.3.1 --depth=1 https://github.com/FFmpeg/FFmpeg.git FFmpeg
The example below assumes the username ‘nvme’, which means the home folder is C:/msys64/home/nvme. Replace ‘nvme’ with the correct username on your PC. Check the correct subfolder name in the folder C:/msys64/home
Other valid options for git clone -b are other versions of FFmpeg for example n4.2.4, n4.3.2, and n4.4
Sourcing FFmpeg from the official FFmpeg Website
Alternatively, to install FFmpeg from the official website follow these steps.
Use the ‘Download xz tarball’ from the official FFmpeg website
https://ffmpeg.org/download.html#releases
Move the file to the C:/msys64/home/nvme directory, then execute the following steps.
cd C: cd msys64/home/nvme xz -d ffmpeg-4.3.1.tar.xz tar -xvf ffmpeg-4.3.1.tar mv ffmpeg-4.3.1 FFmpeg
Note that FFmpeg release 4.3.1 is used in the example above.
Sourcing FFmpeg from the offline pre-packaged ffmpeg tar file
If you followed the offline steps in Section 2.2 then you can also find a downloaded FFmpeg package base_ffmpeg_n4.2.1.tar.gz in the offline package folder
C:\msys64\home\Administrator
Run the following command to untar this tar file
tar -zxf base_ffmpeg_n4.3.1.tar.gz
Download Quadra Release Package
Contact the NETINT Support team to obtain the latest Quadra release package. The release package will contain a zip file entitled ‘Quadra_V*.*.*.zip’.
Where, *.*.* is the software release version=, for example 5.0.0 would be the file
Quadra_V5.0.0.zip
Apply Patch to FFmpeg Repository
The following instructions need to be followed in sequence to prepare FFmpeg for use with the NETINT Quadra Video Transcoder.
Unzip the Codensity Quadra Software Release package to the $HOME folder:
cd C: cd msys64/home/nvme unzip Quadra_V5.0.0.zip
Copy the libxcoder/ folder from the uncompressed release package to the parent folder of FFmpeg (i.e. same level as FFmpeg):
cp -r Quadra_V5.0.0/libxcoder ./
This example is for patching a FFmpeg 4.3.x release
Copy the FFmpeg patch file from the release package to the FFmpeg folder:
cp Quadra_V5.0.0/Quadra_SW_V5.0.0_RC2/FFmpeg-n4.3.1_netint_v5.0.0_RC2.diff $HOME/FFmpeg
Change directories to the FFmpeg/ folder:
cd C: cd msys64/home/nvme cd FFmpeg
Apply the patch depending on the FFmpeg
<version>(ex. 3.1.1, 3.4.2, 4.1.3, 4.2.1, 4.3.1):
patch -t -p 1 < FFmpeg-n4.3.1_netint_v5.0.0_RC2.diff
It is critical to apply the correct NETINT patch for the FFmpeg version in use. Check with NETINT Support team for the patch to use. In general, patch file FFmpeg-n4.2.x_netint will work with all FFmpeg 4.2 versions, patch file FFmpeg-n4.3.x_netint will work with all FFmpeg 4.3 versions, and so on.
Build FFmpeg with NETINT Codec Library
The following instructions need to be done in sequence to build FFmpeg with the NETINT Codec Library.
1 From the FFmpeg/ folder, go to the libxcoder/ folder with the following command:
cd C: cd msys64/home/nvme cd FFmpeg cd ../libxcoder
2 Build and install libxcoder with the following commands. Upon a successful compile the files are auto installed to /usr/local/bin folder.
bash build.sh -w ls /usr/local/bin init_rsrc.exe ni_rsrc_list.exe ni_rsrc_mon.exe ni_rsrc_update.exe
Update pkg-config path:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
Go to the FFmpeg/ directory with the following command:
cd ../FFmpeg
Run the build_FFmpeg.sh script with the following commands. When successfully built, the executables (.EXE) and libraries can be found in the /usr/local/bin and /usr/local/lib folders:
make clean bash build_FFmpeg.sh -w make install
Some related libraries are compiled dynamically, so the following libraries “libiconv-2.dll, libwinpthread-1.dll, SDL2.dll, zlib1.dll” need to be copied from
C:/msys64/mingw64/bin to C:/msys64/usr/local/bin
In a MSYS2 or Mingw64 terminal window run the following commands to confirm the folder contents:
ls /usr/local/bin
Example
SDL2.dll init_rsrc.exe libwinpthread-1.dll ni_rsrc_mon.exe zlib1.dll ffmpeg.exe libiconv-2.dll ni_rsrc_list.exe ni_rsrc_update.exe
ls /usr/local/lib/*
Example
/usr/local/lib/libavcodec.a /usr/local/lib/libpostproc.a /usr/local/lib/libavdevice.a /usr/local/lib/libswresample.a /usr/local/lib/libavfilter.a /usr/local/lib/libswscale.a /usr/local/lib/libavformat.a /usr/local/lib/libxcoder.a /usr/local/lib/libavutil.a
ls /usr/local/lib/pkgconfig
Example
libavcodec.pc libavfilter.pc libavutil.pc libswresample.pc xcoder.pc libavdevice.pc libavformat.pc libpostproc.pc libswscale.pc
This completes the installation steps in prep to start using Quadra card on your Windows host.
Building FFmpeg with Libxcoder for Quadra and Logan
The Chapter Quadra and Logan Co-existence in this document describes the feature compatibility between Quadra and Logan. Follow the instructions below in sequence to build FFmpeg with the NETINT Codec Library.
From the
FFmpeg/folder, go to thelibxcoder/folder with the following command:
cd C: cd msys64/home/nvme cd FFmpeg cd ../libxcoder
Build and install libxcoder with the following commands. Upon successful compilation the files are auto-installed into the
/usr/local/binfolder.
bash build.sh -w
ls /usr/local/bin
Example
init_rsrc.exe ni_rsrc_list.exe ni_rsrc_mon.exe ni_rsrc_update.exe ni_rsrc_namespace.exe test_rsrc_api.exe
From the
FFmpeg/folder, go to thelibxcoder_logan/folder with the following command:
cd C: cd msys64/home/nvme cd FFmpeg cd ../libxcoder_logan
Build and install libxcoder_logan with the following commands. Upon a successful compile the files are auto installed to /usr/local/bin folder.
bash build.sh -w
ls /usr/local/bin
Example
init_rsrc_logan.exe ni_logan_rsrc_list.exe ni_logan_rsrc_mon.exe ni_logan_rsrc_update.exe test_rsrc_api_logan.exe
Update pkg-config path:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
Go to the
FFmpeg/directory with the following command:
cd ../FFmpeg
Run the build_FFmpeg.sh script with the following commands. When building successfully, the EXEs and libraries can be found in /usr/local/bin and /usr/local/lib folders:
make clean bash build_FFmpeg.sh -w –-quadra --logan make install
Some related libraries are compiled dynamically, so the following libraries
libiconv-2.dll, libwinpthread-1.dll, SDL2.dll, zlib1.dllneed to be copied fromC:/msys64/mingw64/bintoC:/msys64/usr/local/bin
In a MSYS2 or Mingw64 terminal window run the following commands to confirm the folder contents:
ls /usr/local/bin
Example
SDL2.dll init_rsrc.exe libwinpthread-1.dll ni_rsrc_mon.exe zlib1.dll ffmpeg.exe libiconv-2.dll ni_rsrc_list.exe ni_rsrc_update.exe init_rsrc_logan.exe ni_logan_rsrc_mon.exe ni_logan_rsrc_list.exe ni_logan_rsrc_update.exe test_rsrc_api_logan.exe test_rsrc_api.exe
ls /usr/local/lib/*
Example:
/usr/local/lib/libavcodec.a /usr/local/lib/libpostproc.a /usr/local/lib/libavdevice.a /usr/local/lib/libswresample.a /usr/local/lib/libavfilter.a /usr/local/lib/libswscale.a /usr/local/lib/libavformat.a /usr/local/lib/libxcoder.a /usr/local/lib/libavutil.a /usr/local/lib/libxcoder_logan.a
ls /usr/local/lib/pkgconfig
Example
libavcodec.pc libavfilter.pc libavutil.pc libswresample.pc xcoder.pc xcoder_logan.pc libavdevice.pc libavformat.pc libpostproc.pc libswscale.pc
This completes the installation steps in prep to start using Quadra and Logan cards on your Windows host.