Nvv4l2h264enc square glitches every 30 frames

Hello, I am currently experiencing an issue on Jetpack 6.0 on AGX Orin. When I run a gstreamer pipeline with the nvv4l2h264enc I get white squares on some edges of the image every 30 frames or so.

gst-launch-1.0 videotestsrc pattern=smpte ! “video/x-raw,framerate=1/1” ! nvvidconv ! nvv4l2h264enc ! avdec_h264 ! videoconvert ! ximagesink

vlcsnap-2024-09-03-09h53m07s647

I would appreciate if anyone have a clue of what’s happening.

Hi,
It occurs when hardware encoder encodes the scene into IDR/I frames. Since the scene is not a real-world scene, the hardware encoder may have constraint in encoding the scenes.

Please try with camera input. The real-world scene should be well encoded.

I can confirm that the artifact is negligible with the camera unless I have poor illumination or I cover the lens. However, it is noticeable when I do letterboxing or any processing over the image that results in a dark background.
Is there a way to mitigate this?

Someone suggested to use main profile instead and that fixed it for this pipeline:

gst-launch-1.0 videotestsrc pattern=smpte ! “video/x-raw,framerate=1/1” ! nvvidconv ! nvv4l2h264enc profile=2 ! avdec_h264 ! videoconvert ! ximagesink

I talked too soon. The pipeline of my application is more like this and still have the issue:

gst-launch-1.0 videotestsrc pattern=0 ! “video/x-raw,width=640,height=360,framerate=30/1” ! nvvidconv ! nvv4l2h264enc bitrate=40000000 insert-vui=1 iframeinterval=5 profile=2 ! rtph264pay config-interval=1 ! application/x-rtp,media=video,encoding-name=H264,clock-rate=90000,payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! ximagesink

For some reason, I had to set the profile at caps instead and now it works.

gst-launch-1.0 videotestsrc pattern=0 ! “video/x-raw,width=640,height=360,framerate=30/1” ! nvvidconv ! nvv4l2h264enc bitrate=40000000 iframeinterval=5 ! “video/x-h264,profile=main,level=(string)2.1” ! rtph264pay ! rtph264depay ! h264parse ! nvv4l2decoder ! autovideoconvert ! ximagesink

1 Like