logo
Video Call
Other Features
On this page

Set Video Attributes

2024-02-29

Feature Overview

During video calls or live streaming, developers can set video attributes as needed to adjust the clarity, smoothness, and mirroring of the video to achieve a better user experience.

Usage Steps

Set Video Attributes

Before publishing stream, call the setVideoConfig interface to set video resolution, frame rate, and bitrate. You can use the preset combination values provided by ZEGO Express SDK, or set the corresponding fields of ZegoVideoConfig yourself.

The preset combination values for ZegoVideoConfigPreset are as follows:

ZegoVideoConfigPresetCapture Resolution
(Width × Height)
Encode Resolution
(Width × Height)
Frame Rate(fps)Bitrate(kbps)
PRESET_180P320 × 180320 × 18015300
PRESET_270P480 × 270480 × 27015400
PRESET_360P640 × 360640 × 36015600
PRESET_540P960 × 540960 × 540151200
PRESET_720P1280 × 7201280 × 720151500
PRESET_1080P1920 × 10801920 × 1080153000

Example code when using preset values:

ZegoExpressSDK::getEngine()->setVideoConfig(ZegoVideoConfig(ZEGO_VIDEO_CONFIG_PRESET_1080P));

Example code when setting manually:

ZegoVideoConfig videoConfig;
videoConfig.captureHeight = 360;
videoConfig.captureWidth = 640;
videoConfig.encodeHeight = 360;
videoConfig.encodeWidth = 640;
videoConfig.fps = 15;
videoConfig.bitrate = 600;
ZegoExpressSDK::getEngine()->setVideoConfig(videoConfig);
Warning

To avoid cropping or stretching of the rendered image, it is recommended to keep the aspect ratio of the capture resolution and encode resolution consistent.

Set Video Mirror Mode

Before publishing stream, call the setVideoMirrorMode interface to set whether to enable mirror mode for local preview video and published video. If enabled, the direction of object movement in the rendered image will be consistent with looking in a mirror; if disabled, it will be the opposite.

The preset combination values for ZegoVideoMirrorMode are as follows:

ZegoVideoMirrorModePreview ScreenPublished Screen(Remote Playing Screen)
ONLY_PREVIEW_MIRRORMirrorNo Mirror
BOTH_MIRRORMirrorMirror
NO_MIRRORNo MirrorNo Mirror
ONLY_PUBLISH_MIRRORNo MirrorMirror

Example code when using preset values:

ZegoExpressSDK::getEngine()->setVideoMirrorMode(ZEGO_VIDEO_MIRROR_MODE_BOTH_MIRROR);

Previous

Common Video Configuration

Next

Screen Sharing

On this page

Back to top