Search code examples
gstreamerrtp

Corrupted H264 video when streaming via RTP/UDP


I'm trying to stream a video encoded in H264 over RTP/UDP.

Sending:

gst-launch-1.0 \
  videotestsrc ! \
  video/x-raw,format=RGBx,width=960,height=540,framerate=25/1 ! \
  videoconvert ! \
  x264enc bitrate=2000 ! \
  rtph264pay config-interval=1 pt=96 ! \
  udpsink port=5000

Receive:

gst-launch-1.0 \
  udpsrc port=5000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! \
  rtph264depay ! \
  decodebin ! \
  videoconvert ! \
  ximagesink

If I start receiving the video before sending it, then everything works as intended.

However, if I start receiving video after the start of sending, then the image "breaks".

An example of a corrupted image

How to fix this problem?


Solution

  • The problem was solved by specifying caps after videoconvert

    ...
    videoconvert ! video/x-raw,format=I420
    ...