OBS Studio
OBS Studio can publish streams to the server in several ways. The recommended one consists in publishing with RTMP.
OBS Studio and RTMP
Standard
In Settings -> Stream (or in the Auto-configuration Wizard), use the following parameters:
- Service:
Custom... - Server:
rtmp://localhost/mystream - Stream key: (empty)
Save the configuration and click Start streaming.
The resulting stream will be available on path /mystream.
If you want to generate a stream that can be read with WebRTC, open Settings -> Output -> Recording and use the following parameters:
- FFmpeg output type:
Output to URL - File path or URL:
rtsp://localhost:8554/mystream - Container format:
rtsp - Check
show all codecs (even if potentially incompatible) - Video encoder:
h264_nvenc (libx264) - Video encoder settings (if any):
bf=0 - Audio track:
1 - Audio encoder:
libopus
Then use the button Start Recording (instead of Start Streaming) to start streaming.
Multitrack video
OBS Studio can publish multiple video tracks or renditions at once (simulcast). Make sure that the OBS Studio version is ≥ 31.0.0. Open Settings -> Stream and use the following parameters:
Service:
Custom...Server:
rtmp://localhost/mystreamStream key: (empty)
Turn on
Enable Multitrack VideoLeave
Maximum Streaming BandwidthandMaximum Video TrackstoAutoTurn on
Enable Config OverrideFill
Config Override (JSON)with the following text:{ "encoder_configurations": [ { "type": "obs_x264", "width": 1920, "height": 1080, "framerate": { "numerator": 30, "denominator": 1 }, "settings": { "rate_control": "CBR", "bitrate": 6000, "keyint_sec": 2, "preset": "veryfast", "profile": "high", "tune": "zerolatency" }, "canvas_index": 0 }, { "type": "obs_x264", "width": 640, "height": 480, "framerate": { "numerator": 30, "denominator": 1 }, "settings": { "rate_control": "CBR", "bitrate": 3000, "keyint_sec": 2, "preset": "veryfast", "profile": "main", "tune": "zerolatency" }, "canvas_index": 0 } ], "audio_configurations": { "live": [ { "codec": "ffmpeg_aac", "track_id": 1, "channels": 2, "settings": { "bitrate": 160 } } ] } }This can be adjusted according to specific needs. In particular, the
typefield is used to set the video encoder, and these are the available parameters:obs_nvenc_av1_tex: NVIDIA NVENC AV1obs_nvenc_hevc_tex: NVIDIA NVENC H265obs_nvenc_h264_tex: NVIDIA NVENC H264av1_texture_amf: AMD AV1h265_texture_amf: AMD H265h264_texture_amf: AMD H264obs_qsv11_av1: QuickSync AV1obs_qsv11_v2: QuickSync H264obs_x264: software H264
Save the configuration and click Start streaming.
The resulting stream will be available on path /mystream.
Encryption (RTMPS)
When publishing streams to MediaMTX with RTMP, you can encrypt streams in transit by using the encrypted variant of RTMP (RTMPS). This can be enabled by using the rtmps scheme and the 1936 port:
rtmps://localhost:1936/mystreamMake sure that RTMP encryption is allowed in MediaMTX (rtmpEncryption: "optional").
OBS Studio requires MediaMTX to use a TLS certificate signed by a public certificate authority and silently rejects self-signed certificates. You can either buy a certificate from a public certificate authority or create a local certificate authority and use it to generate the server certificate and validate it on the OBS Studio machine, by following these instructions:
Create the key pair of the local certificate authority:
openssl req \ -x509 \ -nodes \ -days 3650 \ -newkey rsa:4096 \ -keyout myca.key \ -out myca.crt \ -subj "/O=myca/CN=myca"Use the key pair to create the server certificate. Replace
localhostwith the domain name OBS Studio will use to connect to the server:openssl req \ -newkey rsa:4096 \ -nodes \ -keyout server.key \ -CA myca.crt \ -CAkey myca.key \ -subj "/CN=localhost" \ -x509 \ -days 3650 \ -out server.crtYou must use a domain name to connect to the server, not an IP address. If you do not have a domain name, edit the
/etc/hostsfile of the OBS Studio machine and associate a dummy domain name to the IP address of the server.Put the newly-generated
server.keyandserver.certon the MediaMTX machine, in the same folder of the MediaMTX executable, and check that the configuration points to them.Install the public key (
ca.crt) of the local certificate authority on the OBS Studio machine.If you are using Linux, this can be accomplished with these commands:
sudo mkdir -p /usr/local/share/ca-certificates sudo cp myca.crt /usr/local/share/ca-certificates/ sudo update-ca-certificatesWARNING: this will still not work when OBS Studio is installed with Flatpak, since Flatpak isolates OBS Studio from the host and prevents it from reading the
ca-certificatesfolder. Install OBS Studio through another mean (snap / ppa / .deb).If you are using Windows, this can be accomplished with the command:
certutil -addstore "Root" myca.crt
OBS Studio and WebRTC
Standard
Recent versions of OBS Studio can also publish streams to the server with the WebRTC / WHIP protocol Use the following parameters:
- Service:
WHIP - Server:
http://localhost:8889/mystream/whip
Save the configuration and click Start streaming.
The resulting stream will be available on path /mystream.
Multitrack video
OBS Studio can publish multiple video tracks or renditions at once (simulcast) with WebRTC / WHIP too. Make sure that the OBS Studio version is ≥ 32.1.0. Open Settings -> Stream and use the following parameters:
- Service:
WHIP - Server:
http://localhost:8889/mystream/whip - Simulcast, Total Layers:
2(or greater)
Currently it’s not possible to change resolution or bitrate (or canvas) of renditions, since quality of secondary renditions is hardcoded as a percentage of the main one. You can find details on the OBS documentation.
Save the configuration and click Start streaming.
The resulting stream will be available on path /mystream.
Encryption
When publishing streams to MediaMTX with WebRTC, you can encrypt the WebRTC handshake by using the HTTPS-based variant of WHIP. This can be enabled by using the https scheme:
https://localhost:8889/mystreamMake sure that WebRTC encryption is enabled in MediaMTX (webrtcEncryption: true).
OBS Studio requires MediaMTX to use a TLS certificate signed by a public certificate authority and silently rejects self-signed certificates. You can either buy a certificate from a public certificate authority or create a local certificate authority and use it to generate the server certificate and validate it on the OBS Studio machine. Instructions are reported in OBS Studio and RTMP, encryption (RTMPS).