In a video call or interactive video streaming scenario, if multiple users publish video streams at the same time, user experience can be affected by limited device performance and excessive bandwidth consumption.
Use this page as a as a guide to best practices when implementing a video scenario that enables multiple users to publish video streams simultaneously.
To minimize bandwidth consumption and ensure smooth communication in a video scenario with multiple users, Agora recommends the following:
Before proceeding, ensure that you have already implemented basic real-time audio and video functions in your project.
Before or after joining a channel, call enableDualStreamMode
to enable dual-stream mode on the publishers' clients. In dual-stream mode, the SDK transmits a high-quality video stream and a low-quality video stream from the publisher. The high-quality video stream has a higher resolution and bitrate than the low-quality video stream.
Call setRemoteVideoStreamType
on each subscriber's client to subscribe to the high-quality stream from only one publisher and the low-quality stream of all other publishers.
uid
of the screen sharing stream is not used as the subscriber's client to subscribe to the low-quality stream.To reduce bandwidth consumption, Agora recommends contacting technical support to customize the video profile of the low-quality stream.
setupRemoteVideo
, and set the view as null to release all memory resources of the view used by the publisher.If you do not customize the video profile of the low-quality stream, the SDK automatically sets the video profile of the low-quality video stream based on that of the high-quality video stream. You can refer to this section for the default relationship between the video profiles of the high-quality and low-quality video streams.
The default video profile of the low-quality video stream in the Communication profile conforms to the following rules:
The following table shows the default resolution, frame rate, and bitrate of low-quality streams for different aspect ratios of high-quality streams in the Live-broadcast profile:
Aspect ratio of the high-quality stream | Resolution (width × height) | Frame rate | Bitrate |
---|---|---|---|
1:1 | 160 × 160 | 5 | 68 |
3:4 | 120 × 160 | 5 | 45 |
4:3 | 160 × 120 | 5 | 45 |
9:16 | 108 × 192 | 5 | 50 |
16:9 | 192 × 108 | 5 | 50 |
Others | The larger of either width or height takes 160 as the value. Calculate the lower value according to the aspect ratio. | 5 | 68 |
You can also refer to the following tables to learn the default resolution, frame rate, and bitrate of the low-quality video stream for different mainstream video profiles of the high-quality video stream.
High-quality stream video profile: Communication | Default low-quality stream video profile: Communication |
---|---|
320 × 240, 15, 200 | 144 × 108, 5, 20 |
640 × 360, 15, 400 | 288 × 162, 5, 40 |
640 × 480, 15, 500 | 288 × 216, 5, 50 |
1280 × 720, 15, 1130 | 288 × 162, 5, 113 |
240 × 320, 15, 200 | 108 × 144, 5, 20 |
240 × 320, 15, 200 | 108 × 144, 5, 20 |
360 × 640, 15, 400 | 164 × 288, 5, 40 |
480 × 640, 15, 500 | 216 × 288, 5, 50 |
720 × 1280, 15, 1130 | 164 × 288, 5, 113 |
High-quality stream video profile: Live-broadcast | Default low-quality stream video profile: Live-broadcast |
---|---|
320 × 240, 15, 350 | 160 × 120, 5, 45 |
640 × 360, 15, 650 | 192 × 108, 5, 50 |
640 × 480, 15, 800 | 160 × 120, 5, 45 |
1280 × 720, 15, 1600 | 192 × 108, 5, 50 |
240 × 320, 15, 350 | 120 × 160, 5, 45 |
360 × 640, 15, 650 | 108 × 192, 5, 50 |
480 × 640, 15, 800 | 120 × 160, 5, 45 |
720 × 1280, 15, 1600 | 108 × 192, 5, 50 |
This section provides the recommended video resolution, frame rate, and bitrate for high-quality and low-quality streams.
Channel profile | Video stream type | Device system | Recommended video profile |
---|---|---|---|
Communication | high-quality stream | macOS, Windows | 640 × 480, 15, 500 |
Android, iOS | 640 × 360, 15, 400 | ||
low-quality stream | macOS, Windows | 320 × 180, 7, 75 | |
Android, iOS | 160 × 90, 7, 45 | ||
Live-broadcast | high-quality stream | macOS, Windows | 640 × 480, 15, 800 |
Android, iOS | 640 × 360, 15, 650 | ||
low-quality stream | macOS, Windows | 320 × 180, 7, 126 | |
Android, iOS | 160 × 90, 7, 64 |
In practice, different user devices, user network conditions, application service locations, and user requirements affect which kinds of video profiles you use. Therefore, if the recommended video profiles are not suitable for you, contact technical support for assistance.