title: How to fix image problems when streaming h.264 via gstreamer udpsink
body: <p>Using gstreamer I want to stream images from several Logitech C920 webcams to a Janus media server in RTP/h.264 format. The webcams produce h.264 encoded video streams, so I can send the streams to a UDP sink without re-encoding data, only payloading it.</p>
  
  <p>I'm using the gst-interpipe plugin to switch between the different webcams, so that the video stream received by Janus stays the same, but with images coming from whatever webcam I choose. </p>
  
  <p>It works but I'm experiencing some problems with broken frames where the colors are gray and details are blurred away, mainly the first 5 - 10 seconds after I switch between webcam source streams. After that the images correct themselves.</p>
  
  <p><a href="https://i.stack.imgur.com/vRIfW.png" rel="nofollow noreferrer">First frames</a></p>
  
  <p><a href="https://i.stack.imgur.com/KITwG.png" rel="nofollow noreferrer">After 5 - 10 seconds or more</a></p>
  
  <p>First I thought it was a gst-interpipe specific problem, but I can reproduce it by simply setting up two pipelines - one sending a video stream to a UDP sink and one reading from a UDP source:</p>
  
  <pre><code>gst-launch-1.0 -v -e v4l2src device=/dev/video0 ! queue ! video/x- 
  h264,width=1280,height=720,framerate=30/1 ! rtph264pay 
  config-interval=1 ! udpsink host=127.0.0.1 port=8004
  
  
  gst-launch-1.0 -v udpsrc port=8004 caps = "application/x-rtp, 
  media=video, clock-rate=90000, encoding-name=H264, payload=96" ! 
  rtph264depay ! decodebin ! videoconvert ! xvimagesink
  </code></pre>
  
  <p>NB: I'm not experiencing this problem if I send the video stream directly to an xvimagesink, i.e. when not using UDP streaming.</p>
  
  <p>Am I missing some important parameters in my pipelines? Is this a buffering issue? I really have no idea how to correct this.
  Any help is greatly appreciated.</p>