Skip to main content
Version: v5.9.0

Docker Containers

This section details the configuration and usage of the NETINT video transcoder device in a Docker container. This can also be used for other NETINT video transcoder solutions.

Pre-requisites for the Quadra Environment on Host​

The Linux Host must have the following working environment.

  1. Quadra libxcoder and FFmpeg source installed and compiled successfully. FFmpeg 4.2.1 is referenced in this document, follow the Quick Start Guide to install libxcoder and FFmpeg.

  2. Running ‘ffmpeg’ dumps similar output to the sample below.

ffmpeg

ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)

configuration: --pkg-config-flags=--static --enable-gpl --enable-nonfree --extra-ldflags=-lm --extra-ldflags=-ldl --enable-libxcoder --enable-ni --enable-pthreads --extra-libs=-lpthread --enable-encoders --enable-decoders --enable-avfilter --enable-muxers --enable-demuxers --enable-parsers --enable-x86asm --disable-debug --disable-ffplay --enable-ffprobe --enable-libx264 --enable-libx265 --enable-libaom --disable-libvpx --disable-cuda-nvcc --disable-cuda --disable-cuvid --disable-nvdec --disable-nvenc --disable-libvmaf --enable-static --disable-shared --extra-cflags=-UNIENC_MULTI_THREAD
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'


  1. Executing sudo nvme list will display all installed Quadra NVMe devices.
sudo nvme list

Example:

Node             SN                   Model                                    Namespace Usage                      Format           FW Rev
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1     Q1A10BA11FC060-0124  QuadraT1A                                1           8.59  TB /   8.59  TB      4 KiB +  0 B   ---00DEV
/dev/nvme1n1     Q1A10BA11FC060-0142  QuadraT1A-EP1                            1           8.59  TB /   8.59  TB      4 KiB +  0 B   ---00DEV
  1. Executing ni_rsrc_mon or sudo ni_rsrc_mon will produce an output similar to the sample below.
ni_rsrc_mon

Example:

NI resource init'd already ..
**************************************************
2 devices retrieved from current pool at start up
Mon Jan 31 13:35:40 2022 up 00:00:00 v---00DEV
Num decoders: 2
BEST INDEX LOAD MODEL_LOAD INST MEM  SHARE_MEM DEVICE         NAMESPACE
L    0     0    0          0    0    0         /dev/nvme0     /dev/nvme0n1
     1     0    0          0    0    0         /dev/nvme1     /dev/nvme1n1
Num encoders: 2
BEST INDEX LOAD MODEL_LOAD INST MEM  SHARE_MEM DEVICE         NAMESPACE
L    0     0    0          0    0    0         /dev/nvme0     /dev/nvme0n1
     1     0    0          0    0    0         /dev/nvme1     /dev/nvme1n1
Num scalers: 2
BEST INDEX LOAD MODEL_LOAD INST MEM  SHARE_MEM DEVICE         NAMESPACE
L    0     0    0          0    0    0         /dev/nvme0     /dev/nvme0n1
     1     0    0          0    0    0         /dev/nvme1     /dev/nvme1n1
Num ais: 2
BEST INDEX LOAD MODEL_LOAD INST MEM  SHARE_MEM DEVICE         NAMESPACE
L    0     0    0          0    0    0         /dev/nvme0     /dev/nvme0n1
     1     0    0          0    0    0         /dev/nvme1     /dev/nvme1n1
**************************************************

Create a Docker Image​

This section describes how to build a Docker image using a Dockerfile and the NETINT Quadra SW release package.

  1. Install the Docker module on your Linux Host. Refer to the links in the previous section 5.1 of this document, Pre-requisites for the Quadra Environment on Host, this describes the  installation steps based on the OS type of your Linux Host.

  2. Install Python Docker package:

sudo pip install docker
  1. Download the Dockerfile from NETINTs public repository on Github:

