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.
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.
The main process of single stream transcoding is as follows:
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.
| 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. |
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.
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
}
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.
