title: Multi RTSP stream synchronization by GStreamer
body: <p>I am pretty new to GStreamer. There are servel web cameras and I need sync them by timestamp.</p>
  <p>At first, I directly use opencv to capture all stream and grad the frame as soon as possible to get the newest frame. My solution is very similar to LukasBommes/rtsp-streamsync. But this way has some drawbacks, which is that in fact we cannot ensure that the latest frame of each stream is taken at the same time, due to network fluctuations or the camera itself.</p>
  <p>So I am seeking for better solution. GStreamer says</p>
  <blockquote>
  <p>When playing complex media, each sound and video sample must be played in a specific order at a specific time. For this purpose, GStreamer provides a synchronization mechanism.</p>
  </blockquote>
  <p>But there is no concrete example. I am trying to use rtpbin combined with rtspsrc to achieve this goal. But I am not sure that they can be combined together and rtpbin can sync multi rtsp stream correctly.</p>
  <p>BTW, the example in the document is very confusing for me. I cannot understand how rtpbin connect different udp stream  and make sure that each of them has its own pipeline.</p>
  <pre><code> gst-launch-1.0 rtpbin name=rtpbin \
       v4l2src ! videoconvert ! ffenc_h263 ! rtph263ppay ! rtpbin.send_rtp_sink_0 \
                 rtpbin.send_rtp_src_0 ! udpsink port=5000                            \
                 rtpbin.send_rtcp_src_0 ! udpsink port=5001 sync=false async=false    \
                 udpsrc port=5005 ! rtpbin.recv_rtcp_sink_0                           \
       audiotestsrc ! amrnbenc ! rtpamrpay ! rtpbin.send_rtp_sink_1                   \
                 rtpbin.send_rtp_src_1 ! udpsink port=5002                            \
                 rtpbin.send_rtcp_src_1 ! udpsink port=5003 sync=false async=false    \
                 udpsrc port=5007 ! rtpbin.recv_rtcp_sink_1
  </code></pre>