Simulcast

Adaptive Bitrate and Multi-bitrate Streaming for Stable End-user Experiences

Simulcast is a mechanism for distributing streaming content with variations that are optimized for viewers who are under different network conditions or device resolutions. Using a mechanism of WebRTC, the broadcast source will simultaneously send video streams encoded with different bitrates and resolutions (HD, SD).

The Selective Forwarding Unit (SFU) adjusts the bit rate so that the streaming viewer will select the highest quality stream it can reliably playback. This is known as Adaptive Bitrate (ABR) streaming. The decision is made based on factors like available bandwidth but also other considerations such as device size, video layout, and CPU utilization. With Multi-bitrate (MBR) Streaming, the end-user can choose which resolution to view. This flexibility allows viewers to adjust their experience for specific circumstances.

1002

Simulcast must be enabled for a publishing token before starting to broadcast.

This guide provides examples of how to setup and configure Simulcast when streaming:

🚧

Bandwidth Usage

Simulcast is included with plans at no additional cost when enabled. However, since multiple streams will be published, there will be more bits sent to the platform which counts as a bandwidth increase. Conversely, viewers may receive a resolution and bitrate at a lower level which may decrease bandwidth consumption overall.

Streaming Dashboard

πŸ‘

Getting Started

If you haven't already, begin by following the Getting Started tutorial to create a Dolby.io application and start your first broadcast.

How-to Enable Simulcast

To activate this feature for a stream, create a new publish token and visit the Broadcaster, then open the Media Settings by clicking on the gear icon. Toggle on the Simulcast option. To broadcast, you will be sending a stream with different quality "levels", and hence, you will want to ensure you have adequate bandwidth to support these various bitrates. The SFU will then determine the correct "level" or bitrate and resolution based on the device or available bandwidth. It is important for the proper bandwidth to be provided as it can impact the stream quality.

Therefore, set the Bandwidth as Custom > 6000, which will provide sufficient Kbps for a high-quality simulcast stream. Similarly, the Width, Height, and FPS should be adjusted to match your desired output.

You are now ready to send your live stream and can select the start button on the broadcaster.

Viewing

Once the live stream has begun, viewers will be served a stream with a quality appropriate to their device and bandwidth. Stream quality is determined by these factors:

  • The stream quality is sent by the sender
  • The stream quality is requested by the receiver
  • The stream quality is estimated based on the receiver's available bandwidth

Although viewers will be automatically served a quality appropriate for them, they can also adjust the level manually. This can be done within the viewer by clicking the gear icon in the bottom right and selecting video quality, as shown below.

On the Broadcaster viewer, you can also see each bitrate throughput by selecting a quality level and then selecting media stats within the gear icon.

720p resolution with a video bitrate of 2.56 Mbps

720p resolution with a video bitrate of 2.56 Mbps

360p resolution with a video bitrate of 0.02 Mbps

360p resolution with a video bitrate of 0.02 Mbps

180p resolution with a video bitrate of 0.02 Mbps

180p resolution with a video bitrate of 0.02 Mbps

OBS

πŸ‘

Getting Started on OBS-WebRTC

If you haven't already, begin by following the Getting Started for OBS tutorial to create a stream and view through Dolby.io. You'll need your publish token and stream name for the steps described below.

Simulcast WebRTC on OBS-WebRTC

After installing Dolby.io's WebRTC version of OBS, add your stream name and token from your Dolby.io Real-time Streaming token into OBS's settings. Select either h.264 or VP8 for the codec as Simulcast only works for those two codecs. Click on the Advanced Settings button and check the Simulcast box to enable the feature inside OBS. Finally, apply the changes.

Next, we are going to set the output settings in OBS to see the different video qualities. Under Stream, click on Output and set the Output Mode to Advanced. Set the Encoder to be NVIDIA NVENC H.264 (if available). Next, the Rate Control needs to be changed to CBR (Constant Bitrate), and the Bitrate needs to be modified to 6000 Kbps.

Next, set the Base Resolution and your Output Resolution to be matching. Apply all changes, and you are now ready to start your stream.

Simulcast WebRTC and RTMP on OBS-WebRTC

You can share your real-time stream using OBS-WebRTC while streaming to multiple destinations with RTMP and Restream.io.

To begin, install the obs-multi-rtmp plugin. This is a plugin for streaming to multiple RTMP servers concurrently, enabling the sharing of encoders with the main output of OBS. The plugin can also use standalone encoders with basic configuration (bitrate).

Install the Plugin on Windows

  1. Download the latest release from OBS-Multi-RTMP.
  2. Unzip the zip file and extract it into the OBS folder.
    OBS Studio C:\\Program Files\\obs studio
    OBS WebRTC default location. C:\\Program Files\\OBS WebRTC (64bit)\\obs-plugins

You should see the following obs-multi-rtmp.dll in your plugins folder.

Once you have the obs-multi-rtmp.dll in your C:\\Program Files\\OBS WebRTC (64bit)\\obs-plugins folder, you can start OBS.

When you open OBS-WebRTC now, you will see the ability to add multiple RTMP targets.

Install the Plugin on MacOS

🚧

Matching Versions

