Gstreamer 管道将 2 个 udp 源合并到 rtmp?

Gstreamer pipeline merging 2 udp sources to rtmp?

我不知道如何合并 2 个 udp 源(1 个用于音频,1 个用于视频),单独来说这很简单,但作为菜鸟不知道如何合并它们,我知道我很接近

gst-launch-1.0 rtpbin name=rtpbin rtpbin.recv_rtp_sink_ \
! udpsrc port=6004 caps="application/x-rtp, media=(string)video,clock-rate=(int)90000,payload=(int)96,encoding-name=VP8-DRAFT-IETF-01" \
! rtpvp8depay \
! queue \
! mux.  rtpbin.recv_rtp_sink_ \
! udpsrc port=6005 caps="application/x-rtp, media=audio, clock-rate=48000, encoding-name=X-GST-OPUS-DRAFT-SPITTKA-00, payload=111,channels=2" \
! rtpopusdepay \
! queue \

...?

我不知道确切的答案,但我会这样做(我们可以通过评论协商一些解决方案:)):

gst-launch-1.0 flvmux name=mux ! rtmpsink udpsrc port=6004 caps="application/x-rtp, media=(string)video,clock-rate=(int)90000,payload=(int)96,encoding-name=VP8-DRAFT-IETF-01" ! rtpvp8depay ! vp8dec ! queue ! x264enc ! mux.  udpsrc port=6005 caps="application/x-rtp, media=audio, clock-rate=48000, encoding-name=X-GST-OPUS-DRAFT-SPITTKA-00, payload=111,channels=2" ! rtpopusdepay ! queue ! opusdec ! voaacenc ! aacparse ! queue ! mux.

为什么这个管道:

  • there are three parts of pipeline which are later linked together,

1, first is flvmux linked to rtmpsink, notice there is no ! sign between this part and next udpsrc part

2, udpsrc video part which needs to be first decoded from vp8 and then reencoded to h264 as flvmux does understand only h264 (I guess no support for vp8, you can check this)

3, udpsrc audio part which is decoded from opus resulting in raw pcm audio and then encoded in aac as flvmux does not seem to understand raw audio

  • after mux this can go to rtpmsink which will stream it to given location (I am not very familiar with this format)

请记住,元素出现的顺序只是创建的顺序,而不是link年龄的顺序..但是我认为如果你想link 因此我把 flvmux 放在开头以便能够使用 mux。稍后命名(类似于别名)。 我创建了管道的这 3 个部分,然后 link 使用 mux 创建它们。别名..