Custom transcoding templates allow you to customize the encoding parameters of your video streams to meet specific viewer requirements and network conditions. In a custom transcoding template, you can specify the video resolution, video bitrate, video frame rate, and audio encoding parameters to provide the optimal viewing experience under different network conditions. This topic describes how to configure custom transcoding in the ApsaraVideo Live console.
Procedure
- Log on to the ApsaraVideo Live console.
Choose Feature Management > Transcoding. The Transcoding page appears.
Select the domain name that you want to configure. On the page that appears, click the Custom Transcoding tab, and then click Add to configure a transcoding template.
The following table describes the parameters that you can configure for the transcoding template.
Parameter
Description
AppName
The value of this parameter must be the same as the application name that is specified in the ingest URL. Otherwise, the transcoding template does not take effect.
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.
A standard transcoding template and a Narrowband HD™ transcoding template vary in transcoding quality and performance, and are charged at different prices. An original quality template does not modify the video configuration. An audio-only transcoding template removes the video content of the stream and generates an audio-only stream.
An audio-only transcoding template removes the video content of the stream and generates an audio-only stream.
Recommended Parameter Settings
Valid values: Low Definition, Standard Definition, High Definition, and Ultra High Definition. After you select a definition, the system automatically fills in the corresponding frame rate, bitrate, and resolution. You can modify them based on your business requirements.
Resolution
The resolution of the output stream. Unit: pixels. You can specify a fixed resolution or configure source-based values.
Source-based: If the resolution of the source stream is smaller than the adaptive resolution, the output resolution is equal to the source resolution. If the resolution of the source stream is greater than the adaptive resolution, the output resolution is equal to the adaptive resolution. You can select one of the following adaptation methods:
Adapted to Shorter Side
Adapted to Longer Side
Adapted to Orientation
Fixed: The resolution that you specify. 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
Note
Transcoding prices vary based on video resolutions, including LD, SD, HD, 2K, and 4K. The video resolutions are irrelevant to the default transcoding template IDs, including lld, lsd, lhd, and lud for standard transcoding and ld, sd, hd, and ud for Narrowband HD™ transcoding. Template IDs are used only for identification in your business calls.
You cannot specify a custom resolution that is higher than 1080p in the console. If your business scenario requires a resolution of 2K or 4K, submit a ticket.
For more information about how to submit a ticket, see Contact us.
The resolution of an output stream is determined based on the range where the longer side and shorter 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 longer side of the video is no more than 1,280 pixels and the shorter side of the video is no more than 720 pixels, the resolution of the output stream is SD.
If the longer side of the video is more than 1,280 pixels, or the shorter side of the video is more than 720 pixels, the resolution of the output stream is higher than SD.
Video Frame Rate
Source-based: If the frame rate of the source stream is within the limit, the output frame rate is equal to the source frame rate. If the frame rate of the source stream exceeds the upper limit, the output frame rate is equal to the maximum frame rate. If the frame rate of the source stream is lower than the lower limit, the output frame rate is equal to the minimum frame rate.
Fixed: The frame rate that you specify. 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 Bitrate
Source-based: If the bitrate of the source stream is within the limit, the output bitrate is equal to the source bitrate. If the bitrate of the source stream exceeds the upper limit, the output bitrate is equal to the maximum bitrate. If the bitrate of the source stream is lower than the lower limit, the output bitrate is equal to the minimum bitrate. In addition, you can also specify a coefficient of the source bitrate to determine the output bitrate.
Fixed: The bitrate that you specify. 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 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.
Audio Bitrate (applicable only to audio-only transcoding)
This parameter is available when you set Template Type to Audio-only Transcoding. Unit: Kbit/s. Valid values: 8 to 1000.
Profile (applicable only to audio-only transcoding)
This parameter is available when you set Template Type to 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.
Sampling Rate (applicable only to audio-only transcoding)
This parameter is available when you set Template Type to Audio-only Transcoding. Valid values: 22050, 32000, 44100, 48000, and 96000.
Sound Channels (applicable only to audio-only transcoding)
This parameter is available when you set Template Type to Audio-only Transcoding. Valid values: 1 and 2.
Transcoding Mode (under Advanced Settings)
The quality-first and latency-first modes are supported. In the latency-first mode, low latency is ensured for the transcoded stream.
Trigger Transcoding (under Advanced Settings)
If you enable this feature, transcoding is triggered only when a stream is pulled for the first time.
If you disable this feature, transcoding is triggered whenever a stream is ingested, regardless of whether the stream is pulled.
Video Encryption (under Advanced Settings)
After you turn on the switch, you can select Alibaba Cloud Proprietary Cryptography or DRM Encryption.
NoteDigital rights management (DRM) encryption is supported only in the China (Shanghai) and Singapore regions.
Alibaba Cloud Proprietary Cryptography
Videos can be generated in only the HTTP Live Streaming (HLS) and Flash Video (FLV) formats.
KMS CMK ID: Specify a customer master key (CMK) in Key Management Service (KMS). The region of the CMK must be the same as the region in which the domain name resides. If you do not have a CMK, go to the KMS console to create one. For more information, see Purchase and enable a KMS instance.
CMK Rotation Period: Enter an integer from 60 to 3,600.
For more information, see Alibaba Cloud proprietary cryptography.
DRM Encryption
Before you enable this feature, you need to first configure DRM encryption. For more information, see Configure DRM encryption.
Videos in the HLS format can be encrypted by using Widevine and FairPlay DRM. To use FairPlay DRM, you must upload a FairPlay Streaming certificate that you obtain from Apple on the DRM Management page. For information about how to apply for a FairPlay Streaming certificate, see Apply for a FairPlay Streaming certificate.
All SEI Passed-through (under Advanced Settings)
If you enable this feature, SEI messages are passed through. If you disable this feature, SEI messages are not passed through.
Source-based Keyframes (under Advanced Settings)
If you enable this feature, the keyframes of the transcoded stream are the same as the keyframes of the source stream.
Source-based PTS (under Advanced Settings)
If you enable this feature, the presentation timestamp (PTS) of the transcoded stream is the same as the PTS of the source stream.
Click OK.
Use the feature
For more information about the live stream transcoding feature, see Live stream transcoding.