nvcodec: nv(cuda)h264enc / cudaconvert: CPU consumption is strangely high, restricting framerate in 1.24.1
Environment:
- OS: Ubuntu 22.04, NVIDIA Driver: 535.146.02, GPU: NVIDIA TITAN Xp, CPU: Intel(R) Xeon(R) Gold 6136 CPU @ 3.00GHz
- OS: Ubuntu 20.04, NVIDIA Driver: 530.41.03, GPU: NVIDIA RTX A6000, CPU: AMD Epyc 7443P 24-core
Resolution: 1920x1080@144
I experienced a situation with nvh264enc
in 1.24.1 where the CPU massively bottlenecks the pipeline (one thread consistently hitting 100%), making the frame rate CPU-bound to 17 fps in TITAN Xp and 90 fps in RTX A6000. The same GST-Python code on GStreamer 1.22.8 runs to a reasonable CPU consumption of around 35% on 144 fps in Titan Xp (around 24 times more CPU-efficient per frame). GPU is nearly idle in all cases.
Despite this plugin being deprecated, since this is a stable release, I reckon that this issue should be fixed.
Thank you.
Reproduce:
gst-launch-1.0 videotestsrc is-live=true ! "video/x-raw,format=BGRx,width=1920,height=1080,framerate=144/1" ! cudaupload ! cudaconvert ! "video/x-raw(memory:CUDAMemory),format=NV12" ! nvh264enc bitrate=20000 rc-mode=cbr gop-size=-1 qos=true preset=low-latency-hq ! video/x-h264,profile=high,stream-format=byte-stream ! fakesink
Replace
videotestsrc is-live=true ! "video/x-raw,format=BGRx,width=1920,height=1080,framerate=144/1"
with:
ximagesrc show-pointer=0 remote=1 blocksize=16384 use-damage=0 ! "video/x-raw,framerate=144/1"
to reproduce real condition.