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 complicated parameter management, ApsaraVideo VOD allows you to save complex parameter configurations 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 (ABR) streaming | You can use ABR streaming to export videos only in the HLS format, which are M3U8 playlists that consist of TS segments. |
No Transcoding | Built-in | Distribution without transcoding | When you use the No Transcoding template group, make sure that the source files are in the MP4, Flash Video (FLV), M3U8, MP3, or WebM formats and can be directly played. For a video, the codec must be H.264 or H.265. If you have videos from multiple sources and are uncertain about their codecs, we recommend that you transcode the videos before you play them. Take note that WebM videos are encoded in VP8 or VP9 and require a corresponding playback client. |
Usage notes
You are charged based on the transcoding specifications that you configured 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 group 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 job, the video is transcoded based on all transcoding templates in the transcoding template group. In this case, you are charged for all transcoded video files. To prevent unnecessary costs, add transcoding templates based on your business requirements.
ApsaraVideo VOD transcoding template groups have been upgraded and are in a grayscale release. If you find that your current version does not match the documentation, it may not have been updated. Submit a ticket so that we can help you switch to the latest version.
Use the ApsaraVideo VOD console
Regular transcoding
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.
NoteFor more information about the parameters, see Create a transcoding template.
No.
Category
Parameter
Description
1
Basic Parameters
Transcoding Type
Valid values: Regular Transcoding, Audio Transcoding, Container Format Conversion, Narrowband HD™ 1.0, and Narrowband HD™ 2.0. In this section of the topic, set the value to Regular Transcoding.
Note
For detailed information about specifications of Narrowband HD™ 1.0, such as SD-Narrowband HD™ 1.0, see Narrowband HD™ transcoding.
If you set Definition to Original, the original definition and bitrate of videos are retained. Only the container format of videos is modified. This is suitable for scenarios in which you do not need to change the size or bitrate of videos.
For audio, the audio quality can be Standard Quality or High Quality.
Encapsulation Format
Valid values for videos: HLS, MP4, and FLV.
Valid values for audio: MP3 and AAC.
For more information about each container format, see Terms.
2
Video Parameters
Disable Video
If you select Disable Video, the transcoded output 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.
Resolution
Preset Resolution: LD, SD, HD, Ultra HD, 2K, and 4K. The width is 640 to 3,480 pixels, and the height is adapted to the width.
If you select Set by Long and Short Sides or Set by Width and Height, enter corresponding values from 128 to 4,096 pixels.
If you want the screen to be automatically adapted, specify only one of the two values.
Video Bitrate
Valid values: 600 (for H.264) and 300 (for H.265). Unit: Kbit/s.
Frame Rate
The number of frames displayed per second. We recommend that you use the recommended value.
Valid values: 0 to 60. Frame rates of 24 FPS, 25 FPS, and 30 FPS are commonly used.
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 configure and enable a watermark template. For more information, see Video watermarks.
3
Audio Parameters
Disable Audio
If you select Disable Audio, the transcoded output does not contain audio information. If you want to generate a video 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.
Note
The 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 input video is lower than the resolution that is specified in the transcoding template.
Video Bit Rate Check
Checks whether the bitrate of the input video is lower than the video bitrate that is specified in the transcoding template.
Audio Bit Rate Check
Checks whether the bitrate of the input audio is lower than the audio bitrate that is specified in the transcoding template.
Click Save.
Optional. On the Transcoding Template Groups page, find the created transcoding template group and click Set as Default in the Actions column to set it as the default transcoding template group.
After you specify a default template group, newly uploaded videos are transcoded based on this transcoding template group.
Audio transcoding
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. Set Transcoding Type to Audio Transcoding and configure the following parameters.
Encapsulation Format: Select AAC or MP3.
Definition: Select Standard Quality or High Quality.
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.
Container format conversion
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. Set Transcoding Type to Container Format Conversion and configure the following parameters.
Encapsulation Format: Select HLS, MP4, FLV, or DASH.
Definition: Keep the original quality settings.
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.
Narrowband HD™ 1.0 transcoding
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. Set Transcoding Type to Narrowband HDTM 1.0 and configure the following parameters.
Encapsulation Format: Select HLS or MP4.
Scenario Type: Select Mini Dramas or Common Scenarios.
Definition: Select 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.
ABR streaming
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 following 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: Specify a bandwidth threshold. The player can determine which bitstream to play by comparing the actual network bandwidth with the bandwidth threshold. 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.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, click View or Edit to view or modify the configurations of a transcoding template group. Click Delete to delete a transcoding template group that you no longer need.
Use the ApsaraVideo VOD 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: