Transcoding templates

Updated at:
Copy as MD

ApsaraVideo VOD simplifies complex transcoding parameters into transcoding templates. You can use these templates to streamline transcoding operations when you initiate transcoding tasks or use a workflow. Each transcoding template has a unique ID, and a transcoding template group can contain multiple templates. This topic describes how to create and use various types of transcoding templates.

Transcoding template types

Transcoding parameters are complex. To help you avoid complicated parameter management, ApsaraVideo VOD saves these parameter sets as transcoding templates. You can define custom transcoding templates—collections of parameters for audio, video, and container formats—to meet specific transcoding needs. A transcoding template group can include multiple output streams. ApsaraVideo VOD also provides recommended parameter values for different video definitions and audio quality levels to help you get started quickly.

Template type

Source

Use cases

Description

Audio and Video Transcoding Template

User-defined

  • Regular Transcoding

  • Audio Transcoding

  • Container Format Conversion

  • Narrowband HD™ transcoding

  • Narrowband HD™ supports transcoding videos to the HLS and MP4 container formats only.

  • Currently, Narrowband HD™ 2.0 supports transcoding videos to the MP4 container format only.

Audio and Video Packaging Template

User-defined

adaptive bitrate streaming

Adaptive bitrate streaming supports transcoding videos to the HLS (.m3u8+ts) container format only.

No Transcoding template

System-defined

Distribution without transcoding

The source video must be playable and in MP4, FLV, M3U8, MP3, or WEBM format. The video codec must be H.264 or H.265. If you have videos from multiple sources and are unsure about their codecs, transcode them before playback. WebM videos, which are primarily encoded by using VP8 or VP9, require a compatible playback client.

Usage notes

  • Transcoding in ApsaraVideo VOD is a billable service. Transcoding billing is based on the resolution that you configure in the transcoding template. As a result, the tier in the transcoding template may differ from the actual billing tier. For more information, see Basic service billing.

  • 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 submit transcoding jobs and the source video is in MP4, FLV, M3U8, MP3, or WEBM format, the transcoded video URL is labeled Original and can be played directly. If the source video is not in one of these formats, the transcoded video URL is labeled Original and cannot be played directly.

  • To prevent transcoding failures, do not edit or delete a template or template group while a transcoding task is in progress.

Limitations

Each user can create up to 20 transcoding template groups in each region. A transcoding template group can contain up to 10 regular transcoding templates, 10 audio and video packaging templates,.

Create a transcoding template group

Important

When you initiate a transcoding task, each template in the specified transcoding template group generates a video file. This consumes storage space and incurs transcoding fees. To avoid unnecessary costs and storage usage, create only the transcoding templates that you need.

By console

Regular transcoding

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups.

  3. In the top navigation bar, select the target region from the drop-down list next to Workbench.

  4. On the Transcoding Template Groups page, click Create Transcoding Template Group.

  5. In the Audio and Video Transcoding Template section, click Add Template and configure the transcoding parameters.

    No.

    Category

    Parameter

    Description

    1

    Basics

    Transcoding type

    • Valid values: 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 Narrowband HD™ 1.0 and SD-Narrowband HD™ 1.0, see Narrowband HD™ transcoding.

    • If you select the definition Original Quality (Remuxing), the video retains its original definition and bitrate. Only the container format of the video is changed. This is suitable for scenarios in which you do not need to change the video size or bitrate.

    • Sound Quality: Standard Quality or High Quality.

    Container format

    • Supported video formats: HLS, MP4, and FLV.

    • Supported audio formats: MP3 and AAC.

    For more information about container formats, see Key concepts.

    2

    Video parameters

    Disable video

    Use this option to extract an audio-only stream, for example, for radio applications.

    Encoding format

    H.264 and H.265 are supported.

    Resolution

    • Preset Resolution: LD, SD, HD, UHD, 2K, and 4K (width from 640 to 3840 pixels, height is adaptive).

    • You can set the resolution by the long and short sides of the video or by the width and height of the device. The width and height can range from 128 to 4,096 pixels.

    • To enable adaptive aspect ratio, set only the width or the height.

    Bitrate

    The bitrate can range from 10 to 50,000 Kbps. This value controls the definition. We recommend using the recommended bitrates for each definition.

    Frame rate

    • The number of frames displayed per second. The default setting is recommended.

    • 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). The default setting is recommended.

    Image/text watermark

    Adds a visible image or text watermark during transcoding. To apply a watermark, you must add the watermark material in the watermark settings and enable the feature. For more information, see Video watermark.

    3

    Advanced parameters (available only when Container Format is HLS or MP4)

    Fragment length

    The duration of each TS segment. The default setting is recommended.

    Video encryption

    You can encrypt HLS videos. To play encrypted videos, you must use an official Alibaba Cloud player SDK that supports decryption. This service is free of charge during the trial period.

    Note

    The encryption configured here is proprietary encryption. To use standard encryption, see HLS standard encryption.

    4

    Audio parameters

    Disable audio

    Select this option to remove the audio stream and create a silent video.

    Encoding format

    AAC and MP3 are supported for the HLS and MP4 container formats. Only MP3 is supported for the MP3 container format.

    Sample rate

    The default setting is recommended.

    Audio bitrate

    The audio bitrate can range from 8 to 1,000 Kbps. The default setting is recommended.

    Audio channels

    The default setting is recommended.

  6. After you configure the parameters, click Save.

  7. Optional: On the Transcoding Template Groups page, click Set as Default for a template group to set it as the default.

    After you set a default template group, all newly uploaded videos will be transcoded using this template group.

