Transcoding templates

更新时间:
复制 MD 格式

ApsaraVideo VOD simplifies complex transcoding parameters into transcoding templates. You can use these templates to streamline transcoding tasks in jobs and workflows. Each transcoding template has a unique ID, and a transcoding template group can contain multiple templates. This topic describes how to create and use different types of transcoding templates.

Transcoding template types

Transcoding involves complex parameters. To simplify parameter management, you can save these complex configurations as transcoding templates. You can define your own templates, which are collections of parameters for audio, video, and containers, to meet custom transcoding needs. A transcoding template group can produce multiple output streams. ApsaraVideo VOD also provides recommended parameter values based on video definition and audio quality to help you get started quickly.

Type

Source

Use case

Description

Audio/video transcoding template

User-defined

  • Standard transcoding

  • Audio transcoding

  • Container format conversion

  • Narrowband HD™ transcoding

  • Currently, Narrowband HD™ 1.0 supports transcoding outputs only in HLS and MP4 formats.

  • Currently, Narrowband HD™ 2.0 supports transcoding outputs only in MP4 format.

Audio/video packaging template

User-defined

Adaptive bitrate (ABR) streaming

Currently, ABR streaming supports transcoding outputs only in HLS (.m3u8+ts) format.

Subtitle packaging template

User-defined

Multi-subtitle packaging transcoding

  • A subtitle packaging template cannot be created or used independently. It must be used with a video packaging template.

  • Only VTT format is supported for subtitle files.

No-transcoding template

System-built-in

Distribution without transcoding

The source video must play correctly and be 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 uncertain about their encoding formats, we recommend transcoding them before playback. Note that WebM files, primarily encoded with VP8 or VP9, require a compatible playback client.

Notes

  • Transcoding is billed based on the resolution specified in the transcoding template, which may differ from the actual billing specifications. For details on billing specifications, see Basic service billing.

  • After you activate ApsaraVideo VOD, the built-in No Transcoding transcoding template group is used by default. This template group cannot be edited or deleted. If you use the No Transcoding transcoding template group to process source videos in MP4, FLV, M3U8, MP3, or WEBM format, the URLs of the transcoded videos are marked as Original and can be played directly. If the source video is not in one of these formats, the URL is marked as Original and cannot be played directly.

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

Limits

Each user can create up to 20 transcoding template groups per region. A transcoding template group can contain up to 10 standard transcoding templates, 10 video packaging templates, and 1 subtitle packaging template.

Create a transcoding template group

Important

When you start a transcoding job, each template in a transcoding template group generates a video file, consuming storage and incurring transcoding fees. To avoid unnecessary costs, create only the templates you need.

Create using the console

Standard 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, click the region dropdown list next to Workbench and select your target region.

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

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

    Note

    For details about specific parameters, see Create a transcoding template.

    No.

    Category

    Parameter

    Description

    1

    Basic information

    Transcoding type

    • Standard Transcoding, Audio Transcoding, Container Format Conversion, Narrowband HD™ 1.0, 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 select Original (Container Format Conversion) for Definition, the video retains its original quality and bitrate, and only the container format is updated. This is suitable for scenarios where you do not need to adjust the video size or bitrate.

    • Audio quality options: Standard Quality, High Quality.

    Container format

    • Supported video formats: HLS, MP4, FLV.

    • Supported audio formats: MP3, AAC.

    For more information about each container format, see Basic concepts.

    2

    Video parameters

    Disable video

    If you enable this option, the output stream will not contain video. This is useful for extracting an audio-only track for scenarios like radio broadcasts.

    Encoding format

    H.264 and H.265 are supported.

    Resolution

    • Preset resolutions: LD, SD, HD, UHD, 2K, 4K (Width: 640–3840, Height: Auto)

    • Set by the long and short sides of the video or by device width and height. The values for width and height must be between 128 and 4096 (px).

    • For adaptive aspect ratio, you can set only the width or the height.

    Bitrate

    The bitrate value must be between 10 and 50,000 (Kbps). Bitrate is used to control definition. We recommend that you use the recommended bitrates 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 include 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.

    Video watermark

    This option adds a visible image or text watermark during transcoding. To use it, you must first add the material and enable the watermark in the settings. For more information, see Video watermarks.

    Digital watermark

    Adds a digital watermark that is imperceptible to the human eye during transcoding. If a video with a digital watermark is pirated, it can be traced to enhance video security. For more information, see Digital Watermarks.

    Note

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

    3

    Advanced parameters (available when the container format is HLS or MP4)

    Fragment length

    The duration of each TS segment. We recommend that you use the recommended setting.

    Video encryption

    You can set encryption for the HLS format. After you enable encryption, you must use a version of the ApsaraVideo Player SDK that supports decryption for playback. This service is free 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

    If enabled, the transcoded output stream will not contain audio. You can select this option to output a silent video.

    Encoding format

    For HLS and MP4 container formats, AAC and MP3 are supported. For the MP3 container format, only MP3 is supported.

    Sample rate

    We recommend that you use the recommended setting.

    Bitrate

    The audio bitrate value must be between 8 and 1,000 (Kbps). We recommend that you use the recommended setting.

    Audio channels

    We recommend that you use the recommended setting.

  6. After you finish configuring the parameters, click Save.

  7. Optional: On the Transcoding Template Group list page, click Set as Default to set the default template group.

    After you set a default template group, newly uploaded videos will be transcoded according to 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, click the region dropdown list next to Workbench and select your target region.

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

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

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

    • Definition: Supports Standard Quality and High Quality.

    • Keep the default values for other parameters or change them based on your needs. For parameter explanations and configuration suggestions, see Create a standard transcoding template group.

  1. After you finish configuring 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, click the region dropdown list next to Workbench and select your target region.

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

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

    • Container Format: For video, HLS, MP4, FLV, and Dash are supported.

    • Definition: Retain source parameters.

    • Keep the default values for other parameters or change them based on your needs. For parameter explanations and configuration suggestions, see Create a standard transcoding template group.

  6. After you finish configuring the parameters, click Save.

