ApsaraVideo Live allows you to transcode streams to multiple bitrates to match the bandwidth. This reduces the impact of network jitters on the playback experience. After you enable the multi-bitrate transcoding feature, the player automatically plays streams in the most appropriate bitrate based on the network condition. This topic describes how to configure multi-bitrate transcoding and generate a multi-bitrate streaming URL.
Prerequisites
The multi-bitrate transcoding feature is enabled for your domain name. The first time you enable the multi-bitrate transcoding feature for a domain name, submit a ticket. You can configure multi-bitrate transcoding templates for the domain name before you submit the ticket. After the multi-bitrate transcoding feature is enabled, the templates immediately take effect for the domain name. To use the multi-bitrate transcoding feature to transcode streams for another domain name, you must submit another ticket.
Create a multi-bitrate transcoding template group
- Log on to the ApsaraVideo Live console.
- In the left-side navigation pane, click Domains to go to the Domain Management page.
Find the streaming domain that you want to configure and click Domain Settings in the Actions column.
Choose .
Click the Multi-bitrate Transcoding tab and click Add.
Create a multi-bitrate transcoding template group.
Specify the basic information for the multi-bitrate transcoding template group.
The following table describes the parameters.
Parameter
Description
AppName
The transcoding template takes effect only when the value of this parameter is the same as the application name in the ingest URL.
Template Group ID
The ID of the transcoding template group. The template group ID is required to generate multi-bitrate streaming URLs. The value of this parameter can contain digits, letters, and hyphens (-), and can be up to 10 characters in length.
Container Format
Only HTTP Live Streaming (HLS) is supported.
Trigger Transcoding
Multi-bitrate transcoding can be triggered only upon stream ingest, and cannot be triggered upon streaming. You are charged for using multi-bitrate transcoding.
Timestamp Alignment
After you enable this feature, you are not allowed to set the GOP parameter for templates. Instead, the GOP of the source video is used.
Click Add and set the parameters for the transcoding template.
The parameters vary based on the template type. The following table describes the template parameters.
Parameter
Description
Template ID
The ID of the transcoding template.
The value of the Template ID parameter is used to construct a URL for a live stream that requires transcoding. For information about how to construct a URL, see Ingest and streaming URLs. You can append the template ID to the streaming URL to watch the transcoded stream in the specified resolution.
Important The template ID must be different from default transcoding template IDs. Default transcoding template IDs include lld, lsd, lhd, lud, ld, sd, hd, and ud.
Transcoding Type
Valid values: Narrowband HD™ and Audio Only.
Resolution
The resolution of the output stream. Unit: pixels. Different prices apply to different resolutions. The following resolutions are supported:
Low definition (LD): 640 × 480 and lower
Standard definition (SD): 1280 × 720 and lower
High definition (HD): 1920 × 1080 and lower
2K: 2560 × 1440 and lower
4K: 3840 × 2160 and lower
NoteWhen you use multi-bitrate transcoding, you are charged based on the resolution specified in the multi-bitrate transcoding template such as LD, SD, HD, 2K, or 4K. The resolution types specified in the Narrowband HD™ template including LD, SD, HD, and UD are not used.
The resolution of an output stream is determined based on the range where the long side and short side of the video fall.
In the following example, the resolution of 1280 × 720 is used to show how the resolution of an output stream is determined:
If the width of the output video is less than or equal to 1,280 pixels and the height of the output video is less than or equal to 720 pixels, the resolution of the output video is SD.
If the width of the output video is greater than 1,280 pixels, or the height of the output video is greater than 720 pixels, the resolution of the output video is higher than SD.
Video Bitrate
The bitrate that corresponds to the resolution. Unit: Kbit/s. The following list describes the bitrate ranges for different resolutions:
LD: 100 to 800 Kbit/s
SD: 200 to 1,500 Kbit/s
HD: 500 to 4,000 Kbit/s
2K: 2,000 to 8,000 Kbit/s
4K: 4,000 to 30,000 Kbit/s
Video Frame Rate
The frame rate of the output stream. Unit: FPS. The frame rate of the output stream must be smaller than or equal to the frame rate of the input stream.
Video GOP
The group of pictures (GOP) indicates the interval between two I-frames. The GOP size of the output stream must be smaller than or equal to the GOP size of the input stream. The GOP of the output stream cannot exceed 3 seconds. This ensures low latency.
Encoding Standard (applicable only to Audio Only)
Only Advanced Audio Coding (AAC) is supported.
Codec (applicable to Audio Only)
LC-AAC: advanced audio coding with low complexity. The transcoding efficiency is high.
HE-AAC: advanced audio coding with high efficiency. The sound effect for HE-AAC is better than that for LC-AAC when the audio bitrate is lower than 128 Kbit/s.
Bitrate (applicable to Audio Only)
The audio bitrate. Valid values: 8 to 1000.
Channels (applicable to Audio Only)
The number of audio channels. Valid values: 1 and 2.
Maximum Bandwidth
We recommend that you set this parameter to a value that is higher than the video bitrate.
Click OK.
Generate a multi-bitrate streaming URL
The following sample code provides an example:
http://demo.aliyundoc.com/liveApp****/liveStream****_liveGroupid?aliyunols=on&auth_key=1234****
The aliyunols field is required and set to on.
Specify the appname, streamname, and groupid fields based on your business requirements.
For more information about authentication, see Generate ingest and streaming URLs.
You can also use the URL generator to generate a multi-bitrate streaming URL based on the configurations of your multi-bitrate transcoding template group. For more information, see Live URL generator.