Transcoding templates

更新时间:
复制 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.

Transcoding template types

ApsaraVideo VOD saves complex transcoding parameter sets as transcoding templates. You can define custom 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.

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.

Subtitle packaging template

User-defined

Multiple subtitle packaging

  • A subtitle packaging template cannot be used independently and must be paired with an audio and video packaging template.

  • Only the VTT format is supported for subtitle files.

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 are primarily encoded using VP8 or VP9 and require a compatible playback client.

Usage notes

  • Transcoding in ApsaraVideo VOD is a billable service. Billing is based on the resolution configured in the transcoding template, so the tier in the 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, and 1 subtitle packaging template.

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

    Extracts 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 ranges from 10 to 50,000 Kbps. This value controls the definition. We recommend that you use 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, first add the watermark material in the watermark settings and enable the feature. For more information, see Video watermark.

    Digital watermark

    Adds an imperceptible digital watermark during transcoding to help trace the source of pirated videos. For more information, see Digital watermark.

    Note

    This feature is available only in the China (Shanghai) and China (Beijing) regions.

    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. Encrypted videos require 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 produce 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 ranges 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.

Narrowband HD™ 2.0

Note
  • Narrowband HD 2.0 is supported in all regions where ApsaraVideo VOD is available. For more information, see Regions and endpoints.

  • Narrowband HD 2.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™ 2.0 transcoding parameters.

    • Container Format: Only MP4 is supported.

    • Definition: Do not 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. On the Add Transcoding Template Group page, set Transcoding type to Narrowband HD™ 2.0. For Video parameters, set Encoding format to H.264, select a Preset resolution such as LD (640), SD (848), HD (1280), or UHD (1920), and set the video bitrate and 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 specify the audio bitrate. After you complete the configuration, click Save.

  6. After you configure the parameters, click Save.

    After the template group is created, find its ID on the Transcoding Template Groups page. In the ID column, record the ID of the new template group. You need this ID for subsequent configurations.

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 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. Optional: In the Subtitle Packaging Template section, click Add Template and configure the subtitle packaging template parameters.

    Note

    You can add only one set of subtitles for each language type.

    Parameter

    Description

    Packaging type

    ApsaraVideo VOD supports only HLS packaging. This parameter is set to HLS Packaging.

    Language type

    The language of the subtitles. Examples: cn (Chinese), ja (Japanese), and en-US (English).

    Subtitle stream name

    • The name of the subtitle stream displayed on the player. The name can contain only Chinese characters, letters, digits, hyphens (-), and underscores (_).

    • Example: test

    Subtitle storage address

    • The full OSS URL of the subtitle file. The subtitle file must be stored in the system bucket allocated by ApsaraVideo VOD. CDN domain names and HTTPS URLs are not supported.

    • You can call the CreateUploadAttachedMedia operation to upload the subtitle file to the system bucket allocated by ApsaraVideo VOD.

    • Example: http://example-bucket-****.oss-cn-shanghai.aliyuncs.com/subtitles/4dba87c2-a787-42cd-8328-2369aeb8****-cn.vtt

    Actions

    You can perform the Delete action.

  7. 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 by specifying a transcoding template group for the task or adding the group to a media transcoding node in a workflow.