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
  • Single stream transcoding

Single stream transcoding

Last updated:2025-04-11 19:38

Introduction

Single stream transcoding refers to converting a single original stream into transcoded streams with different encoding formats and resolutions in the cloud. In live streaming scenarios, viewers can choose different resolution streams to watch based on their network quality and terminal devices to ensure smooth playback.

Application scenarios

  • When you provide multiple resolution video streams for users to watch on demand, you need to convert the original stream into transcoded streams with different clarity levels. In this case, you can use the single stream transcoding function.
  • When converting the original video stream into different video encoding formats, you can use the single stream transcoding function. For example, some devices cannot decode H.265 due to performance issues, and need to be transcoded to H.264.

Prerequisites

The single stream transcoding function is currently in beta testing. If you need to access it, please contact the ZEGOCLOUD team or technical support.

Before you begin, make sure you complete the following:

  • ZEGO Express SDK has been integrated into the project to implement basic real-time audio and video functions. For details, please refer to Integrate the SDK and Implement a basic video call.

  • Make sure you didn't use Stream Mixing, and when playing a stream, you need to use the Interactive Live Streaming method or play the stream from CDN.

    For scenarios that have already used stream mixing, you can directly use the stream mixing interface to output multiple streams with different resolutions, instead of triggering single-stream transcoding.

Implementation steps

The main process of single stream transcoding is as follows:

  1. Add transcoding configuration templates.
  2. Create an engine instance and log in to the room.
  3. Play a stream using the Interactive Live Streaming method or play the stream from CDN according to the needs, and pass in the transcoding template ID to trigger transcoding.

1. Add transcoding configuration template

Please contact ZEGOCLOUD technical support to add a transcoding configuration template and obtain the corresponding transcoding template ID.

Currently supported transcoding parameters include: resolution, bitrate, frame rate, and video encoding format.

  • Currently, only video-related parameters can be configured.
  • An AppID can add up to 5 transcoding templates. If you need to set more templates, please contact ZEGOCLOUD technical support.
Parameter Description
Video Encoding Format The following video encoding formats are supported: H.264 and H.265. If not filled, it means to maintain the video encoding format of the original stream.
Resolution Supports width range: [0, 3000p]
Supports height range: [0, 3000p]
Bitrate The value must be greater than 0, and the unit is bps.
Frame Rate Supports range: [0, 20fps]
If you need to output a larger frame rate, please contact ZEGOCLOUD technical support for configuration.

2. Create an engine and log in to the room

Please refer to the [Create engine] and [Join room] sections of the Quick Start or Implementation document for specific steps.

Before implementing single stream transcoding, there needs to be an existing stream in the room.

3 Play the transcoded stream

To play the transcoded stream, configure the ZegoWebPlayOption > codecTemplateID property to the transcoding template ID obtained in step 1 Add Transcoding Configuration Templates, and start to play the stream.

If you want to play a stream from CDN, you should call the startPlayingStream method, instead of playing it by URL. Otherwise, the single stream transcoding can not be triggered.

const stream = await zg.startPlayingStream(streamID, {
    codecTemplateID: 360, // Transcoding template ID
}

FAQ

What is the difference between stream mixing and single stream transcoding?

Stream mixing is generally used to merge multiple input streams into one, and it supports defining the encoding format, resolution, and other parameters of multiple output streams. Stream mixing and transcoding require developers to call client or server APIs to trigger the process.

Single stream transcoding of a single stream is used to achieve the transcoding function of a single stream, and it does not require additional calls to client or server APIs to trigger the process. Simply include the template parameter when pulling the stream to trigger it.

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