All Products
Search
Document Center

ApsaraVideo Media Processing:Create a transcoding template

Last Updated:Apr 09, 2026

If the preset templates in ApsaraVideo Media Processing (MPS) do not meet your needs, create a custom transcoding template to configure parameters such as encoding format, frame rate, and resolution.

Limitations

By default, you can create up to 10 transcoding templates per Alibaba Cloud account in each region. This quota applies to custom templates. To increase this limit, contact Alibaba Cloud support.

Use the console

  1. Log on to the ApsaraVideo Media Processing (MPS) console and select a region in the top navigation bar.

  2. In the left-side navigation pane, choose Template management > Transcoding templates. Then, click the Customize Template tab.

  3. Click Add template.

  4. Configure the transcoding template parameters in the Basic Parameters, Video Parameters, and Audio Parameters sections.

    1. Basic Parameters

      Parameter

      Description

      Template Name

      Enter a name for the transcoding template. The name can contain Chinese characters, letters, digits, and hyphens (-). It cannot start with a special character and must be no more than 128 bytes in length.

      Transcoding type

      Select the transcoding type.

      Note

      This is useful for extracting an audio track from a video or transcoding an audio file.

      Encapsulation Format

      Select the container format for the output file.

    2. Video Parameters

      Note

      If your input file is in High Dynamic Range (HDR) and you want to convert it to Standard Dynamic Range (SDR), contact Alibaba Cloud support to configure adaptive tone mapping. This prevents overexposure or underexposure in the output.

      Parameter

      Description

      Encoding Format

      Select the video encoding format.

      Bitrate control

      1. Select a mode to control the video bitrate. Supported modes: Same as Source, Fixed Bitrate, Average Bitrate, and CRF.

      Note

      Bitrate control determines how the output bitrate is managed during the encoding process:

      • Same as Source: The output bitrate matches the input bitrate.

      • Fixed bitrate: Uses a constant bitrate for the entire file, regardless of scene complexity. This mode may result in larger file sizes.

      • Average bitrate: The output maintains a specified average bitrate over the duration of the file. The encoder allocates more bits to complex scenes and fewer to simple scenes. This mode balances quality and file size predictability.

      • CRF: This mode targets a constant video quality level. You specify this level with a Constant Rate Factor (CRF) value from 0 (lossless) to 51 (worst quality). The output bitrate fluctuates based on scene complexity and is not predictable.

      1. Configure the related bitrate parameters.

      (Optional) Peak Bit Rate

      The maximum instantaneous bitrate in Kbps. The value must be an integer in the range [10, 50,000].

      (Optional) Bitrate check

      The action to take if the input video bitrate is lower than the target bitrate.

      Supported modes: Transcode at source bitrate, Transcode at specified bitrate (upsampling), and Do not transcode.

      Resolution

      1. Select a mode to set the output resolution. Supported modes: Same as source, Set by long and short sides, and Set by width and height.

      2. Specify the video dimensions. The values must be even integers in the range [128, 4,096].

      (Optional) Resolution check

      The action to take if the input resolution is lower than the target resolution.

      Supported modes: Transcode at source resolution, Transcode at specified resolution, and Do not transcode.

      Frame Rate

      Select whether to use the input video's frame rate or specify a custom frame rate.

      If you select a custom frame rate, enter a value in the range of (0, 60]. Unit: fps. Common values include 23.976, 24, 25, and 30.

      Note

      If the input frame rate is higher than 60 fps, the output is capped at 60 fps.

      (Optional) Fragment Length

      The duration of each segment. The value must be an integer in the range of [1, 60]. Unit: seconds. If left empty, the default value is 10.

      Note

      A segment must contain at least one keyframe. For best results, set the segment duration to a multiple of the GOP duration. If the duration is shorter than the GOP duration or not a multiple, the service automatically adjusts the keyframe interval.

      (Optional) GOP

      The Group of Pictures (GOP) size. You can define the size by setting either the maximum time interval or the maximum number of frames between keyframes.

      The value must be an integer in the range [1, 100,000]. For streaming, a value in the range of 2 to 7 seconds is recommended.

      Note

      A larger GOP size increases the compression ratio but also increases encoding time, segment duration, and seek response time in players.

      (Optional) Encoding Level

      This parameter is available only for the H.264 codec. Supported profiles: high, main, and baseline.

      When creating multiple outputs for adaptive bitrate streaming, use the baseline profile for the lowest resolution to ensure compatibility with older devices. For other resolutions, use the main or high profile.

      (Optional) Buffer

      The size of the video buffer in kb. The value must be in the range [1,000, 128,000], and the default is 6,000.

      Note

      The buffer size (also known as bufsize) controls bitrate fluctuation. A larger buffer size allows for greater bitrate variation, which can improve quality.

      (Optional) Scan Mode

      The scan mode for the output. Supported modes are Same as source, Deinterlace, Interlaced, and Progressive. The default is Same as source.

      (Optional) Color format

      Select the color format. By default, the input video's format is used.

    3. Audio Parameters

      Parameter

      Description

      (Optional) Disable audio

      If you select Disable audio, the audio parameters below become unavailable.

      The output file will not contain an audio stream or related media information. This is useful when you need to extract only the video stream.

      Encoding Format

      Select the audio encoding format. The default is AAC.

      Note

      If the container format is HLS and the video encoding format is H.264, you must select AAC as the audio encoding format to ensure playback compatibility.

      Encoding Level

      This parameter is available when the audio encoding format is AAC.

      • For multi-channel audio sources, such as 5.1 or 7.1 surround sound, set this parameter to aac_low.

      • For playback on general-purpose devices, use aac_he. It can reduce the audio bitrate by up to 50% compared to aac_low while maintaining similar audio quality. A typical low bitrate is 64 Kbps.

      • For high-end playback devices, use aac_he_v2. It offers better quality at smaller file sizes. Typical low bitrates range from 32 Kbps to 48 Kbps.

      Sample Rate

      Select the sample rate in Hz. The default is 44,100.

      The supported sample rates vary depending on the container format and encoding format. For more information, see Supported sample rates.

      Audio bitrate

      Select whether to use the input video's audio bitrate or specify an average bitrate.

      If you select average bitrate, enter an integer from 8 to 1,000 Kbps. The default value is 128. Common values are 64, 128, and 256.

      Audio Channels

      Select the number of audio channels. You can choose to keep the original number of channels. The default value is 2.

      Volume normalization

      When enabled, this feature adjusts the volume of the output file to a consistent level. This avoids significant volume differences between files. This setting is only available for single-stream audio outputs.

  5. Click Submit to create the transcoding template.

Use SDKs

SDK

References

Java SDK

Transcoding templates

Go SDK

Transcoding templates

Use the API

For API instructions, see AddTemplate - Add a custom transcoding template.

Next steps