ApsaraVideo VOD uses transcoding templates to encapsulate complex parameters. You can use a transcoding template to simplify transcoding operations when you initiate a transcoding job or use a workflow. Each transcoding template has a unique ID, and 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
ApsaraVideo VOD simplifies the management of complex transcoding parameters by saving them as transcoding templates. A transcoding template is a collection of parameters, such as audio, video, and container settings, that meet your custom transcoding needs. You can also define your own transcoding templates. A transcoding template group can contain multiple output streams. To help you get started quickly, ApsaraVideo VOD provides recommended parameter values based on video definition and audio quality.
Template type | Source | Scenarios | Usage notes |
Audio and video transcoding template | User-defined |
|
|
Audio and video packaging template | User-defined | Adaptive bitrate streaming | Adaptive bitrate streaming supports transcoding videos into only the HLS (.m3u8+ts) format. |
No transcoding template | Built-in | Distribution without transcoding | The source video must be playable and in MP4, FLV, M3U8, MP3, or WEBM format. The video encoding must be H.264 or H.265. If you have videos from multiple sources and are unsure of their encoding formats, transcode the videos before playback. WebM videos are mainly encoded in VP8 or VP9 and require a supported playback client. |
Notes
ApsaraVideo VOD charges for the transcoding service. Transcoding fees are based on the resolution set in the transcoding template. Therefore, the transcoding specifications in the template may not match the actual billing specifications. For more information about billing, see Billing for basic services.
After you activate ApsaraVideo VOD, the No Transcoding (built-in) template group is used by default. This template group cannot be edited or deleted. If you use the No Transcoding template group to transcode a source video in MP4, FLV, M3U8, MP3, or WEBM format, the transcoded video address is marked as Original and can be played directly. If the source video is not in one of these formats, the transcoded video address is marked as Original and cannot be played directly.
To prevent transcoding failures, do not edit or delete a template or template group while a transcoding job is in progress.
Limits
In each region, you can create a maximum of 20 transcoding template groups. Each transcoding template group can contain up to 10 regular transcoding templates, 10 video packaging templates.
Create a transcoding template group
When you start a transcoding job, each template in the transcoding template group generates a video file that consumes storage space and incurs transcoding fees. To avoid unnecessary storage consumption and fees, create only the transcoding templates that you need.
Create a transcoding template group in the 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.
At the top of the page, click the service region to the right of Workbench to switch to the target service region.
On the Transcoding Template Groups page, click Create Transcoding Template Group.
In the Audio and video transcoding template section, click Add Template and configure the transcoding parameters.
NoteFor more information about the parameters, see Create a transcoding template.

No.
Parameter category
Parameter Name
Description
①
Basic information
Transcoding type
Regular transcoding, Audio transcoding, Container format conversion, Narrowband HD 1.0, and Narrowband HD 2.0.
Note
For more information about definitions related to Narrowband HD 1.0, such as SD-Narrowband HD 1.0, see Narrowband HD transcoding.
If you set Definition to Original Quality (Container Format Conversion), the video retains its original definition and bitrate. Only the container format of the video file is updated. This is suitable for scenarios where you do not need to adjust the video size or bitrate.
Audio quality: Normal quality, High quality.
Container format
For video: HLS, MP4, FLV.
For audio: MP3, AAC.
For more information about each container format, see Terms.
②
Video parameters
Disable video
If you disable video, the output stream does not contain video. This is often used to extract an audio-only stream, such as for a radio station.
Encoding format
H.264 and H.265 are supported.
Resolution
Preset resolutions: LD, SD, HD, FHD, 2K, 4K (width from 640 to 3840, height is adaptive).
Set by long and short sides or by width and height. The width and height can range from 128 to 4096 pixels.
For an adaptive aspect ratio, set only the width or the height.
Bitrate
The bitrate can range from 10 to 50,000 Kbps. It is used to control the definition. We recommend that you use the recommended bitrates in the table below for each definition.
Frame rate
The number of frames displayed per second. We recommend that you use the recommended setting.
Custom frame rate: 0 to 60 fps. Common values are 24, 25, and 30.
Maximum keyframe interval
The number of frames in a group of pictures (GOP). We recommend that you use the recommended setting.
Image and text watermark
Adds a visible image or text watermark during transcoding. To use this feature, you must add the watermark material and enable watermarking in the watermark settings. For more information, see Image and text watermarks.
③
Advanced parameters (available when the container format is HLS or MP4)
Segment duration
The duration of each TS segment. We recommend that you use the recommended setting.
Video encryption
You can encrypt HLS streams. After you enable encryption, you must use a version of the ApsaraVideo Player SDK that supports decryption to play the video. This service is free during the trial period.
Note
This configures private encryption. To use standard encryption, see HLS encryption.
④
Audio parameters
Disable audio
If you disable audio, the output stream does not contain audio. Select this option if you want to output a silent video.
Encoding format
HLS and MP4 container formats support AAC and MP3. The MP3 container format supports MP3.
Sample rate
We recommend that you use the recommended setting.
Bitrate
The audio bitrate can range from 8 to 1,000 Kbps. We recommend that you use the recommended setting.
The number of sound channels
We recommend that you use the recommended setting.
After you configure the parameters, click Save.
Optional: On the list of transcoding template groups, click Set as Default to specify the default group.
After you set a default template group, newly uploaded videos are transcoded using 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.
At the top of the page, click the service region to the right of Workbench to switch to your target region.
On the Transcoding Template Groups page, click Create Transcoding Template Group.
In the Audio and video transcoding template section, click Add Template, select Audio transcoding, and configure the parameters.
Container format: You can select only AAC or mp3.
Definition: You can select Normal quality or High quality.
Keep the default values for other parameters or change them as needed. For more information about the parameters and recommended settings, see Create a regular transcoding template group.