For the MacOs version, the plugin can be found in here. It is important for the plugin's version matches the OBS-WebRTC's version.

  1. For this setup, download the ZIP file and unpack it. Copy the obs-multi-rtmp.plugin.
  2. Next, go to Applications and right-click on OBS-WebRTC and select show package content.
  3. Inside go to Contents > PlugIns and paste within the folder's content.
  4. Open OBS-WebRTC, and on the top menu bar, under Docks, Multiple output will be checked off.

Adding Stream Targets

Building off from simulcasting WebRTC on OBS-WebRTC, connect OBS-WebRTC to Dolby.io Real-Time Streaming via Settings and set up a WebRTC output.

Next, go to the Multiple output dock. If it is not showing up on your OBS, visit the Dock menu at the top and reset it. Enable the Multiple output option. Click on Add new target to create an RTMP destination.

When it comes to Simulcast, you will need adequate bandwidth to stream to multiple destinations. To save bandwidth, we are only going to send one additional stream to Restream.io. Restream is a live-streaming solution that allows for the distribution of content across multiple channels. This will allow us to send your stream to multiple RTMP destinations.

Therefore, create a Restream.io account and copy the RTMP URL as well as the Stream key from your account.

Then go back into OBS-WebRTC and fill out the Streaming Settings for the new stream target. Paste the RTMP server and key from Restream.io. To have Simulcast work, we need a high enough bitrate which other versions can branch off from. Under Video Settings, enable the encoder most compatible with your development environment, e.g. Windows - NVIDIA NVENC H.264, MacOS - x264. Change the bitrate to 6000 kbps and the Keyframe Interval to 2 seconds.

This will be sending a 1080p stream at 6000kbps to Restream.io and a 3500kbps to Dolby.io's viewer.

In order to send the RTMP stream, we will need to use the Audio settings option to encode the OPUS audio to AAC, meaning that the Encoder needs to be changed to FFmpeg Default AAC Encoder. To have the stream be synced when OBS starts streaming, check the box for Sync start with OBS at the bottom.

Start Publishing

Now, start streaming inside OBS-WebRTC, and you will see both Restream.io (RTMP) and Dolby.io (WebRTC) streams up and running. The image shows OBS-WebRTC with the Dolby.io viewer stream in sync. The Restream.io stream will have added latency depending on the services selected.

Simulcast RTMP MBR on OBS-WebRTC

On this last walkthrough, we are continuing with the knowledge from the previous two steps: simulcast in WebRTC only and simulcast in two different destinations.

Dolby.io Real-time Streaming enables users to stream RTMP MBR (Multi-Bitrate) for delivery via WebRTC Simulcast. This gives the streamer the ability to use their RTMP encoder to control their RTMP multi-bitrate renditions and provide adaptive bitrate delivery in the web player using WebRTC Simulcast.

πŸ‘

Getting Started

Here OBS-WebRTC and the obs-multi-rtmp plugin will be needed. Follow the instructions depending on your development environment: Windows or MacOS.

Adding Stream Targets

πŸ“˜

Enable multisource on your publish token

Make sure you have enabled multisource on your publish token. For more information explore the Multisource guide.

Open up a new stream target on Multiple output panel and input the RTMP details from Dolby.io, including the RTMP Key following this format:

{StreamName}?token={Token}&sourceId={number of source}&simulcastId

Example: livename?token=UIGfw2aMkC6AVssda2dacSzMkxGFtLOk&sourceId=1&simulcastId

The information for this will be found under the Publishing tab on the publish token's Management page. The sourceId must be numbered 1-3 with simulcastId enabled. For more information on how RTMP works, ahead over to its guide.

Here is example using 3 bitrates (1080p, 720p, 360p) as inputs using the obs-multi-rtmp plugin:

RTMP 1
Name1080p
RTMP Serverrtmp://live-rtmp-pub.millicast.com:1935/v2/pub/
RTMP Key{StreamName}?token={Token}&sourceId=1&simulcastId
Encoderx264 or nvenc
Resolution1920x1080
Bitrate6000kbps
Keyframe2
BFrames0
RTMP 2
Name720p
RTMP Serverrtmp://live-rtmp-pub.millicast.com:1935/v2/pub/
RTMP Key{StreamName}?token={Token}&sourceId=2&simulcastId&videoOnly
Encoderx264 or nvenc
Resolution1280x720
Bitrate2000kbps
Keyframe2
BFrames0
RTMP 2
Name360p
RTMP Serverrtmp://live-rtmp-pub.millicast.com:1935/v2/pub/
RTMP Key{StreamName}?token={Token}&sourceId=3&simulcastId&videoOnly
Encoderx264 or nvenc
Resolution640x360
Bitrate500kbps
Keyframe2
BFrames0

Start Publishing

Click the "Start" button for each target.

Please note that you may need to click Start Streaming in OBS to update the current configuration, then click Stop Streaming and return to the Multiple output panel. When you click Start Streaming again, the config will be updated, and the RTMP MBR renditions will stream to Dolby.io Real-time Streaming CDN.

The Millicast player will support the RTMP MBR sources using WebRTC Simulcast in the web browser:

Video

Here is a video showing the simulcast playback using the Hosted viewer that is built on the Javascript SDK:

Learn More

Learn more by exploring the developer blog and code samples.