このページは現在英語版のみで提供されており、日本語版も近日中に提供される予定です。ご利用いただきありがとうございます。

ビデオ品質の設定

Overview

In TRTCCloud, you can adjust the video quality in the following ways:
TRTCCloud.enterRoom TRTCAppScene parameter: For selecting your application scenario.
TRTCCloud.setVideoEncoderParam: For setting encoding parameters.
TRTCCloud.setNetworkQosParam: Used for setting up network regulation policies.
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:

Supported Platforms

iOS
Android
Mac OS
Windows
Web
Electron
Flutter
For detailed operations on how to set the screen quality on the Web, please refer to the Configuration Guide.

Room Scenario

Scenario Type
Scenario Introduction
TRTC_APP_SCENE_VIDEOCALL
Within the context of video calling, 720p and 1080p high-definition image quality is supported. A single room can accommodate up to 300 simultaneous online users, with a maximum of 50 users speaking at the same time.
TRTC_APP_SCENE_LIVE
In the context of interactive video broadcasting, the mic can be smoothly turned on/off without switching latency, with host latency as low as 300 milliseconds. Supports live streaming for hundreds of thousands of concurrent viewers, with playback delay reduced to 1000 milliseconds.
Note: In this scenario, you need to specify the current user's role using the 'role' field in TRTCParams.
TRTC_APP_SCENE_AUDIOCALL
In the audio call context, it supports 48 kHz duplex audio calls. A single room accommodates up to 300 concurrent online users, with a maximum of 50 people speaking at once.
TRTC_APP_SCENE_VOICE_CHATROOM
In the context of interactive audio live streaming, microphones can be switched on and off smoothly without delay. The host experiences a low latency of fewer than 300 milliseconds. It accommodates hundreds of thousands concurrent viewer users, with the broadcast delay reduced to 1000 milliseconds.
Note: In this scenario, you need to specify the current user's role using the 'role' field in TRTCParams.

TRTCVideoEncParam

Recommended configuration

Application Scenario
videoResolution
videoFps
videoBitrate
Video call (mobile)
640x360
15
550kbps
Video conferencing (primary image on macOS or Windows)
1280x720
15
1200kbps
Video conferencing (primary image on mobile device)
640x360
15
900kbps
Video conferencing (small image)
320x180
15
250kbps
Online education (teacher on macOS or Windows)
960x540
15
850kbps
Online education (teacher on iPad)
640x360
15
550kbps
Online education (student)
320x180
15
250kbps

Detailed description of fields

(int) videoResolution The encoding resolution (TRTCCloudDef.TRTC_VIDEO_RESOLUTION_ ), for instance, 640 x 360, indicates the width (in pixels) x height (in pixels) of the output image.We have only predefined horizontal (landscape) resolutions in the TRTCVideoResolution enumeration where the width >= height. If you want to use a vertical (portrait) resolution, you need to set resMode to Portrait.
Note:
Because many hardware codecs only support pixel widths that are divisible by 16, the actual resolution encoded by the SDK may not be exactly the same as configured by the parameter; instead, it will be automatically corrected based on a multiple of 16. For example, the resolution 640 x 360 may be adapted to 640 x 368 inside the SDK.
(int) videoResolutionMode This parameter designates the screen orientation resolution (TRTCCloudDef.TRTC_VIDEO_RESOLUTION_MODE_). Since TRTCVideoResolution only defines horizontal screen resolution, if you want to use vertical screen resolutions like 360 x 640, you'd need to set resMode as TRTCVideoResolutionModePortrait. Generally, PCs and Macs employ horizontal (Landscape) resolution, while smartphones use vertical (Portrait) resolution.
(int) videoFps The Frame Rate (FPS) refers to the number of frames to be encoded per second. A recommended setting is 15 FPS, which assures sufficient video fluidity without compromising clarity due to an excessive number of frames per second. If you require higher smoothness, settings of 20 FPS or 25 FPS can be used. However, resist settings above 25 FPS, since the conventional frame rate for movies is 24 FPS.
(int) videoBitrate Video Bitrate (Bitrate) refers to how much Kbit binary data the encoder outputs per second after encoding. If you set videoBitrate to 800kbps, the encoder will produce 800kbit video data per second. If stored into a file, the size of this file would amount to 800kbit, which is equivalent to 100KB, or 0.1MB.
A higher video bitrate is not always better; instead, it should be chosen appropriately based on the resolution as shown in the table below.

Resolution-bitrate reference table

Resolution Definition
Aspect Ratio
Recommended Bitrate(VideoCall)
Recommended Bitrate(LIVE)
TRTCVideoResolution_120_120
1:1
80kbps
120kbps
TRTCVideoResolution_160_160
1:1
100kbps
150kbps
TRTCVideoResolution_270_270
1:1
200kbps
300kbps
TRTCVideoResolution_480_480
1:1
350kbps
525kbps
TRTCVideoResolution_160_120
4:3
100kbps
150kbps
TRTCVideoResolution_240_180
4:3
150kbps
225kbps
TRTCVideoResolution_280_210
4:3
200kbps
300kbps
TRTCVideoResolution_320_240
4:3
250kbps
375kbps
TRTCVideoResolution_400_300
4:3
300kbps
450kbps
TRTCVideoResolution_480_360
4:3
400kbps
600kbps
TRTCVideoResolution_640_480
4:3
600kbps
900kbps
TRTCVideoResolution_960_720
4:3
1000kbps
1500kbps
TRTCVideoResolution_160_90
16:9
150kbps
250kbps
TRTCVideoResolution_256_144
16:9
200kbps
300kbps
TRTCVideoResolution_320_180
16:9
250kbps
400kbps
TRTCVideoResolution_480_270
16:9
350kbps
550kbps
TRTCVideoResolution_640_360
16:9
550kbps
900kbps
TRTCVideoResolution_960_540
16:9
850kbps
1300kbps
TRTCVideoResolution_1280_720
16:9
1200kbps
1800kbps
TRTCVideoResolution_1920_1080
16:9
2000kbps
3000kbps

TRTCNetworkQosParam

QosPreference

In an environment where network bandwidth is ample, clarity and fluidity can be balanced. However, when a user's network conditions are not optimal, the decision needs to be made whether to prioritize clarity or fluidity. This designation can be made through the preference parameter within TRTCNetworkQosParam.
Smoothness preferred (TRTCVideoQosPreferenceSmooth) When users experience a weak network, the display could turn blurry and may contain many mosaics, but smoothness can be maintained with minimal or no stutter.
Quality preferred (TRTCVideoQosPreferenceClear) When users are constrained by a weak network, the image will strive to remain as clear as possible, but stuttering might be a frequent occurrence.

ControlMode

Select the TRTCQosControlModeServer for the controlMode parameter. The TRTCQosControlModeClient is used by the Tencent Cloud Research and Development team for internal debugging purposes, please do not focus on it.

Common Misconceptions

1. Is a higher resolution better? A higher resolution necessitates a higher bit rate for support. If a resolution of 1280 x 720 is chosen, but the bit rate is specified as 200kbps, the picture will contain a substantial blur. It is recommended to refer to the Resolution-bitrate reference table while making adjustments.