After you configure the parameters, 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.
At the top of the page, click the service region to the right of Workbench to switch to the target service region.
On the Transcoding Template Groups page, click Create Transcoding Template Group.
In the Audio and video transcoding template section, click Add Template, select Container format conversion, and configure the parameters.
Container format: For video, you can select HLS, MP4, FLV, or Dash.
Definition: The parameters of the source video are used.
Keep the default values for other parameters or change them as needed. For more information about the parameters and recommended settings, see Create a regular transcoding template group.

After you configure the parameters, click Save.
Create a Narrowband HD 1.0 transcoding template group
Narrowband HD™ 1.0 supports transcoding to only the HLS and MP4 formats.
Log on to the ApsaraVideo VOD console.
In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups.
At the top of the page, click the service region to the right of Workbench to switch to the target service region.
On the Transcoding Template Groups page, click Create Transcoding Template Group.
In the Audio and video transcoding template section, click Add Template to configure the parameters for Narrowband HD™ 1.0 transcoding.
Container format: You can select only HLS or MP4.
Scenario type: You can select only Short Play or General.
Definition: Select a definition related to Narrowband HD 1.0.
Keep the default values for other parameters or change them as needed. For more information about the parameters and recommended settings, see Create a regular transcoding template group.

After you configure the parameters, 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.
At the top of the page, click the service region to the right of Workbench to switch to your target region.
On the Transcoding Template Groups page, click Create Transcoding Template Group.
In the Audio and video packaging template section, click Add Template to configure the video packaging parameters.
Container format: The format is fixed to HLS.
Definition: Select an appropriate definition. Regular transcoding, container format conversion, and Narrowband HD 1.0 are supported.
Bandwidth threshold: This threshold allows the player to select a stream for playback based on the current network bandwidth. The unit is bits per second (bps). We recommend that you use the recommended value.
Keep the default values for other parameters or change them as needed. For more information about the parameters and recommended settings, see Create a regular transcoding template group.
After you configure the parameters, click Save.
Create a transcoding template group using OpenAPI
You can call the AddTranscodeTemplateGroup operation to create transcoding template groups of different types.
Use the
Typeparameter ofTranscodeTemplateto specify the type of the transcoding template group, such as regular transcoding or video packaging.Use the
Definitionparameter ofTranscodeTemplateto specify the output definition, such as definitions for regular video transcoding, audio transcoding, container format conversion, or Narrowband HD 1.0.
Manage transcoding template groups
After you create a transcoding template group, you can view, edit, delete, or set it as the default group. However, the built-in No Transcoding template group cannot be viewed, edited, or deleted.
Changes to a transcoding template apply only to newly uploaded videos.
Console
On the transcoding template group page, you can click View to see the group's configuration, or click Edit to modify it. If you no longer need a template group, you can click Remove to delete it.

API
Use transcoding template groups
In ApsaraVideo VOD, you can trigger transcoding when you upload and process media. You can start a transcoding job by directly specifying a transcoding template group. You can also add a transcoding template group to a workflow and start a transcoding job using a workflow that includes a media transcoding node. For more information, see the following topics: