Single Stream Transcoding
Feature Overview
Single stream transcoding refers to the process of converting a single original stream into transcoded streams with different encoding formats and resolutions in the cloud. In scenarios such as live streaming, viewers can choose streams with different resolutions to watch based on network quality, terminal devices, etc., to ensure smooth playback.

Application Scenarios
- When developers provide video streams with multiple resolutions for users to watch on demand, they need to convert the original stream into transcoded streams with different definitions. At this time, the single stream transcoding function can be used.
- When converting original video streams into different video encoding formats, the single stream transcoding function can be used. For example, when some devices cannot decode H.265 due to performance issues, they need to be transcoded to H.264.
Prerequisites
The single stream transcoding function is currently in beta testing. If you need to integrate it, please contact ZEGO business personnel or ZEGO Technical Support.
Before using the single stream transcoding function, please ensure:
-
You have created a project in the ZEGOCLOUD Console and applied for a valid AppID and AppSign. For details, please refer to Console - Project Information.
-
You have integrated ZEGO Express SDK in the project and implemented basic audio/video publishing and playing functions. For details, please refer to Quick Start - Integration and Quick Start - Implementation Flow.
-
You need to use L3 Play Stream, Relay to CDN Play Stream (play by streamID) or RTC Play Stream, and have not used the stream mixing function.
For scenarios that have already used the stream mixing function, you can directly implement outputting multiple streams with different resolutions based on the stream mixing interface, without triggering single stream transcoding.
Implementation Flow
The main flow of single stream transcoding is as follows:
- Add transcoding template.
- Create engine and login room.
- Play transcoded stream on demand, select the playing method as L3 Play Stream, Relay to CDN Play Stream (play by streamID) or RTC as needed, and pass in the transcoding template ID to trigger transcoding.
1 Add Transcoding Template
Please contact ZEGO Technical Support to add a transcoding template and obtain the corresponding transcoding template ID.
The currently supported transcoding parameters are: template ID, resolution, bitrate, frame rate, and video encoding format.
- Currently only supports configuring video-related parameters.
- One AppID supports adding up to 5 transcoding templates. If you need to set more templates, please contact ZEGO Technical Support.
| Parameter | Description |
|---|---|
| Template ID | An integer greater than 100, the ID must be unique. Recommended to name it according to the output resolution. For example, the template ID for transcoding output resolution of 360P can be named 360. If the transcoding output resolution is less than 100P, you can name it yourself. |
| Resolution |
|
| Bitrate | The value must be greater than 0, in bps. |
| Frame Rate | Supported range: [1, 20], unit fps. If you need to output a larger frame rate, please contact ZEGO Technical Support for configuration. |
| Video Encoding Format | Supports the following video encoding formats:
|
2 Create Engine and Login Room
For the specific flow, please refer to the Create Engine and Login Room sections of the "Implementing Video Call" document.
Before implementing single stream transcoding, there needs to be an existing stream in the room.
3 Play Transcoded Stream
Configure the codecTemplateID property of ZegoPlayerConfig, fill in the transcoding template ID obtained in Step 1 Add Transcoding Configuration Template, and start playing stream.
ZegoPlayerConfig config;
// Configure according to actual business situation
config.resourceMode = ZEGO_STREAM_RESOURCE_MODE_DEFAULT;
// 101 is the configured template ID, refer to Step 1 Add Transcoding Configuration Template
config.codecTemplateID = 101;
ZegoCanvas canvas(ZegoUtilHelper::GetView(ui->frame_Play));
canvas.viewMode = static_cast<ZegoViewMode>(ui->comboBox_ViewModePlay->currentIndex());
// engine is the IZegoExpressEngine object created when creating the engine
engine->startPlayingStream("streamid", &canvas, config);FAQ
What is the difference between stream mixing and single stream transcoding?
- Stream mixing is generally used to merge multiple input streams into one, while supporting defining encoding formats, resolutions, and other parameters for multiple output streams. Moreover, stream mixing transcoding requires developers to additionally call client or server interfaces to trigger.
- Single stream transcoding is used to implement the transcoding function for a single stream, and does not require developers to additionally call client or server interfaces to trigger. It only needs to pass in template parameters when playing stream to trigger.
