Last update:2025-02-18 09:54:42
This document will walk you through the configurations needed to utilize WebRTC for both pushing and pulling streams, ensuring low-latency and efficient delivery.
Typically, our users utilize two main streaming workflows:
This guide covers both scenarios to help you get started.
This is the most common workflow. You will push your stream to our servers using RTMP, and viewers will pull the stream using WebRTC for low-latency playback.
OBS Studio (Open Broadcaster Software) is a popular free and open-source software for video recording and live streaming. Here’s how to set it up for RTMP push for WebRTC compatibility:
Important Note: B-frame Removal
WebRTC video encoding standards do not natively support B-frames (Bi-directional predicted frames). If your RTMP push stream includes B-frames, playback via WebRTC may experience stuttering. Therefore, it’s crucial to configure OBS Studio to remove B-frames during the encoding process.
Open OBS Studio Settings: Click on “Settings” in the main OBS Studio window.
Navigate to Output Settings: Go to the “Output” tab in the Settings window. Ensure the “Output Mode” is set to “Advanced”.
Configure Video Encoding (x264): In the “Streaming” tab under “Output”, ensure you are using the x264 encoder for video. Within the x264 encoder settings, find the “x264 Options (separated by space)” field and add the parameter: bframes=0
. This explicitly disables B-frames in your video stream.
Start Streaming: Once configured, you can start your RTMP stream from OBS Studio as usual.
CDNetworks supports WebRTC pull streams on various client platforms:
H5 Demo Player: We provide a simple H5 demo player for you to quickly test WebRTC playback in web browsers: http://webrtc-demo.8686c.com/cdnwplayer/play.html
Important Note: Standard WebRTC Support in Browsers
Web browsers generally support standard WebRTC codecs. This means:
- Video Codec: H.264 (without B-frames) is supported. As mentioned earlier, ensure your push stream is configured to remove B-frames.
- Audio Codec: Opus is the preferred audio codec. AAC audio in your push stream will require transcoding, which may introduce latency.
If your source stream uses video or audio formats that are not standard for WebRTC in browsers, CDNetworks can transcode your stream to ensure compatibility. Please contact our customer support to enable transcoding. Please be aware that transcoding can add latency to the stream and may incur additional costs. Contact customer service to discuss optimal encoding settings for your workflow.
For ultra-low latency streaming, CDNetworks also supports WebRTC push streams. This eliminates the need for RTMP and potential transcoding, further minimizing latency.
Codec Limitations: WebRTC push streams, for optimal compatibility and lowest latency, should adhere to the standard WebRTC codec requirements:
Pushing streams using other codecs (e.g., AAC audio, H.264 with B-frames via RTMP) will necessitate transcoding on our platform when pulling via WebRTC, which will increase latency and potentially costs.
To push WebRTC streams from OBS Studio, you will need to install a specific plugin provided by CDNetworks. Currently, this plugin is only supported for Windows versions of OBS Studio.
Extract Plugin Files: Unzip the downloaded obs-webrtc-plugin.zip
file to a location on your computer.
Copy services.json
: Navigate to the extracted folder and find the file services.json
located in: obs-webrtc-plugin\data\obs-plugins\rtmp-services
. Copy this services.json
file.
Replace services.json
in OBS Installation Directory: Locate your OBS Studio installation directory. This is typically found in C:\Program Files\obs-studio\data\obs-plugins\rtmp-services
or a similar location depending on your installation choices. Replace the existing services.json
file in the OBS installation directory with the one you copied from the plugin.
Copy obs-webrtc.dll
: From the extracted plugin folder, navigate to obs-webrtc-plugin\obs-plugins\64bit
. Copy the file obs-webrtc.dll
.
Paste obs-webrtc.dll
to OBS Plugins Directory: Paste the copied obs-webrtc.dll
file into the obs-plugins\64bit
directory within your OBS Studio installation directory.
Verify services.json
in Plugin Config Directory (If Necessary): In some cases, OBS Studio might also load service configurations from a user-specific directory. If you encounter issues pushing the stream after the above steps, check and update the services.json
file in this directory as well: C:\Users\[Your User Name]\AppData\Roaming\obs-studio\plugin_config\rtmp-services
. Replace the services.json
file here with the one from the plugin zip if needed.
Once you have successfully installed the WebRTC plugin, follow these steps to configure OBS Studio for WebRTC push streaming
Obtain Push and Pull URLs: Structure your own WebRTC URLs for initial setup. Here’s an example of how your WebRTC Push and Pull URLs might look:
WebRTC Push URL:
[http://your-push-server.com/live/your_stream_name.sdp](http://your-push-server.com/live/your_stream_name.sdp)
WebRTC Pull URL:
[http://your-pull-server.com/live/your_stream_name.sdp](http://your-pull-server.com/live/your_stream_name.sdp)
Note:
Replacehttp://your-push-server.com
andhttp://your-pull-server.com
with your actual server address, andyour_stream_name
with your desired stream identifier. The.sdp
extension is typical for WebRTC session descriptions.
Configure OBS Stream Settings:
Start Streaming: With these settings configured, you should now be able to start your WebRTC push stream from OBS Studio.