Stream H264 over RTSP using nvv4l2h264enc using Gstreamer (Getting corrupted frames)

Hello,

I am trying to stream H264 with an RTSP server using Gstreamer.
The H264 is encoded with v4l2h264enc.
In the PC, where I receive the stream I get the following corrupted frames:

.
I’ve noticed that when I set vbv-size to lower value (4000), the stream looks ok but the quality is worse (specifically after every i-frame).
When I try to decode it on the Jetson (locally) - using either v4l2decoder or avdec_h264),it looks fine even without setting vbv-size.

By the way, streaming RTSP from my PC to my Jetson works just fine (encoded with x264).

I would appreciate any help.

Thank you,
Omer

Hi,
Please share your pipeline for reference. If you have confirmed it is not caused by the network instability, let’s check if tuning encoder properties helps.

I tried the same pipeline on a different network and it works better. Though I’m still getting some artifacts from time to time (especially when there’s a lot of movement).
Here are the pipelines:
RTSP Server
appsrc name=appsrc ! nvvidconv ! video/x-raw(memory:NVMM),format=I420 ! nvv4l2h264enc idrinterval=%d bitrate=2000000 ! rtph264pay name=pay0 pt=96

Receiver
$ GST_DEBUG=3 gst-launch-1.0 rtspsrc location=rtsp://192.168.18.58:8558/streamer latency=1000 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! ximagesink

Also, I notice that I’m getting a lot of warnings like this one:
WARN videodecoder gstvideodecoder.c:2780:gst_video_decoder_prepare_finish_frame:<avdec_h264-0> decreasing timestamp (0:49:28.432759907 < 0:49:28.439581624)

I still think it’s related to the RTP configuration and not the encoder. Are there any recommanded properties to use when streaming over bad network?

Thanks

Hi,
Please try to set CBR + virtual buffer size. You can refer to
H264 vs H265 - #4 by DaneLLL
This can provide each encoded frame similar size and may be better in streaming. Not to have burst size.