Documentation
ExpressVideoSDK Video Call
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • Video Call
  • Upgrade using advanced features
  • Distincitve features
  • Video Enhancement Before Publishing Stream

Video Enhancement Before Publishing Stream

Last updated:2025-01-20 22:06

Introduction

ZEGO Express SDK provides various video pre-processing enhancement capabilities, allowing developers to adjust the visual effects of the stream publishing end according to their business needs.

Function Function Description Advantages Effect Display
Basic face beautification features
Adjust the degree of Skin tone enhancement, Skin smoothing, Image sharpening, and Cheek blusher according to user and business needs, easily achieve the Basic face beautification features, present users with good skin condition, and create unique and natural Face beautification effects.
Cover frequently used Face beautification capabilities.
Low Light Enhancement
When the brightness of the captured image by the camera is not sufficient to clearly see the face or perform face recognition in low light conditions, enhance the brightness of the image.
  • Minimal performance overhead, covering all device models.
  • Support automatic enhancement mode, automatically recognize low light environments.
Video Denoising
Poor camera capture quality, low ambient light, and other factors may cause noticeable noise in the image. The video denoising function can reduce the noise in the image.
  • Determine whether to enable based on the noise level in the image to avoid unnecessary damage to the image.
  • Adjustable denoising strength.
Color Enhancement
Due to the characteristics of the camera, the captured video may have insufficient saturation. By using the color enhancement function, the undersaturated colors can be enhanced while protecting the skin tone, making the colors more realistic and visually appealing.
  • Protect the skin tone and avoid excessive enhancement of the skin color.
  • Protect the lip color, making the lip color more natural during Face beautification and makeup.

Implementation steps

1 Initialize and log in to the room

For the specific process of initializing and logging in to the room, please refer to the "Create a ZegoExpressEngine instance" and "Log in to a room" sections in the Implement a basic video call document.

2 Set up video enhancement for publishing stream

Choose the corresponding features to configure according to your needs.

Basic face beautification features

This feature is the Basic face beautification features of the built-in ZEGO Effects SDK in the ZEGO Express SDK, which includes four face beautification effects: Skin tone enhancement, Cheek blusher, Skin smoothing, and Image sharpening.

1 Initialize the Basic face beautification features environment

If you need to use the Basic face beautification features, you must call the startEffectsEnv interface to initialize the Face beautification environment before calling startPreview to start previewing and startPublishingStream to start publishing the stream.

// Create the Face beautification environment
ZegoExpressEngine.getEngine().startEffectsEnv();

After initializing the Face beautification environment, the SDK will use a fixed video frame data type for transmission. If you also need to use video custom pre-processing when using the Basic face beautification features, you can only configure the corresponding video frame data type:

Android platform: Only supports Texture 2D type data, which means the value of bufferType in ZegoCustomVideoCaptureConfig should be "GL_TEXTURE_2D".

2 Enable the face beautification effect

There is no particular time order for calling the enableEffectsBeauty method and the setEffectsBeautyParam method.

After initializing the face beautification environment, you can call the enableEffectsBeauty method to enable the face beautification feature you want to use after or before the stream publishing.

// Enable the beauty effect
ZegoExpressEngine.getEngine().enableEffectsBeauty(true);

3 Set the parameters for the Basic face beautification features

After initializing the face beautification environment, you can call the setEffectsBeautyParam method to set the intensity as needed after or before the stream publishing.

  • smoothIntensity: Skin smoothing. Smooth the skin while preserving details of the face, such as moles.
  • whitenIntensity: Skin tone enhancement. Turn up the overall brightness to whiten your face.
  • rosyIntensity: Cheek blusher. Carry on the warm color processing to the whole picture.
  • sharpenIntensity: Image sharpening. You can sharpen it slightly to make it clearer when the picture is a little blurry.

The value range for the four features is [0, 100], and the default value is 50. As this value gets larger, the intensity gets stronger.

// Create the face beautification parameter object
ZegoEffectsBeautyParam beautyParam = new ZegoEffectsBeautyParam();

// Set the parameters for Skin tone enhancement, Cheek blusher, Skin smoothing, and Image sharpening
beautyParam.whitenIntensity = 50;
beautyParam.rosyIntensity = 50;
beautyParam.smoothIntensity = 50;
beautyParam.sharpenIntensity = 50;

// Set the Face beautification parameters
ZegoExpressEngine.getEngine().setEffectsBeautyParam(beautyParam);

(Optional) Destroy the Basic face beautification environment

To disable the face beautification features, set the parameter to false when calling the enableEffectsBeauty method. While the face beautification module still occupies resources.

To destroy the face beautification environment and release the resources it occupies, call the stopEffectsEnv method before the local video preview and stream publishing.

