rtp-to-webrtc demonstrates how to consume a RTP stream video UDP, and then send to a WebRTC client.
With this example we have pre-made GStreamer and ffmpeg pipelines, but you can use any tool you like!
export GO111MODULE=on
go get github.com/pion/webrtc/v3/examples/rtp-to-webrtc
jsfiddle.net you should see two text-areas and a 'Start Session' button
In the jsfiddle the top textarea is your browser's SessionDescription, copy that and:
Run echo $BROWSER_SDP | rtp-to-webrtc
- Paste the SessionDescription into a file.
- Run
rtp-to-webrtc < my_file
On startup you will get a message Waiting for RTP Packets
, you can use any software to send VP8 packets to port 5004. We also have the pre made examples below
gst-launch-1.0 videotestsrc ! 'video/x-raw, width=640, height=480' ! videoconvert ! video/x-raw,format=I420 ! vp8enc error-resilient=partitions keyframe-max-dist=10 auto-alt-ref=true cpu-used=5 deadline=1 ! rtpvp8pay ! udpsink host=127.0.0.1 port=5004
ffmpeg -re -f lavfi -i testsrc=size=640x480:rate=30 -vcodec libvpx -cpu-used 5 -deadline 1 -g 10 -error-resilient 1 -auto-alt-ref 1 -f rtp rtp://127.0.0.1:5004
Copy the text that rtp-to-webrtc
just emitted and copy into second text area
A video should start playing in your browser above the input boxes.
Congrats, you have used Pion WebRTC! Now start building something cool