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 configure multi-bitrate transcoding, the player automatically plays streams at 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.
Create a multi-bitrate transcoding template group
- Log on to the ApsaraVideo Live console.
In the left-side navigation pane, choose Feature Management > Transcoding.
Select the domain name that you want to configure. Click the Multi-bitrate Transcoding tab, and then click Add to create a multi-bitrate transcoding template group.
On the Basic Information tab, configure the basic information of 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 ID is one of the parameters that are concatenated into a multi-bitrate transcoding URL. The ID can be up to 10 characters in length and can contain digits, letters, and hyphens (-).
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 stream pulling. You are charged for using multi-bitrate transcoding.
Timestamp Alignment
After you enable this feature, you are not allowed to specify the group of pictures (GOP) size for templates. Instead, the GOP size of the source video is used.
Click + Add to add a template.
Click the added template to configure the template parameters. The parameters vary based on the template type. The following table describes the parameters.
Parameter
Description
Template ID
The ID of the transcoding template.
The value of this parameter is used to construct the URL for the transcoded stream. For more information about how to construct a transcoded stream URL, see Generate ingest and streaming URLs. You can append the template ID to the streaming URL to play the transcoded stream in the specified resolution.
Note: 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™ Transcoding and Audio-only Transcoding.
Resolution
The resolution of the output stream. Unit: pixels. 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
NoteTranscoding prices vary based on video resolutions, including LD, SD, HD, 2K, and 4K. The video resolutions are irrelevant to the default transcoding template IDs for Narrowband HD™ transcoding, including ld, sd, hd, and ud.
The resolution of an output stream is determined by the number of pixels on the long edge and short edge.
Take the SD resolution (1280×720) as an example.
If the long edge of an output stream has no more than 1,280 pixels and the short edge has no more than 720 pixels, the resolution of the output stream is SD.
If the long edge of an output stream has more than 1,280 pixels, or the short edge has more than 720 pixels, the resolution of the output stream 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: frames per second (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) size 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 size of the output stream cannot exceed 3 seconds. This ensures low latency.
Encoding Standard (audio-only transcoding)
Only Advanced Audio Coding (AAC) is supported.
Profile (audio-only transcoding)
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 (audio-only transcoding)
The audio bitrate. Unit: Kbit/s. Valid values: 8 to 1000.
Sound Channels (audio-only transcoding)
The number of sound channels. Valid values: 1 and 2.
Maximum Bandwidth
Valid values: 100 Kbit/s to 100 Mbit/s. The value is accurate to 2 decimal places. We recommend that you set the maximum bandwidth to 1.2 to 1.5 times the video bitrate.
Click OK.
Generate a multi-bitrate streaming URL
Sample URL:
http://demo.aliyundoc.com/liveApp****/liveStream****_liveGroupid?aliyunols=on&auth_key=1234****
The aliyunols field is required and has a fixed value of 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.
Use the feature
For more information about how to use the live stream transcoding feature, see Live stream transcoding.
T