The SDK automatically destroys the face beautification environment when you call the destroyEngine method to destroy the SDK.

// Destroy the face beautification environment
ZegoExpressEngine.getEngine().stopEffectsEnv();
Low-Light Enhancement

ZEGOCLOUND provides two ways to achieve Low-Light Enhancement:

Method Description
Enable adaptive frame rate enhancement
Within the specified frame rate range, dynamically reduce the capture frame rate to extend the exposure time of each frame, thereby enhancing the brightness of the captured image.
For example: If the developer enables and sets the adaptive frame rate range to [10, 25], when the ambient light is sufficient, the capture frame rate will still be 25 frames per second. When the ambient light is low, the capture frame rate will dynamically adjust between [10, 25] to extend the exposure time of each frame and enhance the brightness of the captured image.
Algorithm-based enhancement of captured image brightness
  • Manual Control: Developers can independently control the algorithm switch.
  • Smart Control: The algorithm is intelligently enabled or disabled based on the lighting conditions of the scene.

These two processing methods can be used independently or simultaneously, and are compatible with the beauty function.

1 Set the Low-Light Enhancement mode

The RTC SDK supports different algorithm-based Low-Light Enhancement modes. Call the setLowlightEnhancement interface to set the Low-Light Enhancement mode ZegoLowlightEnhancementMode:

Enumeration Value Description
ZegoLowlightEnhancementMode.OFF Turn off the Low-Light Enhancement function, and the brightness of the captured image remains unchanged.
ZegoLowlightEnhancementMode.ON Turn on the Low-Light Enhancement function to enhance the brightness of the captured image.
ZegoLowlightEnhancementMode.AUTO Automatic Low-Light Enhancement function, the enhancement value of the brightness of the captured image is dynamically adjusted according to the ambient light intensity.

Low light enhancement types ZegoExpLowlightEnhancementType include the following types:

Enum Value Description
ZegoExpLowlightEnhancementType.Normal Conventional low light enhancement.
ZegoExpLowlightEnhancementType.AI AI-based low light enhancement. If you need to use this feature, you need to contact ZEGOCLOUD technical support.

For example, to enable automatic Low-Light Enhancement:

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

2 (Optional) Enable camera adaptive frame rate

When the ambient light is low and the camera capture frame rate is too high, the exposure time of each frame of the captured image may be insufficient, resulting in a dark video image. In this case, you can enable camera adaptive frame rate by calling enableCameraAdaptiveFPS. The SDK will dynamically adjust the camera capture frame rate based on the supported capture frame rate range of the camera within the set range, and adjust the camera capture frame rate according to the ambient light intensity to improve the brightness of the video image when the set frame rate is too high.

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

Call the setVideoDenoiseParams interface to set the video denoise parameters ZegoVideoDenoiseParams, including the video denoise mode ZegoVideoDenoiseMode and the video denoise strength ZegoVideoDenoiseStrength.

The video denoise function is not enabled by default, that is, the default value of ZegoVideoDenoiseMode is ZegoVideoDenoiseMode.off.

For example, to enable automatic denoise:

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

Call the enableColorEnhancement interface to enable the color enhancement function and set the color enhancement parameters ZegoColorEnhancementParams (parameter attributes are shown in the following table) and other parameters. The color enhancement function is not enabled by default.

Color Enhancement Parameter Description
intensity

The intensity of color enhancement, ranging from 0.0 to 1.0, with a default value of 0.0.

A larger value indicates a stronger color enhancement effect.

skinToneProtectionLevel

The intensity of skin tone protection, ranging from 0.0 to 1.0, with a default value of 1.0.

A larger value indicates a better protection effect.

lipColorProtectionLevel

The intensity of lip color protection, ranging from 0.0 to 1.0, with a default value of 0.0.

A larger value indicates a better protection effect.

ZegoColorEnhancementParams p = new ZegoColorEnhancementParams();
p.intensity = 1; //Range: [0,1], a larger value indicates a stronger color enhancement effect. Default value: 0.
p.skinToneProtectionLevel = 1; //Range: [0,1], a larger value indicates a better skin tone protection effect. Default value: 1.
p.lipColorProtectionLevel = 1; //Range: [0,1], a larger value indicates a better lip color protection effect. Default value: 0.
engine.enableColorEnhancement(true, p, ZegoPublishChannel.MAIN); //Enable color enhancement

3 Start preview

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

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

4 Start publishing stream

When the preview effect meets expectations, you can call the startPublishingStream interface to start publishing the stream. The video effect of the publishing stream will be the same as the preview effect.

engine.startPublishingStream("STREAM_ID");

With the above steps, you can achieve video enhancement for publishing stream.

Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code