Utilizing both NVENC with GStreamer

Hi,
I’m running 4 5MP cameras in parallell on the Xavier 8GB, streaming 24FPS video. With this setup i should be able to make 24FPS because the Xavier 8GB is rated to 2x464MP/s. However, I’m not able to utilize the NVENC1 chip, running tegrastats I only get load on the NVENC. It should be mentioned that I have patched gstreamer to run the NVENC on max frequency such that it is always reporting 499, examble tegrastats:

RAM 1450/7764MB (lfb 1459x4MB) SWAP 0/3882MB (cached 0MB) CPU [1%@2035,31%@2035,29%@2035,32%@2035,0%@2035,off] EMC_FREQ 12%@1331 GR3D_FREQ 0%@905 NVENC 499 APE 75 MTS fg 0% bg 4% AO@36.5C GPU@37C Tdiode@39.75C PMIC@100C AUX@36.5C CPU@37.5C thermal@36.95C Tboard@37C GPU 657/657 CPU 1314/1345 SOC 2065/2065 CV 0/0 VDDRQ 657/657 SYS5V 2312/2312

How can I utilize the full encoding potential of Xavier running through GStreamer?

Edit:
Also, with this setup I’m only managing ~13fps on each camera, which corresponds to ~260MP/s. Why am I not getting better results? There is no large different utilizing a high/medium/low bitrate or baseline/main/high profile.

Hi,
Do you run each encoding thread in individual process? Or 4 encoding threads in single process? If you run each encoding thread in individual process, it should trigger NVENC1

I tried running four instances of the app, thus launching all encoders in their own process. However, I could not trigger NVENC1.

top - 06:36:16 up 3 min, 5 users, load average: 4.11, 2.14, 0.85
Threads: 469 total, 5 running, 460 sleeping, 0 stopped, 4 zombie
%Cpu(s): 1.0 us, 17.6 sy, 0.0 ni, 81.2 id, 0.0 wa, 0.2 hi, 0.0 si, 0.0 st
KiB Mem : 7950020 total, 5217768 free, 2095676 used, 636576 buff/cache
KiB Swap: 3975000 total, 3975000 free, 0 used. 5740164 avail Mem

PID USER PR NI VIRT RES SHR P S %CPU %MEM TIME+ COMMAND
4608 root -21 0 1137728 298544 58848 1 S 26.6 3.8 0:53.60 source_element:
4848 root -21 0 1156832 297620 58912 3 S 25.0 3.7 0:28.01 source_element:
4676 root -21 0 1137040 301776 58912 2 S 24.7 3.8 0:47.00 source_element:
4923 root -21 0 1156832 301688 58848 4 R 24.3 3.8 0:15.65 source_element:
4603 root -21 0 1137728 298544 58848 1 S 0.7 3.8 0:00.90 video_encoder:s
4844 root -21 0 1156832 297620 58912 3 S 0.7 3.7 0:00.46 camera_app
4850 root -21 0 1156832 297620 58912 3 S 0.7 3.7 0:00.38 NVMVidEncInputT
4924 root -21 0 1156832 301688 58848 4 S 0.7 3.8 0:00.28 video_encoder:s
4605 root -21 0 1137728 298544 58848 1 S 0.3 3.8 0:00.91 camera_app
4606 root -21 0 1137728 298544 58848 1 S 0.3 3.8 0:00.19 queue_video:src
4607 root -21 0 1137728 298544 58848 1 S 0.3 3.8 0:00.52 queue_image:src
4609 root -21 0 1137728 298544 58848 1 S 0.3 3.8 0:00.78 NVMVidEncInputT
4622 root -2 0 1137040 301776 58912 0 S 0.3 3.8 0:00.32 camera_app
4671 root -21 0 1137040 301776 58912 2 S 0.3 3.8 0:00.80 video_encoder:s
4673 root -21 0 1137040 301776 58912 2 S 0.3 3.8 0:00.73 camera_app
4675 root -21 0 1137040 301776 58912 2 S 0.3 3.8 0:00.48 queue_image:src
4679 root -21 0 1137040 301776 58912 2 S 0.3 3.8 0:00.64 NVMVidEncInputT
4847 root -21 0 1156832 297620 58912 3 S 0.3 3.7 0:00.28 queue_image:src
4849 root -21 0 1156832 297620 58912 3 S 0.3 3.7 0:00.45 video_encoder:s
4863 root -2 0 1156832 301688 58848 0 S 0.3 3.8 0:00.15 camera_app
4920 root -21 0 1156832 301688 58848 4 R 0.3 3.8 0:00.26 camera_app
4925 root -21 0 1156832 301688 58848 4 S 0.3 3.8 0:00.21 NVMVidEncInputT

RAM 2089/7764MB (lfb 1264x4MB) SWAP 0/3882MB (cached 0MB) CPU [2%@2035,26%@2035,26%@2035,28%@2035,25%@2035,0%@2035] EMC_FREQ 14%@1331 GR3D_FREQ 0%@905 NVENC 499 NVJPG 294 APE 75 MTS fg 0% bg 6% AO@36C GPU@36.5C Tdiode@39.25C PMIC@100C AUX@36C CPU@37.5C thermal@36.45C Tboard@37C GPU 657/657 CPU 1501/1501 SOC 2251/2251 CV 0/0 VDDRQ 750/750 SYS5V 2352/2352

Any suggestions? Would it be possible to adapt the gstomx code to actively control which encoder to use?

Hi,
We can see both NVENC and NVENC1 activated on Xavier 8GB/r32.3.1:

$ gst-launch-1.0 videotestsrc ! video/x-raw,width=3840,height=2160 ! nvvidconv ! nvv4l2h264enc maxperf-enable=1 ! h264parse ! fakesink
RAM 2538/7763MB (lfb 114x4MB) SWAP 0/3881MB (cached 0MB) CPU [0%@2034,0%@2034,0%@2035,0%@2034,87%@2034,4%@2034] EMC_FREQ 8%@1331 GR3D_FREQ 0%@905 NVENC 499 NVENC1 499 APE 75 MTS fg 0% bg 2% AO@24C GPU@26C Tdiode@28.75C PMIC@100C AUX@25.5C CPU@26.5C thermal@25.95C Tboard@27C GPU 457/457 CPU 1527/866 SOC 1526/1253 CV 0/0 VDDRQ 610/344 SYS5V 2009/1916

FYR.