Live stream transcoding resolves playback issues caused by high or low ingest bitrates. This topic describes the scenarios, limits, features, template parameters, transcoding rules, and adaptive resolution of live stream transcoding.
Scenarios
If the ingest bitrate is high and the client has limited bandwidth, video playback may stutter. If the ingest bitrate is low, the playback quality is poor. The live stream transcoding service helps you resolve these issues.
Player plug-ins need to support multi-bitrate switching. To enable this on a frontend player plug-in, you must provide multiple streaming URLs with different bitrates for the same ingest stream. The real-time transcoding feature of ApsaraVideo Live provides these URLs.
Ingest a stream encoded in H.264 and transcode it into an H.265 stream in real time for playback to reduce bandwidth usage.
Ingest a stream encoded in H.265 and transcode it into a low-bitrate H.265 stream in real time for playback.
To resolve the incompatibility of H.265 in some browsers, you can transcode the stream into an H.264 stream in real time for playback.
If you use the live stream transcoding feature, you are charged based on the transcoding standard, resolution, and total length of transcoded streams. For more information, see Live stream transcoding fees.
Limits
When you configure a transcoding template based on a domain name and an AppName, you cannot set the Template Type to both Standard Template and Narrowband HDTM template in the same template.
If you configure a transcoding template for a specific AppName, the template is applied only when the AppName in the ingest URL matches the one in the template. Subdomains for streaming reuse the transcoding templates of the primary streaming domain, and any configurations specific to the subdomains are ignored.
If the live center is in Beijing, Shanghai, or Shenzhen, a maximum of 300 concurrent transcoded streams are supported for each domain name. For other live centers, a maximum of 50 concurrent transcoded streams are supported for each domain name. For example, if you ingest a high-definition (HD) stream and transcode it into standard-definition (SD) and low-definition (LD) streams for playback, this counts as two transcoded streams. If the limit is reached, subsequent playback connections that exceed the limit play the original stream. You can go to Basic Information on the Basic Settings page of your streaming domain to view the current usage and increase the quota.
If the live streaming service does not meet your current business needs, you can contact your Alibaba Cloud account manager or Alibaba Cloud through other channels.
Features
The transcoding feature includes Default Transcoding, Custom Transcoding, Multi-bitrate Transcoding, and H5 Automatic Transcoding.
Default Transcoding: You can use system preset templates, which include template IDs and output resolutions. The output bitrates are preset by the system and cannot be modified.
Custom Transcoding: You can customize settings such as 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.
H5 Automatic Transcoding: This feature resolves issues such as the lack of support for B-frames and AAC encoding in Native Browsers for Real-Time Streaming (RTS) (artc://).
System preset templates
Transcoding rules
ApsaraVideo Live supports delayed transcoding by default. The system does not perform transcoding if it detects that no viewers are watching a transcoded live stream. Transcoding starts when the first viewer begins playback. If no viewers are detected within 5 minutes during the transcoding process, transcoding stops.
Each transcoded stream is transcoded only once.
Transcoding is an optional service. You can configure it as needed.
The transcoding feature supports the FLV, RTMP, HLS, and RTS protocols.
Adaptive resolution
Transcoding uses an adaptive resolution algorithm for landscape or portrait mode.
For Adaptive Landscape transcoding, the width of the transcoded video is adapted based on the template height.
For Adaptive Portrait transcoding, the height of the transcoded video is adapted based on the template width.
The adaptive width is calculated as follows:

For example, if you transcode a 1920 × 1080 video using the Low Definition Landscape template (template ID: ld) with Adaptive Width and a height of 360, the transcoded resolution is 640 × 360.
For example, if you transcode a 1920 × 1080 video using the Low Definition Portrait template (template ID: ld-v) with a width of 360 and Adaptive Height, the transcoded resolution is 360 × 203.
Currently, only Default Transcoding and Custom Transcoding support adaptive resolution.
Configuration
Default transcoding
You can configure default transcoding for ApsaraVideo Live in two ways:
Custom transcoding
If the default transcoding templates do not meet your requirements, you can use custom transcoding configurations. You can customize settings such as encoding format, resolution, bitrate, frame rate, video GOP, transcoding trigger, and template ID.
You can configure custom transcoding for ApsaraVideo Live in two ways:
Multi-bitrate transcoding
Multi-bitrate transcoding lets you configure multiple transcoding profiles within a single transcoding template. Network conditions can vary significantly by region, and network fluctuations can affect the playback experience on clients. To accommodate this, you can configure multiple bitrates for different bandwidth conditions. After you configure multi-bitrate transcoding, the player can automatically select the live stream with the appropriate bitrate based on the client's network bandwidth, which improves the playback experience.
Currently, you can configure multi-bitrate transcoding only in the ApsaraVideo Live console.
Currently, multi-bitrate transcoding can only provide HLS Transcoded Stream URLs.
To play a Multi-bitrate Transcoded stream, you must add the
aliyunols=onparameter.aliyunols=onis a required parameter.
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.

This template group contains four levels of custom transcoding configurations. For the parameter value settings for different levels, see System Preset Templates.
Then, ingest the stream and use the web-based ApsaraVideo Player for playback. During testing, you can observe that the player automatically selects the transcoded stream with the appropriate bitrate based on the client's network bandwidth.

To use ApsaraVideo Player, see Player SDK.
H5 automatic transcoding
Real-Time Streaming (RTS) is based on WebRTC signaling. Native Browser WebRTC does not support video B-frames or AAC encoding. The automatic H5 transcoding feature provides adaptive transcoding to resolve these limitations and ensure smooth playback.
When you enable Real-Time Streaming (RTS), you can also enable the automatic H5 transcoding feature. For more information, see Step 5: Enable the Real-Time Streaming (RTS) feature.
H5 automatic transcoding resolves issues such as B-frames and AAC encoding for RTS (artc://) in Native Browsers. To transcode video content, such as adjusting the bitrate, frame rate, or resolution, you still need to configure default or custom transcoding.
H5 automatic transcoding can be used together with default or custom transcoding.
Using H5 automatic transcoding incurs audio-only transcoding fees. For more information, see Live stream transcoding fees.
Video encryption
When you configure default or custom transcoding, you may notice fields related to video encryption. You can use the transcoding configuration to enable the Alibaba Cloud Video Encryption feature. For more information about this feature and how to implement it, see Alibaba Cloud Video Encryption.
References
For APIs related to transcoding configuration, see Live stream transcoding.
For information about using the Java SDK, see Java SDK User Guide.



