Skip to main content
Version: v5.9.0

ni_quadra_hwupload

The FFmpeg hwupload filter transfers YUV image data from a software frame to the hardware and outputs a hardware frame. The ni_quadra_hwupload filter does the same thing but adds a device ID parameter to specify which card the image data should be transferred to. Using ni_quadra_hwupload is required if we need to process a software frame with an Netint filter that only supports hardware frames. It is also useful if we need to feed the same software frame to multiple inputs on the same card (say multiple encoders and the 2D Engine) as it saves additional YUV transfers.

12 pixel formats are supported for the ni_quadra_hwupload filter: yuv420p, yuv420p10le, nv12, p010le, rgba, argb, abgr, bgra, bgr0, nv16, yuyv422 and uyvy422.

Parameters​

The following are the ni_quadra_hwupload parameters:

device​

Device ID of the hardware to upload to. A value of –1 or no entry means to upload to the device with the lowest upload pixel rate. If there are not enough resources to open the upload instance, the upload will return with failure.

The upload pixel rate is calculated from the input video given to the filter. For example, the ffmpeg command

ffmpeg -r 30 –s:v 1920x1080 –i input.yuv –vf ni_quadra_hwupload=1 ...

uploads to device 1. An upload pixel rate of 1920 x 1080 x 30 = 62,208,000 pixels/second will be added to device 1. If another ffmpeg command is run, say

ffmpeg –r 25 –s:v 1280x720 –i input2.yuv -vf ni_quadra_hwupload=-1 ...

the device with the lowest upload pixel rate is chosen. A device other than 1 will be selected and will have an upload pixel rate of 1280 x 720 x 25 = 23,040,000 pixels/second added to it.

Supported Values-1, 0-255
DefaultResource monitor assigns the device

devname​

Device name of the hardware to upload to. The device name should be like /dev/nvmeXnY as ni_rsrc_mon shows.

keep_alive_timeout​

Specifies a session keep alive timeout value. This is a periodic request/response between libxcoder and XCoder firmware that when timed out, terminates the session instance by XCoder firmware.

Supported ValuesInteger in the range 1 to 100
Default3

The following example shows ni_quadra_hwupload being used with ni_quadra_scale to avoid the multiple YUV transfers. The input MPEG2 bitstream is decoded using the FFmpeg soft decoder which outputs software frames. ni_quadra_hwupload is then used to upload the YUV software frame to device 0 returning a hardware frame. Then the FFmpeg split is used to split the hardware frame into 3. The first split output [out1] is fed directly to a Netint h.265 encoder collocated with the hardware frame (-enc -1). The second split output [in2] is scaled to 720p on [out2] using ni_quadra_scale and then encoded on a second collocated encoder. The third split output [in3] is scaled to 540p using ni_quadra_scale and fed to a third collocated encoder. All decoding, scaling, and encoding is done on a single device with

ffmpeg -y -i input1080p-mpeg2.ts -filter_complex '[0:v]ni_quadra_hwupload=device=0,split=3[out1][in2][in3];[in2]ni_quadra_scale=1280:720[out2];[in3]ni_quadra_scale=854:480[out3]' -map '[out1]' -c:v h265_ni_quadra_enc -enc -1 -xcoder-params "RcEnable=1:vbvBufferSize=3000:bitrate=10000000" 1080p.265 -map '[out2]' -c:v h265_ni_quadra_enc -enc -1 -xcoder-params "RcEnable=1:vbvBufferSize=3000:bitrate=4000000" 720p.265 -map '[out3]' -c:v h265_ni_quadra_enc -enc -1 -xcoder-params "RcEnable=1:vbvBufferSize=3000:bitrate=1000000" 480p.265
ffmpeg –y –i input.mp4 -vf ni_quadra_hwupload=devname=/nvme0n1,ni_quadra_scale=1280:720 -c:v h264_ni_quadra_enc output.mp4