1# rtp-forwarder 2 3rtp-forwarder is a simple application that shows how to forward your webcam/microphone via RTP using WebRTC.rs. 4 5## Instructions 6 7### Build rtp-forwarder 8 9```shell 10cargo build --example rtp-forwarder 11``` 12 13### Open rtp-forwarder example page 14 15[jsfiddle.net](https://jsfiddle.net/1qva2zd8/) you should see your Webcam, two text-areas and a 'Start Session' button 16 17### Run rtp-forwarder, with your browsers SessionDescription as stdin 18 19In the jsfiddle the top textarea is your browser, copy that and: 20 21#### Linux/macOS 22 23Run `echo $BROWSER_SDP | ./target/debug/examples/rtp-forwarder` 24 25#### Windows 26 271. Paste the SessionDescription into a file. 281. Run `./target/debug/examples/rtp-forwarder < my_file` 29 30### Input rtp-forwarder's SessionDescription into your browser 31 32Copy the text that `rtp-forwarder` just emitted and copy into second text area 33 34### Hit 'Start Session' in jsfiddle and enjoy your RTP forwarded stream! 35 36You can run any of these commands at anytime. The media is live/stateless, you can switch commands without restarting Pion. 37 38#### VLC 39 40Open `rtp-forwarder.sdp` with VLC and enjoy your live video! 41 42#### ffmpeg/ffprobe 43 44Run `ffprobe -i rtp-forwarder.sdp -protocol_whitelist file,udp,rtp` to get more details about your streams 45 46Run `ffplay -i rtp-forwarder.sdp -protocol_whitelist file,udp,rtp` to play your streams 47 48You can add `-fflags nobuffer` to lower the latency. You will have worse playback in networks with jitter. 49 50#### Twitch/RTMP 51 52`ffmpeg -protocol_whitelist file,udp,rtp -i rtp-forwarder.sdp -c:v libx264 -preset veryfast -b:v 3000k -maxrate 3000k -bufsize 6000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv rtmp://live.twitch.tv/app/$STREAM_KEY` Make sure to replace `$STREAM_KEY` at the end of the URL first. 53