Correct Frame Rate to Use with NvVideoEncoder::setFrameRate

Hi,

I sorry to be vague but I’ve been asked to look at some old code in a subject area I don’t understand!

We use the NvVideoEncoder to encoder video from our SDI sources before streaming. This code was written some time ago and not by me.

I’ve been asked to look at this because we are falling behind and throwing away frames when the video input is 1080p50.

The existing code calls NvVideoEncoder::setFrameRate with 50/1, to match the input source. I can see using jtop that NVENC is running at 166MHz. If I change the frame rate to 100/1, NVENC runs at 332MHz. If I change the frame rate to 500/1, NVENC runs at 499MHz.

With NVENC running at the maximum frequency we drop fewer frames.

We are attempting to encode multiple channels. So, while the camera frame rate is 50Hz the frame, I’ve got 2 cameras and therefore I’m encoding 100 fps.

Should the specified frame match the real video frame rate for each channel?

If so, how do I force NVENC to run at the maximum frequency.

I noticed a number of conversations mention video usability information (VUI). I don’t understand the significance of VUI. The code I’m looking at includes a call to setInsertVuiEnabled(true) but it has been commented out. The file history doesn’t explain why. :-(

Should VUI be enabled? If so, will it help with the encode?

Any advice greatly appreciated,
Matt

Hi,
If you would like to run multiple encoding instances simultaneously, please refer to the sample:

/usr/src/jetson_multimedia_api/samples/15_multivideo_encode

Information of framerate is stored in VUI so please enable it.

Hi,

Thanks for your help.

15_multivideo_encode doesn’t say anything specific about the frame rate. I think this means frame rate is meant to be obvious, ie., it is the frame rate of the video input.

15_multivideo_encode gives an example:

./multivideo_encode num_files 2 ../../data/Video/sample_outdoor_car_1080p_10fps.yuv 1920 1080 H264 sample_outdoor_car_1080p_10fps.h264 ../../data/Video/sample_outdoor_car_1080p_10fps.yuv 1920 1080 H264 sample_outdoor_car_1080p_10fps_second.h264

Given the file is called 10fps I can only assume the example command line should include -fps 10 1 as the default is 30fps.

I can see NVENC going to 499 MHz when I run this example. Regardless of how I set fps.

I’m going to continue looking at our application to see if I can find a bottle neck that means we’re not feeding frames to the encoder fast enough to cause it to increase its frequency.

Matt

Hi,
You may enable max perf mode to run hardware encoder at maximum frequency:

int
NvVideoEncoder::setMaxPerfMode(int flag);

Oh, yes, I think that’s what I was looking for! :-)

I’ll give it a try, thanks!

I’ve tried setMaxPerfMode(1) and can see that NVENC is running at 499MHz.

I think this answers my question.

I’m assuming the only downside is a slight increase in power consumption. I suspect, for our applications it likely to be negligible.

Unfortunately for me, I also have to support Jetpack 3.3.3. JP 3.3.3 doesn’t seem to have setMaxPerfMode so I’m going to have to wrestle with our build system to make this a permanent change in our code. :-(

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.