4

I use these commands to send and recieve rtp data:

Send rtp data to UDP port 5000

gst-launch-1.0 -v filesrc location = haizeiwang.mp4 ! decodebin ! x264enc ! rtph264pay ! udpsink host=192.168.1.101 port=5000

Receive rtp data from udp port 5000 and play it.

gst-launch-1.0 -v udpsrc port=5000 caps="application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, payload=96, ssrc=3394826012, timestamp-offset=2215812541, seqnum-offset=46353" ! rtph264depay ! decodebin ! videoconvert ! autovideosink sync=false

But i can only get vedio(not very clear) , and there is no sound. Could i get vedio and audio at the same time? Which elememnts should i use? What the commands should be?

Thank you.

ZhangFei
  • 71
  • 1
  • 6
  • 1
    same as http://stackoverflow.com/questions/41505073/gstreamer-stream-audio-and-video-via-udp-to-be-able-to-playback-on-vlc#comment70222286_41505073 – RSATom Mar 01 '17 at 02:13

1 Answers1

8

Sender (audio+video):

gst-launch-1.0 -v uridecodebin name=uridec uri=file:///C:\\video.mp4 ! videoconvert ! x264enc noise-reduction=10000 tune=zerolatency byte-stream=true threads=4 key-int-max=15 intra-refresh=true ! mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! queue ! udpsink host=127.0.0.1 port=5000 sync=true uridec. ! audioconvert ! voaacenc ! audio/mpeg ! queue ! mux.  

Receiver (audio+video, short version):

gst-launch-1.0 -v playbin uri=udp://127.0.0.1:5000

Receiver (audio+video, long version):

gst-launch-1.0 -v udpsrc port=5000 ! tsparse ! decodebin name=dec ! videoconvert ! autovideosink sync=true dec. ! queue ! audioconvert ! audioresample ! autoaudiosink sync=true

If you have access to VLC via cmd-line, you can play the stream with:

vlc rtp://@:5000

Or just go to VLC graphical interface to Open Network Stream (CTRL+N) and use the address I shared above.

karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • Hello! Your examples works only on localhost for me. So if I try to broadcast source to another Clients I have an error: Could not find address... – JDo Aug 30 '18 at 14:10
  • I've used it in computers within the same LAN with no problems. – karlphillip Aug 30 '18 at 14:38
  • I try too, but in my case it's not working. An error appears on the client side cmd. I dont know whats going on... – JDo Aug 30 '18 at 14:58
  • Firewall or antivirus turned on, maybe? Anyway, for network related problems I recommend going to [superuser](https://superuser.com) or [serverfault](https://serverfault.com/) for help. – karlphillip Aug 30 '18 at 15:00
  • Today I try stream from my PC on Windp\ows 10 with turned off Virus and Thred protection an Brandmauer to Raspberri Pi II, I have the same error. But! If I stream only H.264 video using this command line: `gst-launch-1.0 -v filesrc location=d:/TestVideos/costarica.mp4 ! queue ! decodebin ! x264enc ! rtph264pay ! udpsink host=ххх.ххх.х.ххх port=хххх` – JDo Aug 31 '18 at 06:03
  • Maybe in Client side caps parameters is needed? – JDo Aug 31 '18 at 06:29
  • vlc complains that SDP file is missing – Stepan Yakovenko Oct 18 '19 at 15:03
  • Use the GUI as suggested on the end of the answer. – karlphillip Oct 18 '19 at 17:56
  • how would you use `filesrc location=` instead of uridecodebin in the sender command line? – arunkumar Jul 10 '20 at 14:07
  • The receiver short version works perfectly (no latency), vlc works (sometimes, and with 2sec latency, it seems its general to vlc), but the receiver long version runs but stays like stuck (no error, just a bunch of lines output on the console). What are its benefits? Any idea why it doesn't work? – Simon Mourier Aug 14 '20 at 10:23