logo
Video Call
On this page

Publish Stream Video Enhancement

2025-01-20

Feature Overview

ZEGO Express SDK provides multiple video preprocessing enhancement capabilities. Developers can adjust the image effects at the publishing end according to business needs.

FeatureFeature DescriptionFeature AdvantagesEffect Display
Basic Beauty EffectsAccording to user and business needs, adjust the degree of whitening, smoothing, sharpening and rosiness, easily achieve basic beauty effects, present good skin condition to users, and create unique and natural beauty effects.Cover high-frequency beauty capabilities.
Low Light EnhancementWhen ambient light is relatively dark and the brightness of the image captured by the camera does not meet business needs such as seeing faces clearly or performing face recognition, enhance the image brightness.
  • Lightweight, covers all device models.
  • Supports auto mode, intelligently enables or disables algorithms based on image lighting conditions.
  • Supports traditional algorithms and AI-level algorithms, intelligently selects algorithm types based on device performance.
Video Noise ReductionPoor camera capture effects, low ambient light brightness, etc., may cause obvious noise in the image. The video noise reduction feature can reduce image noise.
  • Determines whether to enable based on image noise conditions, avoiding unnecessary image damage.
  • Adjustable noise reduction intensity.
Color EnhancementDue to camera characteristics, captured video may have insufficient saturation. Using color enhancement feature, while protecting skin tone, enhance undersaturated colors to make image colors more realistic and more in line with human visual perception.
  • Protect skin tone, avoid enhancing human skin tone.
  • Protect lip color, making lip color more natural when using beauty effects and wearing makeup.

Prerequisites

Before using the publish stream video enhancement feature, please ensure:

Usage Steps

Initialization and Login to Room

For the specific process of initialization and logging in to Room, please refer to "Create Engine" and "Login to Room" in the "Implementing Video Call" document.

Set Publish Stream Video Enhancement Effects

Please choose the corresponding feature to configure according to your needs.

Note

This feature is the basic beauty feature of ZEGO Express SDK built-in ZEGO Effects SDK, only including four beauty effects: whitening, rosiness, smoothing, and sharpening. If you need to use more advanced beauty features, please refer to Using Real-Time Video and AI Beauty Effects Together.

Initialize Basic Beauty Environment

If you need to use the basic beauty feature, you must call the startEffectsEnv interface to initialize the beauty environment before startPreview starts preview and startPublishingStream publishes stream.

// Create beauty environment
ZegoExpressEngine.getEngine().startEffectsEnv();

After initializing the beauty environment, the SDK will use a fixed video frame data type for transmission. If you need to use video custom preprocessing when using the basic beauty feature, you can only configure the corresponding video frame data type:

Android platform: Only supports Texture 2D type data, that is, the bufferType of ZegoCustomVideoCaptureConfig is set to "GL_TEXTURE_2D".

Enable/Disable Basic Beauty Effects

Note

The calling order of the enableEffectsBeauty interface and setEffectsBeautyParam interface has no priority.

After initializing the beauty environment, you can call the enableEffectsBeauty interface before or after publishing stream to enable or disable beauty effects in real time.

// Enable/disable beauty effects
ZegoExpressEngine.getEngine().enableEffectsBeauty(true);

Set Basic Beauty Effect Parameters

After initializing the beauty environment, you can call the setEffectsBeautyParam interface before or after publishing stream to set beauty effect parameters in real time.

  • smoothIntensity: Smoothing, perform smoothing while retaining facial details, such as retaining moles on the face.
  • whitenIntensity: Whitening, whiten the face by increasing the overall brightness of the image.
  • rosyIntensity: Rosiness, perform warm color processing on the overall image.
  • sharpenIntensity: Sharpening, perform sharpening processing on the overall image. When the image is somewhat blurry, you can slightly increase sharpening to make the outline clear.

The value range of the above four parameters is 0 to 100. The larger the value, the higher the degree of beauty. The default value is 50.

// Create beauty parameter object
ZegoEffectsBeautyParam beautyParam = new ZegoEffectsBeautyParam();

// Whitening, rosiness, smoothing, sharpening
beautyParam.whitenIntensity = 50;
beautyParam.rosyIntensity = 50;
beautyParam.smoothIntensity = 50;
beautyParam.sharpenIntensity = 50;

// Set beauty parameters
ZegoExpressEngine.getEngine().setEffectsBeautyParam(beautyParam);

(Optional) Destroy Basic Beauty Environment

When the enableEffectsBeauty interface is called and set to "false", the beauty effect will be turned off, but the beauty module will still occupy resources and consume performance. If you want to completely release resources and save performance consumption, you need to call the stopEffectsEnv interface to destroy the beauty environment before preview and publishing stream.

Note

When destroyEngine is called to destroy the engine, the SDK will automatically destroy the beauty environment.

// Destroy beauty environment
ZegoExpressEngine.getEngine().stopEffectsEnv();

ZEGO provides two ways of low light enhancement:

MethodDescription
Enable adaptive frame rate for enhancementDynamically reduce capture frame rate within the set frame rate range to extend the exposure time of each frame, achieving the effect of enhancing the brightness of the captured image.
For example: The developer enables and sets the adaptive frame rate range to [10, 25]. When ambient light is sufficient, the capture frame rate is still 25 frames. When ambient light brightness is low, the capture frame rate will be dynamically adjusted between [10, 25] to extend the exposure time of each frame to enhance the brightness of the captured image.
Algorithm enhances captured image brightness
  • Manual control: Developers independently control algorithm on/off.
  • Smart control: Intelligently enable or disable algorithms based on image lighting conditions.

