The bitrate of an ingested stream may not be suitable for the network conditions of viewer clients, causing video playback issues such as stuttering. The transcoding feature of ApsaraVideo Live helps resolve these issues. This topic introduces the application scenarios, limits, and configurations of transcoding.
Scenarios
If a high bitrate is set on the stream ingest client, but the bandwidth on the viewer client is insufficient, stuttering occurs during video playback. If a low bitrate is set on the stream ingest client, the video quality is poor. In these scenarios, you can use the transcoding feature to improve the viewing experience.
To implement multi-bitrate streaming, the player plug-in requires streaming URLs of the ingested stream at different bitrates. In this scenario, you can use the real-time transcoding feature to generate multiple URLs.
You are charged for transcoding based on the transcoding standard, resolution, and duration. For more information, see Billing of live stream transcoding.
Limits
Transcoding templates are configured based on application names. For the transcoding settings to take effect, the application name specified in a template must be the same as that in the ingest URL. A sub-streaming domain uses the transcoding templates of its main streaming domain.
For live centers in the China (Beijing), China (Shanghai), and China (Shenzhen) regions, each domain name supports up to 300 concurrent transcoded streams. For live centers in other regions, the upper limit is 50. If you transcode a high definition (HD) stream into standard definition (SD) and low definition (LD), two transcoded streams are generated. When the upper limit is reached, additional streams will play at their original bitrate. You can view the current usage or increase the quota on the Basic Settings > Basic Information page of a streaming domain.
If ApsaraVideo Live cannot meet your business requirements, contact your account manager or Alibaba Cloud customer service.
Overview
ApsaraVideo Live supports default transcoding, custom transcoding, multi-bitrate transcoding, and HTML5 auto transcoding.
Default transcoding: You can select a preset transcoding template. The template ID, output resolution, and output bitrate in such a template are not adjustable.
Custom transcoding: You can specify the encoding format, resolution, bitrate, frame rate, group of pictures (GOP) size, template ID, and the method to trigger transcoding.
Multi-bitrate transcoding: You can add multiple transcoding templates to a template group. The player automatically plays streams at the most appropriate bitrate based on the network condition.
HTML5 auto transcoding: This feature resolves the problem that native browsers do not support B-frames and AAC audio encoding in ultra-low latency live streaming using ApsaraVideo Real-time Communication (ARTC).
Preset templates
Narrowband HDTM
Template | Template ID (H264, quality-first) | Template ID (H265, quality-first) | Template ID (H264, latency-first) | Template ID (H265, latency-first) | Resolution | Bitrate |
Low definition (landscape) | ld | ld265 | ld-ll | ld265-ll | Width: adaptive Height: 360 | ≤ 450 |
Standard definition (landscape) | sd | sd265 | sd-ll | sd265-ll | Width: adaptive Height: 432 | ≤ 480 |
High definition (landscape) | hd | hd265 | hd-ll | hd265-ll | Width: adaptive Height: 648 | ≤ 1200 |
Ultra high definition (landscape) | ud | ud265 | ud-ll | ud265-ll | Width: adaptive Height: 1080 | ≤ 1300 |
Standard definition (landscape) | sd540 | sd265-540 | sd540-ll | sd265-540-ll | Width: adaptive Height: 540 | ≤ 480 |
Low definition (portrait) | ld-v | ld265-v | ld-v-ll | ld265-v-ll | Width: 360 Height: adaptive | ≤ 450 |
Standard definition (portrait) | sd-v | sd265-v | sd-v-ll | sd265-v-ll | Width: 432 Height: adaptive | ≤ 480 |
High definition (portrait) | hd-v | hd265-v | hd-v-ll | hd265-v-ll | Width: 648 Height: adaptive | ≤ 1200 |
Ultra high definition (portrait) | ud-v | ud265-v | ud-v-ll | ud265-v-ll | Width: 1080 Height: adaptive | ≤ 1300 |
Standard definition (portrait) | sd540-v | sd265-540-v | sd540-v-ll | sd265-540-v-ll | Width: 540 Height: adaptive | ≤ 480 |
The transcoding standard for billing is determined by the width and height of the output video, instead of the template ID. Assume that you choose a low-definition template (template ID: ld). If the short edge is no greater than 480 pixels and the long edge is no greater than 640 pixels, the transcoding standard for billing is 480p (LD). If the resolution of the output video is 700 × 360 pixels, the transcoding standard for billing is 720p (SD). For more information, see Billing of live stream transcoding.
Transcoding rules
ApsaraVideo Live supports delayed transcoding. This feature allows ApsaraVideo Live to start transcoding a live stream only when a viewer joins the live stream and stops transcoding if no viewers are detected for 5 minutes.
Each stream can be transcoded only once.
Transcoding is optional. Configure the feature based on your business requirements.
You can transcode streams in the Flash Video (FLV), Real-Time Messaging Protocol (RTMP), HTTP Live Streaming (HLS), and Real-Time Streaming (RTS) formats.
Adaptive resolution
ApsaraVideo Live preserves the aspect ratio of a video during transcoding.
When the template orientation is landscape, the width of the output video is automatically adapted to the fixed height.
When the template orientation is portrait, the height of the output video is automatically adapted to the fixed width.
Example:
If you use the low-definition (landscape) template (ID: ld) to transcode a 1920 x 1080 video, the height of the output video is fixed (360 pixels), and the width is scaled proportionally to 640 pixels.
If you use the low-definition (portrait) template (ID: ld-v) to transcode a 1920 x 1080 video, the width of the output video is fixed (360 pixels), and the height is scaled proportionally to 203 pixels.
Only default transcoding and custom transcoding support adaptive resolution.
Feature configuration
Default transcoding
You can configure default transcoding in the ApsaraVideo Live console or through API operations.
Custom transcoding
Custom transcoding allows you to customize the encoding format, resolution, bitrate, frame rate, GOP size, template ID, and the method to trigger transcoding.
You can configure custom transcoding in the ApsaraVideo Live console or through API operations.
Multi-bitrate transcoding
ApsaraVideo Live allows you to add multiple transcoding templates to a group to transcode streams to multiple bitrates. This reduces the impact of network jitters on the playback experience. After you configure multi-bitrate transcoding, the player automatically plays streams at the most appropriate bitrate based on the network condition.
You can configure multi-bitrate transcoding only in the ApsaraVideo Live console.
Multi-bitrate transcoding provides URLs of the source stream and transcoded streams in HLS format.
The
aliyunols=on
field must be added to the streaming URL to play a transcoded stream.
Sample URL of a transcoded stream:
http://<DomainName>/<AppName>/<StreamName>_<Template group ID>.m3u8?aliyunols=on&auth_key=1234****
The following example shows how to use multi-bitrate transcoding in the business scenarios:
First, add a multi-bitrate transcoding template group as shown in the following figure. This group contains four templates for different transcoding standards.
Then, ingest the stream and use the ApsaraVideo Player for Web to play the stream. After debugging, you can see that the player automatically plays the stream at the most appropriate bitrate based on the network condition.
For information about how to use the ApsaraVideo Player, see ApsaraVideo Player SDK.
HTML5 auto transcoding
RTS utilizes the communication standards and mechanisms provided by Web Real-Time Communication (WebRTC) to achieve low-latency streaming. Native browsers do not support B-frames and AAC audio encoding for WebRTC. HTML5 auto transcoding helps resolve this issue.
You can enable this feature when you enable RTS. For more information, see Enable RTS.
HTML5 auto transcoding processes only B-frames and AAC audio encoding for RTS in native browsers. If you want to adjust video content, such as its bitrate, frame rate, and resolution, you need to configure default or custom transcoding.
HTML5 auto transcoding can be used together with default or custom transcoding.
Video encryption
You can enable video encryption when you configure default and custom transcoding templates. For more information about Alibaba Cloud proprietary cryptography, see Alibaba Cloud proprietary cryptography.
References
For information about APIs related to the transcoding feature, see API reference for transcoding.
For information about how to use the server SDK for Java, see Use the server SDK for Java.