logo
Video Call
On this page

Single Stream Transcoding

2024-01-02

Feature Introduction

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

Application Scenarios

  • When developers provide video streams of multiple resolutions for users to watch on demand, they need to convert the original stream into transcoded streams of different definitions. In this case, 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 transcode to H.264.

Prerequisites

Warning

The single stream transcoding function is currently in beta testing. For integration, please contact ZEGO business personnel or ZEGO Technical Support.

Before using the single stream transcoding function, ensure that:

Note

For scenarios that already use stream mixing capability, you can directly implement outputting multiple streams with different resolutions based on the stream mixing interface, without needing to trigger single stream transcoding.

Implementation Flow

The main flow of single stream transcoding is as follows:

  1. Add transcoding template.
  2. Create engine and login to room.
  3. Play transcoded streams on demand, choose stream playing method as L3 Stream Playing, Relay to CDN Stream Playing (playing 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 transcoding templates 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 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.
ParameterDescription
Template IDInteger value greater than 100, ID must be unique.
It is 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 freely.
Resolution
  • Supported width range: [0, 3000], value must be a multiple of 2.
  • Supported height range: [0, 3000], value must be a multiple of 2.
BitrateValue must be greater than 0, unit is bps.
Frame RateSupported range: [1, 20], unit fps.
If you need to output higher frame rates, please contact ZEGO Technical Support for configuration.
Video Encoding Format

Supports the following video encoding formats:

  • H.264
  • H.265
  • Maintain the original stream's video encoding format.

2 Create Engine and Login to Room

For specific flow, please refer to the Create Engine and Login Room sections of the "Implementing Video Call" documentation.

Warning

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

  • 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, and 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 does not require developers to additionally call client-side or server-side interfaces to trigger, only needs to pass in template parameters when playing stream to trigger.
2024-01-02

Previous

Ultra-Low Latency Live Streaming

Next

OBS Streaming with WHIP Protocol

On this page

Back to top