Audio transcoding

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups.

  3. In the top navigation bar, select the target region from the drop-down list next to Workbench.

  4. On the Transcoding Template Groups page, click Create Transcoding Template Group.

  5. In the Audio and Video Transcoding Template section, click Add Template, select Audio Transcoding, and configure the relevant parameters.

    • Container Format: You can select only AAC or mp3.

    • Sound Quality: Standard Quality and High Quality are supported.

    • Keep the default values for other parameters or change them based on your business requirements. For parameter descriptions and recommended settings, see Create a regular transcoding template group.

  6. After you configure the parameters, click Save.

Container format conversion

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups.

  3. In the top navigation bar, select the target region from the drop-down list next to Workbench.

  4. On the Transcoding Template Groups page, click Create Transcoding Template Group.

  5. In the Audio and Video Transcoding Template section, click Add Template, select Container Format Conversion, and configure the relevant parameters.

    • Container Format: Supported video formats are HLS, MP4, FLV, and Dash.

    • Definition: Retains the parameters of the source video.

    • Keep the default values for other parameters or change them based on your business requirements. For parameter descriptions and recommended settings, see Create a regular transcoding template group.

  6. After you configure the parameters, click Save.

Narrowband HD™ 1.0

Note

Narrowband HD 1.0 supports transcoding output in the HLS and MP4 container formats only.

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups.

  3. In the top navigation bar, select the target region from the drop-down list next to Workbench.

  4. On the Transcoding Template Groups page, click Create Transcoding Template Group.

  5. In the Audio and Video Transcoding Template section, click Add Template and configure the Narrowband HD 1.0 transcoding parameters.

    • Container Format: You can select only HLS or MP4.

    • Scenario Type: You can select only Mini Dramas or Common Scenarios.

    • Definition: Select a definition related to Narrowband HD™ 1.0.

    • Keep the default values for other parameters or change them based on your business requirements. For parameter descriptions and recommended settings, see Create a regular transcoding template group. For Video parameters, set Encoding format to H.264, select one of the nine options for Preset resolution (such as SD, HD, or UHD for the best overall effect), set bitrate to 500 Kbps, and keep the original video frame rate. The Image/text watermark feature is disabled by default. For Advanced parameters, proprietary encryption is disabled by default. For Audio parameters, set Encoding format to AAC and bitrate to 64 Kbps. After you complete the configuration, click Save.

  6. After you configure the parameters, click Save.

Adaptive bitrate streaming

  1. Log on to the ApsaraVideo VOD console.

  2. In the left-side navigation pane, choose Configuration Management > Media Processing > Transcoding Template Groups.

  3. In the top navigation bar, select the target region from the drop-down list next to Workbench.

  4. On the Transcoding Template Groups page, click Create Transcoding Template Group.

  5. In the Audio and Video Packaging Template section, click Add Template and configure the video packaging template parameters.

    • Container Format: This parameter is set to HLS.

    • Definition: Select an appropriate definition. Regular transcoding, container format conversion, Narrowband HD™ 1.0, and more are supported.

    • Bandwidth Threshold: The threshold that a player uses to select a stream based on the current network bandwidth. Unit: bps. The default setting is recommended.

    • Keep the default values for other parameters or change them based on your business requirements. For parameter descriptions and recommended settings, see Create a regular transcoding template group.

  6. After you configure the parameters, click Save.

By OpenAPI

Call the AddTranscodeTemplateGroup operation to create transcoding template groups of different types.

  • Use the Type parameter of TranscodeTemplate to specify the type of the transcoding template, such as Regular Transcoding or video packaging.

  • Use the Definition parameter of TranscodeTemplate to specify the output definition, such as definitions for regular video transcoding, audio transcoding, container format conversion, or Narrowband HD™ 1.0.

Manage template groups

After you create a transcoding template group, you can view, edit, delete, or set it as the default. The system-defined No Transcoding template group cannot be viewed, edited, or deleted.

Note

Modifications to a transcoding template group apply only to videos uploaded after the changes are saved.

Use template groups

You can trigger transcoding in ApsaraVideo VOD during media upload or processing. To do this, specify a transcoding template group for the task or add the group to a media transcoding node in a workflow. For more information, see the following topics: