logo
Video Call
On this page

Super Resolution

2024-01-02

Feature Overview

Super Resolution (SR) can double the pixels in width and height of the video stream at the playing stream end. For example: If the original resolution of the stream received by the playing end is 640p x 360p, after super resolution processing, the resolution will be upgraded to 1280p x 720p.

Effect Demonstration

  • Portrait
Before SRAfter SR
  • Text
Before SRAfter SR

Use Cases

Warning

Since the same device can only enable super resolution for 1 stream at the same time, the super resolution feature is only suitable for scenarios with only a single stream or 1 focused stream.

  • 1v1 Video Call scenarios
  • Live Streaming scenarios: In most live streaming scenarios, only 1 stream is played, and super resolution can be enabled for the single stream. When playing multiple streams, super resolution can be enabled for the focused streamer.
  • Online Education: Online education scenarios may involve multiple streams, but there will be 1 focused stream (such as the teacher), and super resolution can be enabled for the teacher's whiteboard or the speaking student's screen to achieve enhancement effects.

Feature Advantages

  • Low Power Consumption: After enabling 360p super resolution, taking OPPO R11 as an example, the current increase is less than 60mA, with minimal extra power consumption.
  • Low Heat Generation: After enabling 360p super resolution for half an hour, taking OPPO R11 (Snapdragon 660) as an example, the temperature rise is less than 1.5°C.
  • High Performance: For devices that can enable super resolution, more than 95% have a CPU increase of less than 2% and a memory increase of less than 100MB.

Prerequisites

Warning

Enabling super resolution will consume additional system resources. To ensure user experience, currently only one stream can have super resolution enabled at a time, and the original resolution of the stream is not recommended to exceed 640p × 360p.

Before using the super resolution feature, ensure:

  • You have contacted ZEGOCLOUD Technical Support to request a special build.
  • You have integrated ZEGO Express SDK in your project and implemented basic real-time audio and video features. For details, please refer to Quick Start - Integrating SDK.
  • You have created a project in the ZEGOCLOUD Console and applied for a valid AppID and AppSign. For details, please refer to Console - Project Management.

Implementation

Initialization and Room Login

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

Listen for Super Resolution State Callback

After enabling super resolution, you can confirm whether super resolution is successfully enabled through onPlayerVideoSuperResolutionUpdate.

The super resolution state definitions are as follows:

Enum ValueDescription
ZegoSuperResolutionState.OffSuper resolution is disabled.
ZegoSuperResolutionState.OnSuper resolution is enabled.

You can get the video resolution after enabling super resolution through onPlayerVideoSizeChanged.

// Notification when the played video resolution changes
ZegoExpressEngine.onPlayerVideoSizeChanged(String streamID, int width, int height) {

}
// Notification when super resolution state changes
ZegoExpressEngine.onPlayerVideoSuperResolutionUpdate(String streamID, ZegoSuperResolutionState state, int errorCode) {
    if(state == ZegoSuperResolutionState.On)
    {
        // Super resolution enabled
    }
    else
    {
        // Super resolution disabled
        if(errorCode == 0){
            // Normal shutdown
        }
        else if(errorCode == 1004004){
            // Device does not support super resolution
        }
        else if(errorCode == 1004005){
            // Number of super resolution streams exceeds limit, only one stream supported
        }
        else if(errorCode == 1004006){
            // Original resolution exceeds limit
        }
        else if(errorCode == 1004007){
            // Insufficient device performance
        }
        else if(errorCode == 1004008){
            // Super resolution is initializing, do not operate frequently
        }
    }
}

Initialize Video Super Resolution

Before using super resolution, you need to call the initVideoSuperResolution method to initialize super resolution.

Warning

Initializing video super resolution is a time-consuming operation. It only needs to be executed once during the SDK lifecycle. Frequent initialization and de-initialization of super resolution is not recommended.

ZegoExpressEngine.instance.initVideoSuperResolution();

Enable Video Super Resolution

Developers can choose to enable video super resolution before or during stream playing. Taking enabling super resolution for stream "STREAM_ID" before playing as an example:

ZegoExpressEngine.instance.enableVideoSuperResolution("STREAM_ID", true);

After enabling super resolution, you need to listen to the callback onPlayerVideoSuperResolutionUpdate to confirm whether this super resolution enabling was successful.

Warning

To facilitate super resolution state management, it is recommended to enable the next super resolution after receiving the super resolution state callback.

Start Playing Stream

Call startPlayingStream and pass "STREAM_ID" to play the remote user's audio and video stream.

var playCanvas = ZegoCanvas.view(playView);
ZegoExpressEngine.instance.startPlayingStream("STREAM_ID", canvas:playCanvas);

Disable Video Super Resolution

When super resolution is not needed or an error occurs during the enabling process (insufficient performance or original video resolution exceeds the limit), you can disable super resolution to release system resources.

ZegoExpressEngine.instance.enableVideoSuperResolution("STREAM_ID", false);

Stop Playing Stream

After stopping stream playing, the SDK will automatically disable super resolution and release the occupied system resources.

ZegoExpressEngine.instance.stopPlayingStream("STREAM_ID");

Deinitialize Video Super Resolution

When video super resolution is no longer needed, you can call the uninitVideoSuperResolution method to deinitialize video super resolution to save memory.

ZegoExpressEngine.instance.uninitVideoSuperResolution();

Previous

Custom Video Preprocessing

Next

Object Segmentation