我想了解更多關於使用RTCP和Gstreamer同步不同流的信息。視頻垂直分成4部分,以便在接收器處更好地觀察同步。以下是用於發送者和接收者的代碼。使用Gstreamer同步多個流
發件人:
gst-launch -v \
\
gstrtpbin name=rtpbin1 \
filesrc location=/home/chinthaka/Desktop/MageHeenaye101.avi ! decodebin ! x264enc ! rtph264pay ! rtpbin1.send_rtp_sink_0 \
rtpbin1.send_rtp_src_0 ! udpsink host=192.168.1.100 port=5011 \
rtpbin1.send_rtcp_src_0 ! udpsink host=192.168.1.100 port=5012 \
udpsrc port=5013 ! rtpbin1.recv_rtcp_sink_0 \
\
gstrtpbin name=rtpbin2 \
filesrc location=/home/chinthaka/Desktop/MageHeenaye102.avi ! decodebin ! x264enc ! rtph264pay ! rtpbin2.send_rtp_sink_0 \
rtpbin2.send_rtp_src_0 ! udpsink host=192.168.1.100 port=5021 \
rtpbin2.send_rtcp_src_0 ! udpsink host=192.168.1.100 port=5022 \
udpsrc port=5023 ! rtpbin2.recv_rtcp_sink_0 \
\
gstrtpbin name=rtpbin3 \
filesrc location=/home/chinthaka/Desktop/MageHeenaye103.avi ! decodebin ! x264enc ! rtph264pay ! rtpbin3.send_rtp_sink_0 \
rtpbin3.send_rtp_src_0 ! udpsink host=192.168.1.100 port=5031 \
rtpbin3.send_rtcp_src_0 ! udpsink host=192.168.1.100 port=5032 \
udpsrc port=5033 ! rtpbin3.recv_rtcp_sink_0 \
\
gstrtpbin name=rtpbin4 \
filesrc location=/home/chinthaka/Desktop/MageHeenaye104.avi ! decodebin ! x264enc ! rtph264pay ! rtpbin4.send_rtp_sink_0 \
rtpbin4.send_rtp_src_0 ! udpsink host=192.168.1.100 port=5041 \
rtpbin4.send_rtcp_src_0 ! udpsink host=192.168.1.100 port=5042 \
udpsrc port=5043 ! rtpbin4.recv_rtcp_sink_0
接收機:
gst-launch -v \
videomixer name=mix ! ffmpegcolorspace ! autovideosink sync=false async=false \
\
gstrtpbin name=rtpbin1 \
udpsrc port=5011 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"Z01AFeygbCPNLgIgAAADAC7msoAB4sWywA\\=\\=\\,aOvssg\\=\\=\", payload=(int)96, ssrc=(uint)861153369, clock-base=(uint)4026289255, seqnum-base=(uint)30449" ! rtpbin1.recv_rtp_sink_0 rtpbin1. ! rtph264depay ! queue ! ffdec_h264 ! videobox border-alpha=0 top=0 left=0 ! mix. \
udpsrc port=5012 ! rtpbin1.recv_rtcp_sink_0 \
rtpbin1.send_rtcp_src_0 ! udpsink port=5013 host=192.168.1.104 \
\
gstrtpbin name=rtpbin2 \
udpsrc port=5021 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"Z01AFeygbCPNLgIgAAADAC7msoAB4sWywA\\=\\=\\,aOvssg\\=\\=\", payload=(int)96, ssrc=(uint)861153369, clock-base=(uint)4026289255, seqnum-base=(uint)30449" ! rtpbin2.recv_rtp_sink_0 rtpbin2. ! rtph264depay ! queue ! ffdec_h264 ! videobox border-alpha=0 top=-120 left=0 ! mix. \
udpsrc port=5022 ! rtpbin2.recv_rtcp_sink_0 \
rtpbin2.send_rtcp_src_0 ! udpsink port=5023 host=192.168.1.104 \
\
gstrtpbin name=rtpbin3 \
udpsrc port=5031 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"Z01AFeygbCPNLgIgAAADAC7msoAB4sWywA\\=\\=\\,aOvssg\\=\\=\", payload=(int)96, ssrc=(uint)861153369, clock-base=(uint)4026289255, seqnum-base=(uint)30449" ! rtpbin3.recv_rtp_sink_0 rtpbin3. ! rtph264depay ! queue ! ffdec_h264 ! videobox border-alpha=0 top=-240 left=0 ! mix. \
udpsrc port=5032 ! rtpbin3.recv_rtcp_sink_0 \
rtpbin3.send_rtcp_src_0 ! udpsink port=5033 host=192.168.1.104 \
\
gstrtpbin name=rtpbin4 \
udpsrc port=5041 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"Z01AFeygbCPNLgIgAAADAC7msoAB4sWywA\\=\\=\\,aOvssg\\=\\=\", payload=(int)96, ssrc=(uint)861153369, clock-base=(uint)4026289255, seqnum-base=(uint)30449" ! rtpbin4.recv_rtp_sink_0 rtpbin4. ! rtph264depay ! queue ! ffdec_h264 ! videobox border-alpha=0 top=-360 left=0 ! mix. \
udpsrc port=5042 ! rtpbin4.recv_rtcp_sink_0 \
rtpbin4.send_rtcp_src_0 ! udpsink port=5043 host=192.168.1.104
我可以接收4次視頻在相同的視頻,但每個流的同步是不完美的。
我剛剛對所有接收器使用了相同的上限。剛剛發現發件人每次生成的上限都不相同。有沒有一種很好的方法將生成的上限發送給接收器,以便接收器可以使用相同的上限?
是否有任何使用RTCP同步多個流的最佳方法?
這裏不同的端口用於不同的RTP和RTCP會話。這是可取的,還是應該只使用兩個端口:一個用於RTP,另一個用於RTCP。
請給予建議。我對Gstreamer很陌生,並且盡我所能去熟悉這種同步。