Introduction
In TRTCCloud, you can adjust the video quality in the following ways:
This document describes how to configure these parameters to make the video quality of the TRTC SDK meet your project-specific needs.
You can also see the following demos:
For detailed directions on how to set video quality for the Web, please see Configuration Guide. TRTCAppScene
VideoCall
This corresponds to the scenario where most of the time there are two or more people on video calls, and the optimization for internal encoders and network protocols focuses on smoothness to reduce call latency and lagging.
LIVE
This corresponds to the scenario where most of the time there is only one person speaking or performing and occasionally multiple people interact with one another through video, and the optimization for internal encoders and network protocols focuses on performance and compatibility to deliver better performance and definition.
TRTCVideoEncParam
Recommended configuration
|
| | | |
Video conferencing (primary image on macOS or Windows) | | | |
Video conferencing (primary image on mobile device) | | | |
Video conferencing (small image) | | | |
Online education (teacher on macOS or Windows) | | | |
Online education (teacher on iPad) | | | |
Online education (student) | | | |
Detailed description of fields
(TRTCVideoResolution) videoResolution
Encoded resolution; for example, 640x360 refers to the width (pixels) x height (pixels) of the encoded video image. In the TRTCVideoResolution
enum definition, only landscape resolution (i.e., width >= height) is defined. If you want to use portrait resolution, you need to set resMode
to Portrait
.
notice
As many hardware codecs only support pixel widths that are divisible by 16, the actual resolution encoded by the SDK is not necessarily exactly the same as configured by the parameter; instead, it will be automatically corrected based on the divisor of 16; for example, the resolution 640x360 may be adapted to 640x368 inside the SDK.
(TRTCVideoResolutionMode) resMode
This determines the landscape or portrait resolution. Because only landscape resolution is defined in TRTCVideoResolution
, if you want to use portrait resolution such as 360x640, you need to specify resMode
as TRTCVideoResolutionModePortrait
. Generally, landscape resolution is used on PCs and Macs, while portrait resolution is used on mobile devices.
(int) videoFps
Frame rate (FPS), which indicates how many frames are encoded per second. The recommended value is 15 FPS, which can ensure that the video image is smooth enough without reducing the video definition due to too many frames per second.
If you have high requirements for smoothness, you can set the frame rate to 20 or 25 FPS. However, please do not set a value above 25 FPS, because the normal frame rate of movies is only 24 FPS.
(int) videoBitrate
Video bitrate, which indicates how many Kbits of encoded binary data is output by the encoder per second. If you set videoBitrate
to 800 Kbps, the encoder will generate 800 Kbits of video data per second. If such data is stored as a file, the file size will be 800 Kbits, which is 100 KB or 0.1 MB.
A higher video bitrate is not always better; instead, it must have a proper mapping relationship with resolution as shown in the table below.
Resolution-bitrate reference table
|
TRTCVideoResolution_120_120 | | | |
TRTCVideoResolution_160_160 | | | |
TRTCVideoResolution_270_270 | | | |
TRTCVideoResolution_480_480 | | | |
TRTCVideoResolution_160_120 | | | |
TRTCVideoResolution_240_180 | | | |
TRTCVideoResolution_280_210 | | | |
TRTCVideoResolution_320_240 | | | |
TRTCVideoResolution_400_300 | | | |
TRTCVideoResolution_480_360 | | | |
TRTCVideoResolution_640_480 | | | |
TRTCVideoResolution_960_720 | | | |
TRTCVideoResolution_160_90 | | | |
TRTCVideoResolution_256_144 | | | |
TRTCVideoResolution_320_180 | | | |
TRTCVideoResolution_480_270 | | | |
TRTCVideoResolution_640_360 | | | |
TRTCVideoResolution_960_540 | | | |
TRTCVideoResolution_1280_720 | | | |
TRTCVideoResolution_1920_1080 | | | |
TRTCNetworkQosParam
QosPreference
If the network bandwidth is sufficient, both high definition and smoothness can be ensured; however, if the user's network connection is not ideal, should priority be given to definition or smoothness? You can make a choice by specifying the preference
parameter in TRTCNetworkQosParam
.
Smoothness preferred (TRTCVideoQosPreferenceSmooth)
Smoothness is ensured on a weak network, while the video image will have a lot of blurs but can be smooth with no or slight lagging.
Definition preferred (TRTCVideoQosPreferenceClear)
Definition is ensured on a weak network, i.e., the image will be as clear as possible but tend to lag.
ControlMode
For the controlMode
parameter, select TRTCQosControlModeServer. TRTCQosControlModeClient
is used for internal debugging by the Tencent Cloud R&D team and should be ignored.
Common Misunderstandings
1. The higher the resolution, the better?
Higher resolutions require higher bitrates for support. If the resolution is 1280x720, but the bitrate is specified as 200 Kbps, the video image will have a lot of blurs. We recommend that you set it as described in the Resolution-bitrate reference table. 2. The higher the frame rate, the better?
Because the image captured by the camera is a complete mapping to all real objects in the exposure phase, it is not that the higher the frame rate, the smoother the video, which is different from the concept of FPS in games. On the contrary, if the frame rate is too high, the quality of each video frame will be lowered, and the exposure time of the camera will be reduced, worsening the image effect.
3. The higher the bitrate, the better?
4. Higher bitrates also require higher resolutions for a match. For a resolution of 320x240, a 1,000 Kbps bitrate would be wasteful. We recommend that you set it as described in the Resolution-bitrate reference table. 5. High resolution and bitrate can be set when connected to a Wi-Fi network?
It is not that the Wi-Fi network speed is constant. If the device is far from the wireless router or the router channel is occupied, the Wi-Fi network may not be as fast as 4G.
In response to this issue, the TRTC SDK provides a speed test feature, which can perform speed test to determine the network quality based on the score before a video call is established.
Was this page helpful?