Narrowband HD™ 1.0

Note

Currently, Narrowband HD™ 1.0 supports transcoding outputs only in HLS and MP4 formats.

  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, click the region dropdown list next to Workbench and select your target region.

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

  5. In the Audio/Video Transcoding Template area, click Add Template and configure the parameters for Narrowband HD™ 1.0 transcoding.

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

    • Scenario Type: Only Short Play and General are supported.

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

    • You can keep the default values for other parameters or adjust them as needed. For more details, see Create a standard transcoding template group. Configure the following key parameters: In the Video Parameters section, set Encoding Format to H.264 and Bitrate to 500 Kbps. For Preset Resolution, choose one of the nine available options. Keep Frame rate as Same as Source and leave video watermark disabled. In Advanced Parameters, ensure proprietary encryption is disabled. In Audio Parameters, set Encoding Format to AAC and Bitrate to 64 Kbps. Click Save when you are finished.

  6. After you finish configuring the parameters, click Save.

Narrowband HD™ 2.0

Note
  • Narrowband HD™ 2.0 is supported in all regions. For a list of regions supported by ApsaraVideo VOD, see Service regions.

  • Narrowband HD™ 2.0 supports transcoding outputs only in HLS and MP4 formats.

  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, click the region dropdown list next to Workbench and select your target region.

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

  5. In the Audio/Video Transcoding Template section, click Add Template and configure the parameters for Narrowband HD™ 2.0 transcoding.

    • Container Format: Only MP4 is supported.

    • Definition: Do not select a definition related to Narrowband HD™ 1.0.

    • You can keep the default values for other parameters or adjust them as needed. For details, see Create a standard transcoding template group. Set the Transcoding Type to Narrowband HD™ 2.0 and configure the following key parameters: In the Video Parameters section, set Encoding Format to H.264 and select a Preset Resolution such as LD, SD, HD, or UHD. Ensure the video watermark is disabled. In Advanced Parameters, ensure proprietary encryption is disabled. In Audio Parameters, set Audio Encoding to AAC and configure the audio bitrate. Click Save when you are finished.

  6. After you finish configuring the parameters, click Save.

    After the template group is created, find and record its ID from the ID column on the Transcoding Template Groups list page for later use.

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, click the region dropdown list next to Workbench and select your target region.

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

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

    • Container Format: This is fixed to HLS.

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

    • Bandwidth Threshold: Allows the player to select the appropriate stream based on the current network bandwidth. Unit: bps. We recommend that you use the recommended setting.

    • Keep the default values for other parameters or change them based on your needs. For parameter explanations and configuration suggestions, see Create a standard transcoding template group.

  6. Optional: In the Subtitle Packaging Template section, click Add Template and configure the subtitle packaging template parameters.

    Note

    Only one set of subtitles is supported for each language type.

    Parameter

    Description

    Packaging type

    ApsaraVideo VOD currently supports only HLS packaging, so this is fixed to HLS Packaging.

    Language

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

    Subtitle stream name

    • The name of the subtitle displayed in the player. Only Chinese characters, English letters, numbers, hyphens (-), and underscores (_) are supported.

    • Example: test

    Subtitle storage URL

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

    • You can upload subtitle files to the system bucket allocated by ApsaraVideo VOD by calling the CreateUploadAttachedMedia API operation.

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

    Actions

    The Delete operation is supported.

  7. After you finish configuring the parameters, click Save.

Create using API

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 standard transcoding or video packaging transcoding.

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

Manage transcoding template groups

After a transcoding template group is created, you can view, edit, delete, or set it as the default. The built-in No Transcoding template group cannot be viewed, edited, or deleted.

Note

Modifications to the transcoding format apply only to newly uploaded videos.

  • Console

    On the transcoding template group list page, you can click View to view a template group's configuration, or click Edit to modify it. If you no longer need a template group, click Remove to remove it. In the ApsaraVideo VOD console, go to the Transcoding Template Group page, which lists the name, ID, type, and available actions for each existing template group. Click Add Transcoding Template Group to create a new template group. For user-defined template groups, the supported actions are View, Edit, Set as Default, and Delete.

  • API

Use transcoding template groups

You can trigger transcoding when you upload or process media. You can either specify a transcoding template group directly to start a transcoding job or add the template group to a workflow and initiate transcoding by using a workflow that includes a media transcoding node. For more information, see the following topics: