Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal
Developer Documentation is moving soon to a new location → https://developer.vonage.com Content will remain unchanged.

Publisher Max Bitrate

You can dynamically control the maximum bitrate that a publisher can use for camera video streams.

This guide shows how to configure video bitrate settings, how to interact with different presets, how to set raw bitrates, and best practices for using the API effectively.

This topic includes the following sections:

Overview

You can dynamically set the maximum bitrate a publisher can use when encoding media. The video encoder then adjusts the bitrate dynamically, using a value within the allowed range, from a minimum threshold to the maximum bitrate set, based on network conditions and other constraints.

Setting the maximum bitrate can help to reduce bandwidth consumption when a user is connecting from a metered connection. Be sure to read the Limitations below.

Limitations

There are some important limitations to be aware of:

API usage

Video bitrate presets

The API offers video bitrate presets that simplify reducing video quality without needing to worry about codec and session settings. These presets are designed for common use cases like video conferencing and are tailored to 480p, 540p, 720p, and 1080p resolutions.

The available presets are:

Please note that the exact bitrate values used when dealing with presets is implementation-specific, and depends on the negotiated codec and the media mode (relayed or routed). The Video API client SDKs include methods to set and get the bitrate preset.

Setting raw bitrate values

If the predefined bitrate presets do not meet your needs, you can set a custom raw bitrate value. This allows you to define specific bitrate limits within a range, from 5,000 bps to 10,000,000 bps. Please note that the value only applies to the encoder bitrate, so network overhead still applies on top of the chosen value.

The Vonage Video API client SDKs include methods to set the raw bitrate value and to retrieve it. Until a raw bitrate is set, or until only presets are set, the getter returns 0 (except for the JS SDK, in which the returned value is undefined). Once a raw bitrate is set, the bitrate preset getter returns 'custom', indicating that a custom value has been applied. However, do not use the preset 'custom' in the setter -- just set the specific bitrate number to use as a maximum value.

Bitrate and encoding layer interaction with VP8 and scalability enabled

Changing the maximum bitrate when scalable VP8 is used, triggers additional efficiency -- the client SDK dynamically activates or deactivates the encoding layers based on the available bitrate to ensure the video stream is as efficient as possible. This process adapts the resolution at which the publisher is publishing.

The following notes apply to the preset when using VP8:

When you set a raw bitrate value, if the provided bitrate is insufficient to maintain certain encoding layers, the SDK automatically turns off the higher layers. For example, if the bitrate is too low for the medium or high-quality layers, those layers are discarded, and only the base layer is transmitted.

If a new provided bitrate is high enough to maintain more encoding layers, the SDK reactivates the higher encoding layers, progressively restoring the video quality by adding back the medium and high layers.

This mechanism ensures that the video stream remains as efficient as possible, maximizing the use of the available bandwidth without compromising the user experience.

Examples

At the start of a session, a publisher uses the DEFAULT preset, which provides full video quality. At this particular stage of the session, let's assume it negotiated the VP8 non-scalable codec. However, after a network change to a metered connection (for example, cellular), you may lower the publishing bandwidth using the BW_SAVER preset. When using a preset for the publisher's maximum bitrate, the client SDK makes sure that the quality level stays the same regardless of any event. When the network switches back to an unlimited connection, you can restore the default by setting the DEFAULT preset.

You can also set the raw bitrate value to set a bandwidth upper threshold.

For details for each client SDK, see the following:

Best practices

To ensure the best performance and optimal bandwidth usage, follow these best practices: