Remote Stream
This is how I stream one machine to another using OBS.
SRT
SRT is a protocol that can carry different codecs, in my experience SRT is more robust than RTMP and is less likely to have audio desync over time. The most reliable one in my experience is mpegts. The machines will be set up as a listener and a caller.
SRT is best sent in OBS via advance recording mode using FFmpeg to output to a URL. This gives you the most options for configuring the encoding of the video for the stream. The normal Streaming tab options are not as comprehensive. You can put the SRT URL there though if you want but you will be limited to x264 encoding options which are not as robust. If you want to locally record while you stream I would recommend looking into the Source Record plugin.
Caller
The caller will take the IP/URL of the listener as part of the path
# |-Server IP
# | |-Port
# | | |-Parameter to set mode
srt://192.168.0.2:10000?mode=caller
To set this up in OBS:
- Go into the Output Settings
- Set Output Mode to
Advanced - Go to the Recording tab
- Set Type to
Custom Output (FFmpeg) - Set FFmpeg Output Type to
Output to URL - Add your URL based on the rules above
- Set Container Format to
mpegtsor experiment with other codecs, but they may not be as reliable
To start sending video over SRT, click the Start Recording button.
Listener
The listener will also take the IP/URL of the listener as part of the path
# |-Server IP
# | |-Port
# | | |-Parameter to set mode
# | | | |-Timeout in ms before breaking connection
srt://192.168.0.2:10000?mode=listener&timeout=5000000
To add a listener in OBS:
- Add a Media Source to your scene
- Open its properties
- Uncheck Local File
- Add your URL to Input based on the rules above
- Do NOT set an Input Format, it will determine it automatically
Additional Notes
You may want to use Ctrl+F on the Media Source you are receiving to so it is automatically stretched to the size of your video frame.
RTMP
RTMP is much more complicated to setup and requires running an external server to relay the video. OBS cannot directly receive an RTMP stream from another OBS instance. So one OBS instance will act as an RTMP Sender, and the other will just be an RTMP Player from the relay server.
RTMP Relay Server
ffmpeg makes for an acceptable rtmp relay server. You can launch it on the command line and leave it running.
# |-Interface to listen on
# | |-Port to listen on
# | | |-Server Path
# | | | |-Stream key
# | | | | |-Output interface for playback
# | | | | | |-Output Port
ffmpeg -f flv -listen 1 -i rtmp://192.168.0.100:8889/live/app -c copy -f flv -listen 1 rtmp://192.168.0.100:1935/live/app
However, when or if the stream disconnects the ffmpeg instance will close. Consider using the following bash script to launch it in a self restarting way with better configuration.
#!/bin/bash
# Input
INPUT_INTERFACE="192.168.0.100"
INPUT_PORT="8889"
# Output
OUTPUT_INTERFACE="192.168.0.100"
OUTPUT_PORT="1935"
# Server
STREAM_PATH="live"
STREAM_KEY="app"
while true; do
ffmpeg -f flv -listen 1 -i "rtmp://$INPUT_INTERFACE:$INPUT_PORT/$STREAM_PATH/$STREAM_KEY" \
-c copy -f flv -listen 1 "rtmp://$OUTPUT_INTERFACE:$OUTPUT_PORT/$STREAM_PATH/$STREAM_KEY"
sleep 1
done
RTMP Video Sender
Your streaming system that will send a video feed to the relay server can be configured normally like any other RTMP stream.
- Go to Stream in Settings
- Set the Service to
Custom... - Set Server to the output URL based on the rules above, but only with the server path (for example:
rtmp://192.168.0.100:8889/live) - Set the Stream Key to the configured value (for example:
app) - Then adjust your encoder settings and usual
RTMP Video Player
The RTMP relay server will be played back in OBS directly. Some guides recommend the VLC Source option in OBS to do this, but the Media Source can as well and when the broadcast is stopped Media Source will hide itself automatically.
To add a player in OBS:
- Add a Media Source to your scene
- Open its properties
- Uncheck Local File
- Add your output URL with the path and key to Input based on the rules above (for example:
rtmp://192.168.0.100:1935/live/app) - Do NOT set an Input Format, it will determine it automatically