https://github.com/NETINT-Technologies/quadra_dockerfile/blob/main/Dockerfile

  1. Copy the NETINT release package, for example Quadra_V5.0.0.zip to the same folder as the Dockerfile.

  2. Generate the Docker image:

sudo docker build --tag ni_quadra_sw .

Note, there are two options that can be set with the --build-arg command:

ParameterDescription
NI_RELEASE_VERSIONVersion number of NETINT Quadra SW release package (e.g. --build-arg NI_RELEASE_VERSION=5.0.0)
FFMPEG_VERSIONVersion number of FFmpeg to use (e.g. --build-arg FFMPEG_VERSION=n5.0)
  1. Confirm the Docker image is created:
sudo docker images
REPOSITORY    TAG       IMAGE ID       CREATED          SIZE
ni_quadra_sw  latest    fc6cf4086561            5 weeks ago   1.32GB
  1. https://linuxhint.com/install_configure_docker_ubuntu/

  2. https://docs.docker.com/engine/install/centos/

https://download.docker.com/linux/centos/8/x86_64/stable/Packages/

Docker container and Quadra interworking​

Scope​

This section demonstrates a Quadra transcoding session within the Docker container.

Pre-built Images​

Each GA release includes pre-built images available to Docker Hub

Launch Docker container with Quadra device​

Run the following command to start a container using Docker image ni_quadra_sw

sudo docker run -it --privileged --device /dev/nvme0n1 --device /dev/nvme0 ni_quadra_sw /bin/sh
note

The ‘-v’ option can be updated to point to the host folder where FFmpeg and libxcoder are installed. For example: ~/FFmpeg, ~/FFmpegXcoder etc.

You should get a shell prompt to demonstrate a successful container has started.

Sh-4.2#

Running sudo nvme list should list all the Quadra devices.

sudo nvme list

Example

Node                  SN                   Model                                    Namespace Usage                      Format           FW Rev
--------------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1          Q1A10BA11FC060-0124  QuadraT1A                                1           8.59  TB /   8.59  TB      4 KiB +  0 B   ---00DEV
/dev/nvme1n1          Q1A10BA11FC060-0142  QuadraT1A-EP1                            1           8.59  TB /   8.59  TB      4 KiB +  0 B   ---00DEV

Transcoding​

Run a transcoding operation using FFmpeg. The sample below is for an AVC to HEVC transcode on a 1920x1080p_ParkScene.264 clip.

note

There are some test clips in the FFmpegXcoder/libxcoder/test folder.

ffmpeg -y -nostdin -hide_banner -vsync 0 -c:v h264_ni_quadra_dec -dec 0 -i 1920x1080p_ParkScene.264 -vf scale=1920:1080 -xcoder-params intraQP=27:intraPeriod=120 -c:v h265_ni_quadra_enc -enc 0 -xcoder-params intraQP=27:intraPeriod=120 1920x1080p_ParkScene-0-0.265

Input #0, h264, from '1920x1080p_ParkScene.264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 24 fps, 24 tbr, 1200k tbn, 48 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_ni_quadra_dec) -> hevc (h265_ni_quadra_enc))
[h265_ni_quadra_enc @ 0x2705180] Session state: 0 allocate frame fifo.
[h265_ni_quadra_enc @ 0x2705180] pix_fmt is 0, sw_pix_fmt is -1
[h265_ni_quadra_enc @ 0x2705180] sw_pix_fmt assigned to pix_fmt was 0, is now -1
[h265_ni_quadra_enc @ 0x2705180] p_param->hwframes = 0
[h265_ni_quadra_enc @ 0x2705180] dts offset: 7, gop_offset_count: 0
Output #0, hevc, to '1920x1080p_ParkScene-0-0.265':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: hevc (h265_ni_quadra_enc), yuv420p, 1920x1080, q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc
    Metadata:
      encoder         : Lavc58.54.100 h265_ni_quadra_enc
frame=  240 fps=208 q=-0.0 Lsize=    2572kB time=00:00:09.62 bitrate=2188.7kbits/s speed=8.34x
video:2572kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%