Dectek DTA-2110

ST2110 Video Test Pattern using DekTec DTA-2110 Smart NIC and FFMPEG (Part 1)

In a previous post we discussed setting up the DekTec DA2110 smart NIC with its API and demonstration examples. No we turn our attention to using the DTA-2110 with ffmpeg to create a video test card with text, which can be used for ident, and in this case to show timecode.

Installing FFMPEG with Dektec and Freetype

 

As with the DTA-2110 API demo installation,  Dektec provide comprehensive instructions to install ffmpeg (https://www.dektec.com/products/SDK/ffmpeg/windows/) , you should  follow these instructions but with some changes we’ve made to allow us to display text using the Freetype ffmpeg add-on.

Prerequisites:

Visual studio (we used VS2022) and Dektec SDK already installed from the previous demo.

MSYS2 was installed to provide an emulated Linux in Windows.

Git was installed in order to clone the vcpkg repository. vcpkg  is an open source c/c++ package manager which we’ll use to install SDL2 (Simple Direct Media Layer).

Install vcpkg to provide additional libraries to be used when installing FFMPEG.

Installation:

Search in Windows start menu for “x64 Native Tools Command Prompt for VS 2022”

Install SDL2 using vcpkg.

This library is required to compile the FFMPEG ‘ffplay’ media player.

 

In addition to the Dektex instructions, after installing SDL2 using vcpkg, freetype and its dependencies (fontconfig and fribidi) were also installed.

"C:\vcpkg\vcpkg.exe" install freetype:x64-windows-static
"C:\vcpkg\vcpkg.exe" install fontconfig:x64-windows-static
"C:\vcpkg\vcpkg.exe" install fribidi:x64-windows-static

 

Adding freetype to the installation allows writing text on the screen. This can be used for timecode display as well fixed text labels positioned as needed.

Utilities required for compilation were installed using package manager in MSYS2 as per instructions.

 

The sources folder provided on the instructions page was downloaded and extracted to the specified location. DekTec FFMPEG Download

The Dektec Windows SDK was already installed from the previous demo, but if not you can install it now.

DTAPI – C++ API for all DTA, DTU, DTE devices

SDK for writing applications with DekTec PC add-on devices.
Includes AvFifo API (SMPTE 2110, SMPTE 2022-5/6), Matrix API, DTAPI.NET, and Dta, Dtu, DtPcie, DtBb2 drivers.
Compatible with Visual Studio 2017, 2019, 2022.  DekTec DTAPI Windows SDK

 

The PKG_CONFIG_PATH environment variable was updated.

This means that, during installation, libraries from both the Dektec SDK and vcpkg can be imported.

Note: that copying and pasting the command from the Dektec instructions may not successfully update the variable.

We recommend splitting the command on two single lines:

ln -s /c/Program\ Files\ \(x86\)/DekTec/SDKs/WinSDK $HOME/WinSDK
export PKG_CONFIG_PATH=$HOME/WinSDK/DTAPI/Lib/VC17/pkgconfig:/c/vcpkg/installed/x64-windows-static/lib/pkgconfig

If successful, running

printenv PKG_CONFIG_PATH

Should show both the Dektec SDK and vcpkg locations, separated by a colon.

Building FFMPEG:

Next, the build directory was created and the configuration script launched with some additional options to enable freetype and its dependencies:

/c/ffmpeg_sources/configure --target-os=win64 --arch=x86_64 --toolchain=msvc --enable-dektec --enable-libfreetype --enable-libfontconfig --enable-libfribidi --enable-nonfree --prefix=/c/ffmpeg_bin

Note:

If an error message is generated including “cl.exe is unable to create an executable file”, a conflict is occurring between MSYS2 and Visual Studio.

If the command: 

which link

returns “/usr/bin/link”

Resolve the conflict by issuing the command:

rm /bin/link.exe

You may have to relaunch MSYS2 from the Visual Studio command prompt and set the PKG_CONFIG_PATH variable again for changes to take effect.

 

Finally, the ‘make‘ and ‘make install‘ commands were run to complete the installation.

On a successful install, the folder /c/ffmpeg_bin/bin should contain:

ffpeg.exe

ffplay.exe

ffprobe.exe

Note:

If ffplay is missing, double check that SDL2 was installed and that PKG_CONFIG_PATH was set correctly.

Once FFMPEG is installed, test by converting an video file to another format.

In windows explorer directly in the C: drive, create a folder called “ffmpeg_test” and download a sample .MP4 file. For this example rename it to “sample.mp4”

Still in MSYS folder /c/ffmpeg_build type:

./ffmpeg -i ../ffmpeg_test/sample.mp4 ../ffmpeg_test/sample.mov

This will take an existing .mp4 file named “sample” and convert it to .mov format.

If the test is successful, the installation complete, and we can now move on to output video over the installed DekTec NIC:

 

In part 2 we will use the installed FFMPEG to create a video test pattern ….  Part 2

References:

https://www.dektec.com/products/SDK/ffmpeg/windows/
https://www.dektec.com/downloads/SDK/#winsdk