v4l2 video encoder performance

Hi,

I’m using v4l2 4K HEVC encoder in my application, but it is not running at 30 fps. I am able to get around 20-22 fps. To isolate the issue I used the sample video encode application present in the multimedia API package. I found that gap between v4l2 dequeue callbacks were 70 ~ 50 ms.

I modified sample app to print the dequeue time and ran it as follows

./video_encode input_I420.yuv 3840 2160 H265 output.h265

I realised that file read and file write could be taking time, so I disabled both. With that the throughput improved ( 37 ms => 26 fps), but its still not 30 fps.

Are there any suggestions on how to get 4K 30 HEVC encode with the sample code?

I can share my updates to the sample code if needed.

Hi zeitgeist,
We will investigate and udate

Hi zeitgeist,
Please try MM_API_ADD_ENCODER_HW_PRESET.zip on r24.2.1
MM_API_ADD_ENCODER_HW_PRESET.zip (92.5 KB)

Hi DaneLLL,

Thanks for the update.

I see that you have added hardware preset setting and have suggested to use ultrafast mode. I wanted to understand some more about this.

  1. What is the difference between these modes (ultrafast, fast, medium and slow)?

  2. What is the impact of these modes on quality or compression ratio? Basically, what is the tradeoff?

  3. What is the recommended mode for 4K/1080P and H264/H265 combinations ?

Hi zeitgeist,

  1. What is the difference between these modes (ultrafast, fast, medium and slow)?

  2. What is the impact of these modes on quality or compression ratio? Basically, what is the tradeoff?
    Please refer to https://developer.nvidia.com/embedded/dlc/l4t-accelerated-gstreamer-guide-24-2-1
    Comparing to fast, ultrafast disables some time-consuming HW encoding functions. Video quality is the tradeoff. Please refer to the snapshots:
    https://devtalk.nvidia.com/default/topic/932754/jetson-tx1/more-clarity-on-h-265-encode-parameters-/post/5037363/#5037363

  3. What is the recommended mode for 4K/1080P and H264/H265 combinations ?
    4Kp30 H264/H265: Ultrafast
    1080p30 H264/H265: fast