Both processing methods can be used independently or simultaneously, and both are compatible with beauty features.

Set Low Light Enhancement Mode

RTC SDK supports different algorithm low light enhancement modes. Call the setLowlightEnhancement interface to set the low light enhancement mode ZegoLowlightEnhancementMode:

Note
  • Before using the setLowlightEnhancement interface, ensure that the SDK includes video internal capture and video internal filter modules.
  • If the business uses externally captured video streams, only specific data types PIXEL_BUFFER_TYPE_GL_TEXTURE_2D and PIXEL_BUFFER_TYPE_MEM are supported.
Enumeration ValueDescription
ZegoLowlightEnhancementMode.OFFTurn off low light enhancement feature.
ZegoLowlightEnhancementMode.ONEnable low light enhancement feature, controlled by developers.
ZegoLowlightEnhancementMode.AUTOSmart control of low light enhancement feature, intelligently enable or disable the feature based on image lighting conditions.

Low light enhancement type ZegoExpLowlightEnhancementType includes the following types:

Enumeration ValueDescription
ZegoExpLowlightEnhancementType.NormalRegular low light enhancement.
ZegoExpLowlightEnhancementType.AIAI low light enhancement.
Note
If you need to use this feature, please contact ZEGO Technical Support.

Taking enabling automatic low light enhancement feature as an example:

ZegoExpLowlightEnhancementParams params = new ZegoExpLowlightEnhancementParams();
params.mode = ZegoLowlightEnhancementMode.AUTO;
params.type = ZegoExpLowlightEnhancementType.AI;
engine.setLowlightEnhancementParams(params, ZegoPublishChannel.MAIN);

(Optional) Enable Camera Adaptive Frame Rate

When ambient light brightness is low and the camera capture frame rate is too high, the exposure time of each frame is insufficient, which may cause the captured video image to be dark. At this time, you can enable camera adaptive frame rate through enableCameraAdaptiveFPS. The SDK will match the camera-supported capture frame rate range according to the set frame rate range. Within this range, dynamically adjust the camera capture frame rate according to ambient brightness to improve image brightness when the set frame rate is too high.

//Set minimum frame rate
int minCamFPS = getIntent().getIntExtra("camMinFPS", 0);
//Set maximum frame rate
int maxCamFPS = getIntent().getIntExtra("camMaxFPS", 0);
engine.enableCameraAdaptiveFPS(true, minCamFPS, maxCamFPS, ZegoPublishChannel.MAIN);

Call the setVideoDenoiseParams interface to set video noise reduction parameters ZegoVideoDenoiseParams including: video noise reduction mode ZegoVideoDenoiseMode and video noise reduction intensity ZegoVideoDenoiseStrength.

Warning
  • Before using the setVideoDenoiseParams interface, ensure that the SDK includes video internal capture and video internal filter modules.
  • If the business uses externally captured video streams, only specific data types PIXEL_BUFFER_TYPE_GL_TEXTURE_2D and PIXEL_BUFFER_TYPE_MEM are supported.
  • Video noise reduction feature is not enabled by default, that is, the default value of ZegoVideoDenoiseMode is ZegoVideoDenoiseMode.off.

Taking setting automatic noise reduction as an example:

ZegoVideoDenoiseParams p = new ZegoVideoDenoiseParams();
p.mode = ZegoVideoDenoiseMode.AUTO;
p.strength = ZegoVideoDenoiseStrength.LIGHT;
engine.setVideoDenoiseParams(p, ZegoPublishChannel.MAIN);

Call the enableColorEnhancement interface to set color enhancement parameters ZegoColorEnhancementParams (parameter properties are as shown in the following table) and other parameters to enable the color enhancement feature. Color enhancement feature is not enabled by default.

Color Enhancement ParameterDescription
intensity

Intensity of color enhancement, value range [0.0, 1.0], default is 0.0.

The larger the value, the greater the color enhancement effect.

skinToneProtectionLevel

Intensity of skin tone protection, value range [0.0, 1.0], default is 1.0.

The larger the value, the better the protection effect.

lipColorProtectionLevel

Intensity of lip color protection, value range [0.0, 1.0], default is 0.0.

The larger the value, the better the protection effect.

ZegoColorEnhancementParams p = new ZegoColorEnhancementParams();
p.intensity = 1;//Value range: [0,1], the larger the value, the greater the color enhancement intensity. Default value: 0.
p.skinToneProtectionLevel = 1;//Value range: [0,1], the larger the value, the greater the skin tone protection degree. Default value: 1.
p.lipColorProtectionLevel = 1;//Value range: [0,1], the larger the value, the greater the lip color protection degree. Default value: 0.
engine.enableColorEnhancement(true, p, ZegoPublishChannel.MAIN);//Enable color enhancement

Start Preview

After calling the startPreview interface to start preview, you can set different video enhancement features and experience the effects in real time.

ZegoCanvas previewCanvas = new ZegoCanvas(preview);
engine.startPreview(previewCanvas);

Start Publishing Stream

When the preview effect meets expectations, you can call the startPublishingStream interface to start publishing stream. The publishing stream image effect will be consistent with the preview effect.

engine.startPublishingStream("STREAM_ID");

The above implements the video enhancement feature before publishing stream.

Previous

Video Small-Large Stream and Layered Encoding

Next

Stream Mixing