Regarding frequently asked questions among developers, Tencent Cloud offers an easy-to-understand API example project, which you can use to quickly learn how to use different APIs.
LiveAVSDK uses the
setVideoQuality API provided by
V2TXLivePusher to set video quality.
You can use
setVideoQuality to set the resolution and resolution mode (landscape/portrait) of published video.
int setVideoQuality(V2TXLiveVideoResolution resolution, V2TXLiveVideoResolutionMode resolutionMode);
|resolutionMode||V2TXLiveVideoResolutionMode||Resolution mode (landscape/portrait)|
|V2TXLiveVideoResolution160x160||Resolution: 160 × 160; bitrate: 100-150 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolution270x270||Resolution: 270 × 270; bitrate: 200-300 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolution480x480||Resolution: 480 × 480; bitrate: 350-525 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolution320x240||Resolution: 320 × 240; bitrate: 250-375 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolution480x360||Resolution: 480 × 360; bitrate: 400-600 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolution640x480||Resolution: 640 × 480; bitrate: 600-900 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolution320x180||Resolution: 320 × 180; bitrate: 250-400 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolution480x270||Resolution: 480 × 270; bitrate: 350-550 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolution640x360||Resolution: 640 × 360; bitrate: 500-900 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolution960x540||Resolution: 960 × 540; bitrate: 800-1500 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolution1280x720||Resolution: 1280 × 720; bitrate: 1000-1800 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolution1920x1080||Resolution: 1920 × 1080; bitrate: 2500-3000 Kbps; frame rate: 15 fps|
|V2TXLiveVideoResolutionModeLandscape||Resolution in landscape mode: V2TXLiveVideoResolution640_360 + V2TXLiveVideoResolutionModeLandscape = 640 × 360|
|V2TXLiveVideoResolutionModePortrait||Resolution in portrait mode: V2TXLiveVideoResolution640_360 + V2TXLiveVideoResolutionModePortrait = 360 x 640|
|Live showroom||Landscape or portrait|
|Live game streaming||V2TXLiveVideoResolution1280x720||Landscape or portrait|
|Mic connect (primary-stream image)||V2TXLiveVideoResolution640x360||Landscape or portrait|
|Mic connect (small image)||V2TXLiveVideoResolution480x360||Landscape or portrait|
|Blu-ray streaming||V2TXLiveVideoResolution1920x1080||Landscape or portrait|
For smoother mic connect experience, after mic connect starts, please call
setVideoQuality() to set the host’s resolution to
V2TXLiveVideoResolution640x360 and the mic-connecting audience’s resolution to
V2TXLiveVideoResolution480x360. After mic connect ends, you can call
setVideoQuality() again to set the resolutions to previous values.
The video watched by the host is the raw data captured by the camera after pre-processing (beauty filter application, mirroring, clipping, etc.) and therefore is of high quality. However, the video watched by audience has been compressed and then decoded by the codec. Encoding compromises video quality (the lower the target resolution, the more the video is compressed), which is why the video delivered to audience is not as clear as that watched by the host.
V2TXLivePushersometimes publish video at a resolution of 368 × 640 or 544 × 960?
If you enable hardware acceleration, the video published may have atypical resolutions such as 368 × 640 or 544 × 960. This is because some hardware encoders do not allow resolutions that aren’t a multiple of 16. You can change the fill mode of the player to get rid of black bars.