ApsaraVideo VOD allows you to save complex parameter configurations as transcoding templates. This way, you can use a transcoding template or workflow to submit transcoding tasks. Each transcoding template has a unique ID. A transcoding template group can contain multiple transcoding templates. This topic describes how to create and use different types of transcoding templates.
Transcoding template types
In most cases, transcoding parameters are complex. To free you from complex parameter configurations, ApsaraVideo VOD allows you to save complex parameters as templates. You can create custom transcoding templates. A custom transcoding template contains a set of transcoding parameters such as audio parameters, video parameters, and container parameters to meet your custom requirements for transcoding. In a transcoding template group, you can define multiple output settings. ApsaraVideo VOD provides recommended parameter settings based on the video definition and audio quality to allow you to transcode videos without the need to learn the technical details.
Type | Source | Scenario | Description |
Regular Transcoding Template | User-defined |
|
|
Video Packaging Template | User-defined | Adaptive bitrate stream transcoding | You can use adaptive bitrate stream transcoding to export videos only in the HLS format. |
No Transcoding | Built-in | Distribute without transcoding | When you use the No Transcoding template group, make sure that the source video can be directly played. Otherwise, the playback may fail. Only videos in the following formats can be played without transcoding: MP4, Flash Video (FLV), M3U8, MP3, and WEBM. |
Usage notes
You are charged based on the transcoding specifications that you specified in the transcoding template. In some cases, the specifications in the transcoding template are different from those based on which you are billed. For more information, see Billing of basic services.
After you activate ApsaraVideo VOD, the No Transcoding template group is used by default. You cannot modify or delete the No Transcoding template group. If you use the No Transcoding template group for videos in the MP4, FLV, M3U8, MP3, or WEBM formats, the URLs of your videos in original quality are used for playback. If you use the No Transcoding template for videos in other formats, the videos are considered source files and cannot be played.
To avoid transcoding failures, do not modify or delete a template or a template group when a transcoding job is in progress.
Limits
You can create up to 20 transcoding template groups in each region. You can add up to 10 regular transcoding templates and 10 video packaging templates to a transcoding template group.
Create a transcoding template group
After you submit a transcoding task, the video is transcoded based on all transcoding templates in the transcoding template group. In this case, you are charged for all transcoded video streams. To prevent unnecessary costs, create transcoding templates based on your business requirements.
Use the ApsaraVideo VOD console
Create a regular transcoding template group
Log on to the ApsaraVideo VOD console.
In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups.
In the top navigation bar, select the desired region from the drop-down list next to the Workbench button.
On the Transcoding Template Groups page, click Create Transcoding Template Group.
In the Regular Transcoding Template section, click Add Template and configure the parameters. The following table describes the parameters.
No.
Category
Parameter
Description
1
Basic Parameters
Encapsulation Format
Valid values for video files: hls, mp4, and flv.
Valid value for audio files: mp3.
For more information about each container format, see Terms.
Definition
Valid values for video files: Low Definition, Standard Definition, High Definition, Ultra High Definition, 2K, 4K, and Original.
NoteFor more information about Narrowband HD™ 1.0 such as LD-Narrowband HD 1.0 or SD-Narrowband HD 1.0, see Narrowband HD™ 1.0.
If you set Definition to Original, the original definition and bitrate of videos are retained. Only the container format of videos is modified. This template group is suitable for scenarios in which you do not need to change the size or bitrate of videos.
Valid values for audio files: Standard Quality and High Quality.
2
Video Parameters
Disable Video
If you select Disable Video, the transcoded stream does not contain video information. You can select Disable Video to extract audio in scenarios such as radio broadcasts.
Encoding Format
Valid values: H.264 and H.265.
Bitrate (Kbps)
Valid values: 10 to 50000. The definition is based on the bitrate. We recommend that you use the recommended bitrate in the following table for each definition.
Resolution
Valid values: 128 to 4096. Unit: pixel.
If you enable the automatic scaling feature, the system automatically scales the video image based on the aspect ratio of the source video. In this case, you can specify only the width or height.
Frame Rate
The number of frames displayed per second. We recommend that you use the recommended value.
Maximum Keyframe Interval
The number of frames in a group of pictures (GOP). We recommend that you use the recommended value.
Watermark
Specifies whether to add a watermark to a video. To add a watermark to a video, you must add watermark materials in watermark settings and turn on Watermark. For more information, see Video watermarks.
3
Audio Parameters
Disable Audio
If you select Disable Audio, the transcoded stream does not contain audio information. If you want to generate a video stream with no sound, select Disable Audio.
Encoding Format
If you set Encapsulation Format to hls or mp4, you can set this parameter to AAC or MP3. If you set Encapsulation Format to mp3, you can set this parameter only to MP3.
Sample Rate
We recommend that you use the recommended value.
Bitrate (Kbps)
Valid values: 8 to 1000. We recommend that you use the recommended value.
Audio Channels
We recommend that you use the recommended value.
4
Advanced Parameters (available only when you set Encapsulation Format to hls or mp4)
Fragment Length
The duration of each TS segment. We recommend that you use the recommended value.
Video Encryption
You can enable this feature to encrypt HLS videos. After you enable video encryption, you must integrate an official player SDK that supports video decryption to play videos. A free trial is provided for this feature.
NoteThe encryption feature configured here encrypts videos by using Alibaba Cloud proprietary cryptography. For more information about how to encrypt videos in standard HLS encryption mode, see HLS encryption
5
Conditional Transcoding Parameters
Video Resolution Check
Checks whether the resolution of the video file is lower than the resolution that is specified in the transcoding template.
Video Bit Rate Check
Checks whether the bitrate of the video file is lower than the bitrate that is specified in the transcoding template.
Audio Bit Rate Check
Checks whether the bitrate of the audio file is lower than the bitrate that is specified in the transcoding template.
Details of the conditional transcoding parameters
Conditional transcoding parameters are generally configured when you generate streams in higher definitions. For example, if you set the definition to 4K but the definition of the original video file is lower than 4K, the images are stretched, which lowers the image quality. In this case, you can configure conditional transcoding parameters. The following processing methods are supported:
If the bitrate or resolution specified in the transcoding template is higher than that of the input video file, the video is not transcoded to the template specifications.
If the bitrate or resolution specified in the transcoding template is higher than that of the input video file, the video is transcoded to the same bitrate or resolution as the input file.
Recommend definition configuration
Definition
Recommended bitrate
Recommended resolution
Resolution range
LD
400
640×360
128×128~640×360
SD
900
960×540
641×361~960×540
HD
1500
1280×720
961×541~1280×720
UHD
3000
1920×1080
1281×721~1920×1080
2K
3500
2560×1440
1920×1080~2560×1440
4K
6000
3840×2160
2560×1440~3840×2160
Click Save.
Optional. On the Transcoding Template Groups page, click Set as Default in the Actions column to set the template group as the default template group.
After you specify a default template group, newly uploaded videos are transcoded based on this transcoding template group.
Create a Narrowband HDTM 1.0 transcoding template group
You can use Narrowband HDTM 1.0 transcoding to export videos only in the HLS or MP4 format.
Log on to the ApsaraVideo VOD console.
In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups.
In the top navigation bar, select the desired region from the drop-down list next to the Workbench button.
On the Transcoding Template Groups page, click Create Transcoding Template Group.
In the Regular Transcoding Template section, click Add Template and configure the parameters related to Narrowband HDTM 1.0 transcoding.
Encapsulation Format: You can select only hls or mp4.
Definition: You can select only definitions related to Narrowband HD™ 1.0.
Keep the default settings for other parameters or modify the configurations based on your business requirements. For more information about the parameters and recommended configurations, see Configure regular transcoding templates.
Click Save.
Create an adaptive bitrate streaming transcoding template group
Log on to the ApsaraVideo VOD console.
In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups.
In the top navigation bar, select the desired region from the drop-down list next to the Workbench button.
On the Transcoding Template Groups page, click Create Transcoding Template Group.
In the Video Packaging Template section, click Add Template and configure the parameters.
Encapsulation Format: select hls.
Definition: Select a desired definition for regular transcoding, audio transcoding, container format conversion, or Narrowband HD™ 1.0 transcoding.
Bandwidth Threshold: The bandwidth threshold that is used by the player to determine the stream to be played based on the current network bandwidth. Unit: bit/s. We recommend that you use the recommended value.
Keep the default settings for other parameters or modify the configurations based on your business requirements. For more information about the parameters and recommended configurations, see Configure regular transcoding templates.
Click Save.
Use the ApsaraVideo VOD API
Call the AddTranscodeTemplateGroup operation to create different types of transcoding template groups.
Call the
TranscodeTemplate
operation and use theType
parameter to specify the type of the transcoding template group, such as regular transcoding or video packaging transcoding.Call the
TranscodeTemplate
operation and use theDefinition
parameter to specify the definition of transcoded videos. You can specify a definition for regular transcoding, audio transcoding, container format conversion, or Narrowband HD™ 1.0 transcoding.
Manage transcoding template groups
After you create a transcoding template group, you can view, edit, or delete the transcoding template group, or specify the transcoding template group as the default transcoding template group. You cannot view, modify, or delete the No Transcoding template group.
The changes to transcoding settings apply only to newly uploaded videos.
Use the ApsaraVideo VOD console
On the Transcoding Template Groups page, you can click View and Edit to view and modify the configurations of a transcoding template group. You can also click Delete to delete a transcoding template group that you no longer need.
API
Use transcoding template groups
You can trigger transcoding jobs when you upload and process media files. You can specify a transcoding template group when you create a transcoding job. Alternatively, you can add a transcoding template group to a workflow and use the workflow to transcode media files. For more information, see the following topics: