logo
Video Call
On this page

Single Stream Transcoding

2026-03-05

Overview

Single stream transcoding refers to 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 playback smoothness.

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

Warning

The single stream transcoding function is currently in beta testing. For access, please contact ZEGO business personnel or ZEGO technical support.

Before using the single stream transcoding function, please ensure:

Note

For scenarios that already use stream mixing capabilities, 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:

  1. Add transcoding template.
  2. Create engine and log in to Room.
  3. Pull transcoded streams on demand, choose the Stream Playing method as L3 Stream Playing, CDN forwarding Stream Playing (pull 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.

Currently supported transcoding parameters are: template ID, resolution, bitrate, frame rate, and video encoding format.

Warning
  • Currently only video-related parameters are supported.
  • One AppID supports adding up to 5 transcoding templates. To set more templates, please contact ZEGO technical support.
ParameterDescription
Template IDAn integer greater than 100. The ID must be unique.
Recommended to name based on 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
  • Supported width range: [0, 3000], the value must be a multiple of 2.
  • Supported height range: [0, 3000], the value must be a multiple of 2.
BitrateThe value must be greater than 0, in bps.
Frame rateSupported range: [1, 20], in fps.
If you need to output a larger frame rate, please contact ZEGO technical support for configuration.
Video encoding format

The following video encoding formats are supported:

  • H.264
  • H.265
  • Keep the video encoding format of the original stream.

2 Create Engine and Log in to Room

For specific flow, please refer to the Create Engine and Log in to Room sections of the "Implementing Video Call" document.

Warning

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

3 Pull Transcoded Stream

Configure the ZegoWebPlayOption > codecTemplateID property, fill in the transcoding template ID obtained in Step 1 Add transcoding configuration template, and start Stream Playing.

Warning

CDN Stream Playing must also use the startPlayingStream method and cannot directly use URL to pull streams, otherwise single stream transcoding cannot be triggered.

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

Enable Downgrade Transcoding Function (Optional)

Configure the ZegoWebPlayOption > transcodeOnDecodeFail property to true to enable the downgrade transcoding function. After enabling, normally pull the original stream directly. The SDK will use single stream transcoding to other video encoding when video decoding fails, but Stream Playing detection of video encoding availability will increase retry time.

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

FAQ

  • Stream mixing is generally used to merge multiple input streams into one, while supporting defining encoding format, resolution, and other parameters for multiple output streams. Stream mixing transcoding requires developers to additionally call client-side or server-side interfaces to trigger.
  • Single stream transcoding is used to implement transcoding functionality for a single stream, and developers do not need to additionally call client-side or server-side interfaces to trigger. They only need to pass in the template parameter when Stream Playing to trigger.

Previous

Ultra-low Latency Live Streaming

Next

Use Local Broadcast

On this page

Back to top