Simulcast
Overview
Simulcast is short for "simultaneous broadcast." It's used in WebRTC to improve the overall quality of a group conference.
Instead of sending just one video stream from the source to the server and then to each participant, the server also creates copies ("encodings") of the same video but encoded to different quality targets. Typically, a high-quality (full bitrate), medium-quality and low-quality (reduced bitrate) streams are encoded.
Consider a group call with Alice, Bob, Carol, and Dan:
- Alice is sending a video using a bitrate of 2 Mbps.
- Bob and Dan have reliable internet connections and can receive Alice's video at 2 Mbps.
- Carol, however, has a limited internet connection and can only sustain inbound video at 1 Mbps.
In this scenario, to keep Carol from dropping the call, you must coordinate with Alice to reduce her outbound bitrate to 1 Mbps. Unfortunately for Bob and Dan, they must also see Alice at the reduced bitrate. This negative side effect is amplified and becomes more and more noticeable as you add more participants. With simulcast, you can send Carol a low-quality encoding while allowing Bob and Dan to continue receiving the high-quality encoding.
Simulcast is not supported on P2P connections. In a two-way call, the bitrate simply adapts to each receiver. There are no side effects because there are no other receivers to impact. Only SFU connections can take advantage of simulcast.
How does Simulcast Improve Stream Quality?
Simulcast is a powerful tool for providing optimal video stream quality. It works by simultaneously sending multiple feeds of different quality from server to the receiving clients, dynamically enabling and disabling them depending to the network conditions experienced by the individual receivers.
Simulcast, by itself, can't resolve all quality issues for all network conditions. However, you can use it to fix most of the quality issues you encounter. There are other mechanisms that also affect overall stream quality. An alternative to simulcast that improves overall stream quality is Adaptive Video Resolution, where you adjust the video stream's resolution, constraining it to the actual solution of the receivers' view. For example, if you send HD video at a resolution of 1280 x 720, but all the receivers display the downstream in a smaller view because the app layout dictates demoting participant views during a screen share, you can adjust the sender's resolution to not waste bandwidth.
LiveSwitch continually improves bandwidth management and adaptation policies and capabilities. Contact Support if you have a use case that you want to improve.
Configure Simulcast
To enable simulcast in the server, you have three options: through the server console, using the REST API, or by setting environment variables.
Simulcast can be enabled at the Deployment, Application, or Channel level. Lower-level configurations override higher-level ones. For example, if simulcast is disabled for a deployment, it can still be enabled for a specific channel or channel pattern.
You can configure the following values:
- "Enabled": Indicates whether simulcast is enabled. Use the enabledV2 variable for the REST API.
- "Video Encoding Count": Indicates the number of video encodings enabled for simulcast. This includes the primary encoding. A value of 0 disables simulcast, while 3 is recommended.
- "Degradation Preference": Determines how quality is degraded for simulcast substreams. Options include "Automatic" (recommended), "Balanced", "Frame Rate", and "Resolution".
- "Max Simulcast Upstreams Per Channel": Sets the maximum number of publishers allowed on a channel when simulcast is enabled. The recommended value is 3.
- "Allowed": Indicates whether simulcast is allowed on a channel, deployment, or application. This controls whether simulcast can be enabled at a particular level.
- "Manual Simulcast Encodings": By default, the server determines simulcast encodings based on degradation preference and encoding count. However, you can specify encodings as fractions of resolution and frame rate relative to the primary encoding. These settings override degradation preferences and encoding count.
- Example: If the primary encoding is 1080p at 30 fps, specifying {(FrameRateScale = 0.5, ResolutionScale = 0.5), (FrameRateScale = 0.25, ResolutionScale = 0.5)} will result in three encodings: the original/primary encoding, a simulcast substream at 960px540p and 15 fps, and another simulcast substream at 960px540p and 8 fps.