Flussonic Media Server documentation

Hardware Transcoding with Nvidia NVENC

Transcoding video by using NVIDIA Nvenc Anchor Anchor x2

Flussonic Media Server is able to encode video using the GPU on NVIDIA graphics cards. The list of supported cards can be found at NVIDIA website.

Make sure that the Nvidia driver of version 352 at least is installed on your system.

Note. Starting from 19.05, Flussonic transcoder can process 10-bit H.265 (HEVC) streams if you use NVIDIA Nvenc.

Installing the driver

Install the driver from the package:

Ubuntu 16.04:

apt-get install nvidia-375

For streams with 10-bit color depth you'll need driver version at least 385.130.

Debian 9:

apt-get install nvidia-driver libnvidia-encode1

Make sure the non-free component is enabled in sourses.list.

On other systems, you can install the driver from the Nvidia site. Installation process description for Debian

To work with a lot of transcoder processes (more than 40), you'll need to increase the operating system's limit on open files: ulimit -n 4096.

Add these lines to /etc/security/limits.conf file:

* hard nofile 4096
* hard nofile 4096

Enabling the transcoder

You can set up transcoding:

  • In the Flussonic configuration file /etc/flussonic/flussonic.conf in a stream settings, using the directive transcoder with various options.
  • In the administrator UI in Media > click a stream > Transcoder.

Add the hw=nvenc option to turn on Nvenc:

transcoder vb=2048k hw=nvenc ab=128k

Selecting a codec

The default codec is H.264. On Nvenc you can also use H.265 (HEVC):

transcoder vb=2048k hw=nvenc vcodec=hevc ab=128k

The support for 10-bit color streams

If you use NVIDIA Nvenc, the Flussonic transcoder can process 10-bit HEVC streams.

The following conversions (input -> output) are possible:

  • 10-bit HEVC -> 8-bit HEVC or H.264
  • 10-bit HEVC -> 10-bit HEVC
  • 8-bit HEVC or H.264 -> 10-bit HEVC

Make sure you have the right version of drivers for NVIDIA - at least 384.130, and your Ubuntu version is at least 16.04.

Selecting the graphics card

If the system has multiple graphics cards, you can choose which one to use with the deviceid=N option:

transcoder vb=2048k hw=nvenc deviceid=2 ab=128k

The number of the card can be retrieved with the command nvidia-smi.

By default, the first graphics card is used: deviceid=0.

Cropping video

The option crop=left:right:width:heigt allows you to crop video (if you use Nvenc):

transcoder vb=2048k hw=nvenc crop=0:0:100:100 ab=128

Decoding on the CPU

Decoding is performed on GPU by default. To use the CPU for decoding, specify hw=nvenc2 insread of hw=nvenc:

transcoder vb=2048k hw=nvenc2 ab=128k

Deinterlacing

Deinterlacing is performed by default when using nvenc. In the case of nvenc2 (that means using CPU for decoding), deinterlacing has to be turned on explicitly with the deinterlace=yes option.

To disable resource-consuming deinterlacing, specify deinterlace=0 in the transcoding settings.

Other parameters, such as size, preset, bframes, level are used just as in CPU transcoder.

The preset parameter can have one of the values: hq, hp, bd, ll, llhq, llhp. The default value is hp.

How many streams can be transcoded on a single video card? Anchor Anchor x2

GeForce series video cards, as a rule, have a limitation in the number of simultaneously encoded streams equal to two. Professional lines QUADRO and TESLA do not have such restrictions, however, the maximum number of transcoded streams depends on many factors, including the quality of input and output streams (bitrate, video resolution, frames per second, etc.), as well as the hardware resources of the server.

When choosing a video card model, use the nvidia comparison table

Statistics on Nvidia performance Anchor Anchor x2

You can collect statistics on the operation of Nvidia GPU if you enable saving statistics in the Pulse database. To start saving data, add the following directive to the Flussonic configuration file:

nvidia_monitor true;

To stop saving statistics on Nvidia, update the configuration file:

nvidia_monitor false;

To view the data on the graph, create a query to the Pulse database and run it in the administrator interface in Pulse (Custom query).

In the query, use the following main metrics (temperature metrics might not be supported by the graphics card):

  • gpu_pwr — Power usage (in Watts)
  • gpu_temp — GPU temperature (in degrees Celsius)
  • gpu_sm — SM (streaming multiprocessor) utilization in %
  • gpu_mem — Memory utilization in %
  • gpu_enc — Encoder utilization in %
  • gpu_dec — Decoder utilization in %
  • gpu_usedmem — Used video memory, in bytes or kilobytes.

Query example:

sum:1m-avg:gpu_dec{from=-2h,gpu=nv0}

Other metrics:

  • gpu_mclk, gpu_pclk — Memory and processor clocks (in MHz)
  • gpu_pviol, gpu_tviol — Power violations (in %) and thermal violations (as a boolean flag)
  • gpu_fb, gpu_bar1 — Frame buffer and Bar1 memory usage (in MB)
  • gpu_sbecc, gpu_dbecc — ECC (number of aggregated single bit, double bit ECC errors) and PCIe replay errors
  • gpu_pci, gpu_rxpci, gpu_txpci — PCIe Rx and Tx throughput in MB/s (Maxwell and above).