Problems with nvv4l2h264enc and straming (R32.1, TX2)

I have one problem when using nvv4l2h264enc encoder (or nvv4l2h265enc) in combination with streaming (RTP or MPEG-TS, same effect). The problem is the following: If I start streaming first and then try to read the stream (on other system), it does not work. But when I first run the gst line to read the stream and only then start streaming, it works.

When using omxh264enc (or omxh265enc) instead of nvv4l2h264enc everything works as expected.

Example of streaming command:

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' ! nvvidconv ! nvv4l2h264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! rtph264pay mtu=1400 ! udpsink host=225.1.1.1 auto-multicast=true port=1234

Reading and displaying stream:

gst-launch-1.0 udpsrc multicast-group=225.1.1.1 port=1234 auto-multicast=true ! application/x-rtp ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! xvimagesink

Any idea?

Hi,
Please enable ‘insert-sps-pps’ and try again.

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' ! nvvidconv ! nvv4l2h264enc <b>insert-sps-pps=1</b> ! 'video/x-h264, stream-format=(string)byte-stream' ! rtph264pay mtu=1400 ! udpsink host=127.0.0.1 auto-multicast=true port=5000

That solved the problem. Thank you very much!