Hardware Transcoding with Nvidia NVENC
Flussonic Media Server supports hardware video transcoding using the GPU on NVIDIA graphics cards. The list of supported cards can be found at NVIDIA website.
This feature requires the installed Nvidia driver to be of version 352 or higher.
Note. Starting from 19.05, the Flussonic transcoder can process 10-bit H.265 (HEVC) streams if you use Nvidia NVENC.
Installing the driver
Install the driver from the package:
apt-get install nvidia-375
For streams with 10-bit color depth you'll need driver version at least 385.130.
apt-get install nvidia-driver libnvidia-encode1
Make sure the
non-free component is enabled in
To work with a lot of transcoder processes (more than 40), you'll need to increase the operating system's limit on open files.
To do this, run the
ulimit -n 4096
And add the following lines to the
* hard nofile 4096 * hard nofile 4096
Enabling the transcoder
There are two ways to set up transcoding:
- In a stream's configuration entry, using the
transcoderdirective with various options.
- In the Web UI, under Media > choose a stream > Transcoder.
In both cases, you should add the
hw=nvenc option to enable NVENC transcoding:
transcoder vb=2048k hw=nvenc ab=128k
Selecting a codec
The default codec is H.264. When using NVIDIA NVENC, you can also use H.265 (HEVC):
transcoder vb=2048k hw=nvenc vcodec=hevc ab=128k
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 that you have an up-to-date version of the NVIDIA drivers — at least 384.130. An Ubuntu version of at least 16.04 is also required.
Selecting the graphics card
If the system has multiple graphics cards, you can choose which one to use with the
transcoder vb=2048k hw=nvenc deviceid=2 ab=128k
The number of the card can be retrieved with the Linux console command
By default, the first graphics card is used:
crop=left:right:width:height 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 and encoding is performed on the GPU by default.
To use the CPU for decoding, specify
hw=nvenc2 instead of
transcoder vb=2048k hw=nvenc2 ab=128k
Deinterlacing is enabled by default when using
nvenc2 (using the CPU to decode), deinterlacing has to be turned on explicitly with the
To disable resource-consuming deinterlacing, specify
deinterlace=0 in the transcoding settings.
Other parameters, such as
level are used in the same manner as the CPU transcoder options.
preset parameter can have one of these values:
llhp. The default value is
Nvidia's consumer-grade GeForce video cards have a limitation on the number of streams they can encode at the same time: in most cases, there is a limit of two encoding jobs per card. GPUs in Nvidia's QUADRO and TESLA product lines do not have this restriction. Note that the maximum number of streams that a card can transcode simultaneously depends on many factors, including the parameters of the input and output streams (codec, bitrate, video resolution, frames per second, etc.), as well as the hardware resources of the server.
Use Nvidia's GPU comparison table to select the appropriate GPU hardware for your project.
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:
To stop saving statistics on Nvidia, update the configuration file:
To view the data in a graph, create a query to the Pulse database and run it in the administrator interface in Pulse. (In the Custom query field.)
The following metrics may be used (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.
gpu_pclk— Memory and processor clocks (in MHz)
gpu_tviol— Power overdraw (in %) and thermal overdraw (as a boolean value)
gpu_bar1— Frame buffer and Bar1 memory usage (in MB)
gpu_dbecc— ECC (number of aggregated single bit, double bit ECC errors) and PCIe replay errors
gpu_txpci— PCIe Rx and Tx throughput in MB/s (Maxwell and above).