How to get 30fps performance using NvVideoEncoder

Hi.
I’m testing the H.264 encoder of Jetson Nano with the MMAPI 10_camera_recording sample code. The FPS of the sample code is around 21fps. Would you tell me why the code cannot achieve 30fps? I’m using the Raspberry Pi v2 camera for video input.

$ sudo nvpmodel -m 0
$ sudo jetson_clocks
$ ./camera_recording -s

Set governor to performance before enabling profilerPRODUCER: Creating output stream
PRODUCER: Launching consumer thread
Opening in BLOCKING MODE
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
875967048
842091865
create video encoder return true
H264: Profile = 100, Level = 50 
PRODUCER: Starting repeat capture requests.
----------- Element = enc0 -----------
Total Profiling time = 4.89782
Average FPS = 21.0298
Total units processed = 104
Average latency(usec) = 2592
Minimum latency(usec) = 2304
Maximum latency(usec) = 6688
-------------------------------------
CONSUMER: Got EOS, exiting...
CONSUMER: Done.
PRODUCER: Done -- exiting.
************************************
Total Profiling Time = 0 sec
************************************

The GStreamer pipeline can achieve 30fps.

$ gst-launch-1.0 \
> nvarguscamerasrc ! \
> 'video/x-raw(memory:NVMM),width=1920,height=1080,framerate=30/1' ! \
> queue ! \
> nvv4l2h264enc maxperf-enable=1 ! \
> fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 \
> -v

/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0: sync = false
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 17, dropped: 0, current: 33.31, average: 33.31
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 33, dropped: 0, current: 30.02, average: 31.63
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 49, dropped: 0, current: 30.01, average: 31.08
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 65, dropped: 0, current: 30.01, average: 30.81
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 81, dropped: 0, current: 30.00, average: 30.65

Thanks.

Hi,
By default it selects the first sensor mode 3264x2464p21. Please refer to this option in 09_camera_jpeg_capture:

  --sensor-mode Sensor mode            [Default 0]

And apply it to 10_camera_recording to select 30fps mode.

Thank you very much!
I have gotten 30fps encoder performance with the 1920x1080 30fps sensor mode.

./camera_recording -s -m 2
Set governor to performance before enabling profiler
PRODUCER: Creating output stream
PRODUCER: Launching consumer thread
Opening in BLOCKING MODE
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
875967048
842091865
create video encoder return true
H264: Profile = 100, Level = 50 
PRODUCER: Available Sensor modes :
PRODUCER: [0] W=3264 H=2464
PRODUCER: [1] W=3264 H=1848
PRODUCER: [2] W=1920 H=1080
PRODUCER: [3] W=1640 H=1232
PRODUCER: [4] W=1280 H=720
PRODUCER: [5] W=1280 H=720
PRODUCER: Starting repeat capture requests.
----------- Element = enc0 -----------
Total Profiling time = 4.89411
Average FPS = 30.0361
Total units processed = 148
Average latency(usec) = 2747
Minimum latency(usec) = 2446
Maximum latency(usec) = 6712
-------------------------------------
CONSUMER: Got EOS, exiting...
CONSUMER: Done.
PRODUCER: Done -- exiting.
************************************
Total Profiling Time = 0 sec
************************************

Modified main.cpp

1 Like

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