Stream a video file to multiple RTMP publish points using GStreamer bindings for Rust
- Create multiple RTMP publish points using nginx. Download the software and the config files from here
- Extract the downloaded files in root/nginx, in my case C:/nginx
- Modify the nginx/conf/nginx.conf to create multiple applications which are going to server as multiple publish points for RTMP streams
- Make a copy of viewer.html and change the stream_key. This is to be done for every application created in the conf file. In our case the stream keys are stream1 & stream2
- Having created multiple endpoints live1 & live2, start the nginx server by executing start.bat
- For slimmed main
cargo r --bin main -- -u rtmp://127.0.0.1/live1/stream1 rtmp://127.0.0.1/live2/stream2 -f "path:\\to\\video\\file"
- For verbose main
cargo r --bin verbose_main -- -u rtmp://127.0.0.1/live1/stream1 rtmp://127.0.0.1/live2/stream2 -f "path:\\to\\video\\file"
Use gst-launch
or VLC Media Player to stream the video
gst-launch-1.0 uridecodebin uri="rtmp://127.0.0.1/live1/stream1" name=src ! queue ! videoconvert ! autovideosink src. ! queue ! audioconvert ! audioresample ! autoaudiosink
gst-launch-1.0 uridecodebin uri="rtmp://127.0.0.1/live2/stream2" name=src ! queue ! videoconvert ! autovideosink src. ! queue ! audioconvert ! audioresample ! autoaudiosink