Live stream transcoding prevents playback issues caused by high or low ingest bitrates. This topic covers scenarios, limits, features, template parameters, transcoding rules, and adaptive width.
Use cases
When the ingest bitrate is high but client bandwidth is limited, video playback can stutter. Conversely, a low ingest bitrate results in poor playback quality. Live stream transcoding resolves these issues.
Player plugins must support multi-bitrate switching. To enable this, provide the player with multiple streaming URLs for the same ingest stream, each with a different bitrate. ApsaraVideo Live's real-time transcoding feature generates these URLs.
You can ingest a stream with H.264 encoding and transcode it into an H.265 live stream in real-time to reduce bandwidth.
You can ingest a stream with H.265 encoding and transcode it into a low-bitrate H.265 live stream in real-time.
To resolve browser incompatibility with H.265, you can transcode the stream into an H.264 live stream in real-time.
The live stream transcoding feature incurs transcoding fees. Fees are based on the transcoding standard, resolution, and total transcoding duration. For more information about the billing rules, see Live stream transcoding fees.
Limitations
When you configure transcoding templates for a domain name and AppName, you cannot set the Template Type for a single template to both Standard Transcoding and Narrowband HDTM template.
When you configure a transcoding template for a specific AppName, it is applied only if the AppName in the ingest URL matches the one in the template. Sub-streaming domains inherit transcoding templates from the primary streaming domain, so any configurations specific to sub-streaming domains are ignored.
For live centers in China (Beijing), China (Shanghai), and China (Shenzhen), each domain name supports up to 300 concurrent transcoded streams. For other live centers, each domain name supports up to 50 concurrent transcoded streams. For example, if a high-definition live stream is ingested and transcoded into standard-definition and low-definition streams for playback, this counts as two concurrent transcoded streams. When the limit is reached, connections that exceed the limit will play the original stream. To view your current usage and request a quota increase, go to basic configuration > Basic Information for your streaming domain.
If the live streaming service does not meet your business requirements, please contact your Alibaba Cloud account manager or reach out to us through other channels.
Features
The transcoding feature includes Default Transcoding, Custom Transcoding, Multi-bitrate Transcoding, and HTML5 Auto Transcoding.
Default Transcoding: You can use system-preset templates, which include the template ID and the output resolution. The system presets the output bitrate, and it cannot be modified.
Custom Transcoding: You can configure the encoding format, resolution, bitrate, frame rate, video GOP, transcoding trigger, and template ID.
Multi-bitrate Transcoding: A transcoding template can contain multiple transcoding configurations. After you configure multi-bitrate transcoding, the player can automatically play the live stream with the appropriate bitrate based on the network bandwidth of the client. This improves the playback experience.
HTML5 Auto Transcoding: This feature resolves issues such as the lack of support for video B-frames and AAC encoding in native browsers for Real-Time Streaming (RTS) (artc://).
System-preset templates
Transcoding rules
ApsaraVideo Live supports on-demand transcoding by default. The system monitors transcoded live streams. If a stream has no viewers, the system does not perform transcoding. Transcoding starts when the first viewer begins to watch the stream. If the system detects no viewers for five minutes during the transcoding process, transcoding stops.
The system transcodes each stream only once.
Transcoding is an optional service that you can configure as needed.
The transcoding feature supports the FLV, RTMP, HLS, and RTS protocols.
Adaptive resolution
Transcoding uses an adaptive resolution algorithm based on whether the video is in landscape or portrait orientation.
For adaptive landscape transcoding, the system adapts the width of the transcoded video based on the template height.
For adaptive portrait transcoding, the system adapts the height of the transcoded video based on the template width.
The system calculates the adaptive width as follows:

For example, if you transcode a 1920 × 1080 video using the LD (Landscape) template (template ID: ld), the template sets the height to 360, and the adaptive width results in a final resolution of 640 × 360.
For example, if you transcode a 1920 × 1080 video using the LD (Portrait) template (template ID: ld-v), the template sets the width to 360, and the adaptive height results in a final resolution of 360 × 203.
Currently, only Default Transcoding and Custom Transcoding support adaptive resolution.
Configuration
Default transcoding
You can configure Default transcoding in ApsaraVideo Live in two ways:
Custom transcoding
If the Default transcoding templates do not meet your requirements, you can use Custom Transcoding configurations. Custom Transcoding configurations allow you to set the encoding format, resolution, bitrate, frame rate, video GOP, transcoding trigger, and transcoding template ID.
You can configure Custom Transcoding in ApsaraVideo Live in two ways:
Multi-bitrate transcoding
You can use Multi-bitrate Transcoding to configure multiple transcoding profiles within a single template group. In regions with significant variations in network conditions, network fluctuations can impact the playback experience. By configuring multiple bitrates, you allow the player to adapt to the user's bandwidth. After you configure Multi-bitrate Transcoding, the player can automatically select the most appropriate bitrate for the client's network, improving the playback experience.
You can configure Multi-bitrate Transcoding only on the ApsaraVideo Live console.
Currently, Multi-bitrate Transcoding streams are available only as HLS transcoded stream URLs.
To play Multi-bitrate Transcoding streams, you must add the
aliyunols=onparameter. Thealiyunols=onparameter is required and has a fixed value.
The following is an example URL:
http://<DomainName>/<AppName>/<StreamName>_<Template Group ID>.m3u8?aliyunols=on&auth_key=1234****The following example shows how to use Multi-bitrate Transcoding in a real-world scenario:
For example, add a Multi-bitrate Transcoding configuration as shown in the following figure.

In this template group, four levels of transcoding configurations are customized. For information about the parameter values for different levels, see System-preset templates in this topic.
Then, start the stream ingest and use the web-based Alibaba Cloud Player SDK for playback. During debugging, you will find that the player automatically selects the transcoded stream with the appropriate bitrate based on the client's network bandwidth.

To use the Alibaba Cloud player, see Player SDK.
H5 automatic transcoding
Real-Time Streaming (RTS) uses the WebRTC protocol. Because native browsers often do not support video B-frames or AAC encoding for WebRTC, H5 automatic transcoding handles these incompatibilities to ensure smooth playback.
You can enable H5 automatic transcoding when you activate RTS. For more information, see Step 5: Activate the RTS feature.
H5 automatic transcoding resolves compatibility issues, such as B-frames and AAC encoding, for Real-Time Streaming (RTS) playback in native browsers. To transcode video content, such as by adjusting the bitrate, frame rate, or resolution, you still need to use Default transcoding or Custom Transcoding.
H5 automatic transcoding can be used together with Default transcoding or Custom Transcoding.
When you use H5 automatic transcoding, fees are incurred for audio-only transcoding. For more information, see Live stream transcoding fees.
Video encryption
The Default transcoding and Custom Transcoding settings include options for video encryption. You can configure Alibaba Cloud Proprietary Cryptography directly within these settings. For details and setup instructions, see Alibaba Cloud video encryption.
References
To learn more about the transcoding configuration APIs, see live stream transcoding.
To use the Java SDK, see the Java SDK guide.



