Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gstreamer pipeline merging 2 udp sources to rtmp?

Tags:

gstreamer

I can't figure out how to merge 2 udp sources (1 for audio and 1 for video), seperately it is pretty easy but no clue how to merge them being a noob, I know I am pretty close

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 \

... ?

like image 200
user6238466 Avatar asked Dec 16 '25 17:12

user6238466


1 Answers

I do not know exact answer but I would go this way (we can negotiate some solution via comments :)) :

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.

Why this pipe:

  • 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)

Keep in mind that the order in which the elements appear is just the order of creation, it is not the order of linkage.. however I think that elements must first exist if you want to link them therefore I put flvmux at the beginning to be able to use the mux. name later (which is something like alias). I create these 3 parts of pipeline and then link them with usage of mux. alias..

like image 110
nayana Avatar answered Dec 19 '25 07:12

nayana



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!