You can set the video profile according to your users’ devices, browsers, network conditions, and scenarios to improve user experience.
Before proceeding, ensure that you have read the quickstart guides and implemented basic real-time audio and video functions in your project.
For the Agora Web SDK, you can set the video profile in either of the following ways:
encoderConfig
parameter when calling the following methods to create video tracks:AgoraRTC.createCameraVideoTrack
to create a video track from the video captured by a camera.AgoraRTC.createScreenVideoTrack
to create a video track for screen sharing.If you call
AgoraRTC.createCustomVideoTrack
to create a custom video track, you can only set the sending bitrate.
CameraVideoTrack.setEncoderConfiguration
to set the video encoder configurations dynamically. You can call this method before or after publishing the video track.You can set encoderConfig
in either of the following ways:
Use the preset video profile when creating the track
AgoraRTC.createCameraVideoTrack({
encoderConfig: "720p_1",
}).then(localVideoTrack => { /** ... **/ });
Customize the video encoder configurations when creating the track
AgoraRTC.createCameraVideoTrack({
encoderConfig: {
width: 640,
// Specify a value range and an ideal value
height: { ideal: 480, min: 400, max: 500 },
frameRate: 15,
bitrateMin: 600, bitrateMax: 1000,
},
}).then(localVideoTrack => {/** ... **/ });
Dynamically change the preset video profile
CameraVideoTrack.setEncoderConfiguration("480p_1").then(() => { /** ... **/ })
Dynamically change the customized video encoder configurations
CameraVideoTrack.setEncoderConfiguration({ width: 1280, height: 720 }).then(() => { /** ... **/ })
AgoraRTC.createCameraVideoTrack
AgoraRTC.createScreenVideoTrack
AgoraRTC.createCustomVideoTrack
CameraVideoTrack.setEncoderConfiguration
Video profiles vary from case to case. For example, in a one-to-one online class scenario, the windows of the teacher and the student are larger, requiring a higher resolution, frame rate, and bitrate; in a one-to-four online class scenario, the windows of the teacher and the students are smaller, requiring a lower resolution, frame rate, and bitrate.
Agora recommends the following profiles for different scenarios:
The following table lists all the preset video profiles. You can refer to it when customizing your encoder configurations.
Video Profile | Resolution (Width×Height) | Frame rate (fps) | Bitrate(Kbps) |
---|---|---|---|
120p | 160 × 120 | 15 | 65 |
120p_1 | 160 × 120 | 15 | 65 |
120p_3 | 120 × 120 | 15 | 50 |
180p | 320 × 180 | 15 | 140 |
180p_1 | 320 × 180 | 15 | 140 |
180p_3 | 180 × 180 | 15 | 100 |
180p_4 | 240 × 180 | 15 | 120 |
240p | 320 × 240 | 15 | 200 |
240p_1 | 320 × 240 | 15 | 200 |
240p_3 | 240 × 240 | 15 | 140 |
240p_4 | 424 × 240 | 15 | 220 |
360p | 640 × 360 | 15 | 400 |
360p_1 | 640 × 360 | 15 | 400 |
360p_3 | 360 × 360 | 15 | 260 |
360p_4 | 640 × 360 | 30 | 600 |
360p_6 | 360 × 360 | 30 | 400 |
360p_7 | 480 × 360 | 15 | 320 |
360p_8 | 480 × 360 | 30 | 490 |
360p_9 | 640 × 360 | 15 | 800 |
360p_10 | 640 × 360 | 24 | 800 |
360p_11 | 640 × 360 | 24 | 1000 |
480p | 640 × 480 | 15 | 500 |
480p_1 | 640 × 480 | 15 | 500 |
480p_2 | 640 × 480 | 30 | 1000 |
480p_3 | 480 × 480 | 15 | 400 |
480p_4 | 640 × 480 | 30 | 750 |
480p_6 | 480 × 480 | 30 | 600 |
480p_8 | 848 × 480 | 15 | 610 |
480p_9 | 848 × 480 | 30 | 930 |
480p_10 | 640 × 480 | 10 | 400 |
720p | 1280 × 720 | 15 | 1130 |
720p_1 | 1280 × 720 | 15 | 1130 |
720p_2 | 1280 × 720 | 30 | 2000 |
720p_3 | 1280 × 720 | 30 | 1710 |
720p_5 | 960 × 720 | 15 | 910 |
720p_6 | 960 × 720 | 30 | 1380 |
1080p | 1920 × 1080 | 15 | 2080 |
1080p_1 | 1920 × 1080 | 15 | 2080 |
1080p_2 | 1920 × 1080 | 30 | 3000 |
1080p_3 | 1920 × 1080 | 30 | 3150 |
1080p_5 | 1920 × 1080 | 60 | 4780 |