All Products
Search
Document Center

Intelligent Media Services:Template management

Last Updated:Feb 18, 2025

A transcoding template is a predefined set of processing parameters that streamlines the creation of transcoding tasks. Each transcoding template is identified by a unique ID. This topic describes different types of transcoding templates and their configurations.

Transcoding templates

Standard transcoding

Video transcoding refers to the process of converting a compressed stream into another stream to adapt to different terminals and network bandwidth. Transcoding is a process in which decoding and encoding are performed. Streams before and after transcoding may use the same or different video encoding standards.

The following table describes the standard transcoding methods supported by Intelligent Media Services (IMS).

Method

Description

Scenario

Regular transcoding

Provides comprehensive video transcoding features to convert media files between multiple formats. You can choose different container formats, such as MP4, AVI, and MKV, and resolutions to adapt to various playback devices.

Formatting long video content

Audio transcoding

Provides a variety of audio processing capabilities, including converting audio file format, extracting audio streams from video files, and audio effect processing and enhancement.

Converting audio files to different formats, adjusting audio quality parameters, or extracting audio from videos to ensure playback compatibility, optimize storage, and facilitate content production

Container format conversion

Converts the container format of videos without changing the resolution or bitrate.

Maintaining the image size or bitrate of the videos

Subtitle

A subtitle template is a transcoding template that embeds subtitles into a video. This type of template ensures that subtitles are directly embedded into the video rather than being stored as an external file. This improves playback compatibility and user experience.

Watermark

IMS allows you to add watermarks to a video. During video transcoding, you can add images or text as watermarks to a video stream. Then, a new video file that has the watermarks is generated. You can add information such as enterprise or brand logos, TV station logos, and user IDs or nicknames as watermarks for video copyright declaration or brand promotion.

The following table describes the watermark types supported by IMS.

Watermark type

Description

Image watermark

You can upload a PNG or GIF image. An image watermark can be displayed in a specific position throughout a video or within a specific period of time based on the start and end time that you specify.

Text watermark

You can add one or more pieces of text as watermarks to videos. You can configure text properties such as the font, font size, color, transparency, and outline, and add different text content to different videos.

Note
  • If files are used as dynamic image watermarks, the file name extensions, such as GIF, must be in lowercase. This limit is not applied to file name extensions of files that are used as static image watermarks.

  • The files that are used as watermarks and the video to which the watermarks are added must be stored on the same origin server. For example, videos that are stored on an origin server in the Singapore region can use only watermarks that are stored on the same origin server in the Singapore region. For more information about how to add or configure storage addresses in a region, see Configure storage addresses.

Create a transcoding template

Use the IMS console

  1. Log on to the IMS console.

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

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

  4. On the Transcoding tab, create a template based on your business requirements.

    Standard transcoding template

    In the Basic Parameters section, you can specify a transcoding template name, transcoding type, and container format. Regular transcoding, audio transcoding, and container format conversion are supported. The parameters that you need to configure vary based on the transcoding type.

    image

    Regular transcoding

    Configure video parameters

    image

    Note

    The parameters that you need to configure vary based on the selected container format. The parameters in the IMS console shall prevail.

    Parameter

    Description

    Encoding Format

    Select the encoding format that you want to use. H.264 and H.265 are supported.

    Bitrate Control

    1. Bitrate control is used to determine the bitrate of the output file during video encoding. You can select a control mode from the drop-down list. The following modes are supported:

      • Bitrate of Input Video: The original video bitrate is used.

      • Fixed Bitrate: The bitrate of the output video is fixed regardless of whether a scene is complex or simple. If you select Fixed Bitrate, the size of the output video is large.

      • Average Bitrate: The average bitrate of the output video is fixed. The bitrate of each scene varies based on the complexity of the scene. More bits are allocated to complex scenes and fewer bits are allocated to simple scenes. This ensures that the bitrate of the output video is within the expected range and that bits are appropriately allocated.

      • CRF: The bitrate of the output video varies based on the quality of the output video. You can specify an integer in the range of 0 to 51 to control the quality of the output video. A value of 0 specifies a lossless output. A value of 51 specifies an output of the worst quality possible. The constant rate factor (CRF) ensures that the quality of the output video is stable. However, the bitrate of the output video varies based on the complexity of the scene and is unpredictable.

    2. Configure the parameters related to the bitrate.

    Peak Bitrate

    The maximum bitrate. Valid values: 10 to 50000. Unit: Kbit/s.

    Bitrate Check

    Optional. The transcoding method that is used if the bitrate of the input video is lower than the specified bitrate.

    Resolution

    Note

    If your input videos contain landscape and portrait videos, we recommend that you select Set by Long and Short Sides to prevent image distortion.

    The resolution determines the size of the output video. You can choose one of the following values based on your business requirements and the characteristics of the input video.

    • Resolution of Input Video: The original resolution of the input video is used.

    • Set by Long and Short Sides: The resolution is set based on the long or short side of the video. This method automatically adapts to videos in landscape and portrait modes to prevent image distortion.

    • Set by Width and Height: Specify the width and height of the output video. The horizontal side is the width and the vertical side is the height, regardless of the screen orientation.

    Resolution Check

    This parameter is required if you set the Resolution parameter to Set by Long and Short Sides or Set by Width and Height. This parameter specifies the transcoding method when the resolution of the original video is smaller than the specified resolution. Valid values:

    • Transcode Based on Resolution of Input Video: Transcoding is performed based on the actual resolution of the original video.

    • Transcode Based on Specific Resolution: Transcoding is performed based on the specified resolution.

    • Do Not Transcode: Use the original video without transcoding.

    Frame Rate

    The number of frames displayed per second. Valid values:

    • Frame Rate of Input Video: Use the frame rate of the input video. If the frame rate of the input video exceeds 60, the output is capped at 60 fps.

    • Custom Frame Rate: Specify an integer value between 0 and 60. Unit: fps. Common values: 15, 25, and 30.

    Advanced Parameters

    Segment Length

    Enter an integer. Valid values: 1 to 60. Unit: seconds.

    Note

    Each segment should contain at least one keyframe. Set the segment duration to a multiple of the group of pictures (GOP) value. If the segment duration is less than the GOP value or is not a multiple of it, the GOP value is adapted during transcoding.

    GOP

    Valid values: Maximum Time Interval between Keyframes and Maximum Number of Frames between Keyframes. Specify the maximum interval between keyframes. You must enter an integer. Valid values: 1 to 100000. Unit: seconds.

    Note

    A greater GOP value indicates a higher compression ratio, a lower encoding speed, a longer duration of a single segment, and a longer response time to seeking.

    Encoding Profile

    This parameter is required only if the Encoding Format parameter is set to H.264. Valid values: For High-Resolution Devices, For Standard-Resolution Devices, and For Mobile Devices. Different devices support different encoding profiles.

    • If you want to play the output video in multiple definitions, we recommend that you select For Mobile Devices (baseline profile) to ensure normal playback on low-end devices.

    • For High-Resolution Devices specifies the high profile and For Standard-Resolution Devices specifies the main profile.

    Buffer

    Enter an integer. Valid values: 1000 to 128,000. Unit: Kbit/s.

    Note

    The buffer size is used to control the bitrate fluctuation. A larger buffer size indicates a greater fluctuation in the bitrate and higher video quality.

    Scan Mode

    Select the scan mode of the output video. Valid values: Scan Mode of Input Video, Automatic Deinterlacing, Interlaced Scan, and Sequential Scan.

    Note
    1. If you set Scan Mode to Sequential Scan or Interlaced Scan but this scan mode does not match that of the input video, the video fails to be transcoded.

    2. We recommend that you leave this parameter empty or set this parameter to Automatic Deinterlacing for higher compatibility.

    HDR of Source Video

    When you upload an HDR source video, you can set the dynamic range for the source video after it is transcoded. To play HDR videos as expected, your display devices and players must support HDR. Otherwise, issues such as overexposure and color cast may occur during playback.

    • SDR Mapping: uses the HDR-to-SDR conversion technology to convert an HDR video to an SDR video that is supported by general devices and keeps the color saturation of the source video as much as possible.

      Note

      The service is in public preview and is free of charge. After the public preview ends, you are billed for using the service by minute.

    • Constant HDR: keeps the dynamic range of the source video.

    Color Format

    Select a pixel format for encoding. By default, the original format is used.

    Configure audio parameters

    image

    Parameter

    Description

    Disable Audio

    Specifies whether to disable the audio. If you turn on Disable Audio, the output file does not include the audio stream or the corresponding audio information. This option is applicable if you want to extract the video stream from a video file.

    Encoding Format

    Select an encoding format. Different container formats support different encoding formats. The encoding formats displayed in the IMS console shall prevail.

    Note
    • If you set the parameter to AC3 or EAC3, the audio effect is converted to Dolby. You can use ApsaraVideo Player SDK to enable exclusive audio effects on Dolby devices. You are charged for Dolby conversion based on the corresponding billing rules.

    • If you want to play HLS videos on web pages, we recommend that you set the parameter to AAC. Other audio formats may not be supported by the web browsers, resulting in the video playing without sound.

    Encoding Profile

    The encoding profile of the output audio. This parameter is displayed only if you set the Encoding Format parameter to AAC.

    • If the input audio uses the surround sound format such as 5.1 or 7.1, we recommend that you set this parameter to aac_low.

    • If you want to play the output audio on general playback devices, we recommend that you set this parameter to aac_he. Compared with aac_low, this profile can achieve the same audio quality at half the bitrate. A common low bitrate is 64 Kbit/s.

    • If you want to play the output audio on high-end playback devices, we recommend that you set this parameter to aac_he_v2. This way, audio files are encoded in smaller sizes and have higher sound quality. Common low bitrates range from 32 Kbit/s to 48 Kbit/s.

    Sampling Rate

    Select a sampling rate from the drop-down list. Unit: Hz. The supported sampling rates vary based on the encoding format or container format. For more information, see Audio sample rates.

    Audio Bitrate

    Valid values: Bitrate of Input Audio and Average Bitrate.

    • Bitrate of Input Audio: The original bitrate of the input audio is used.

    • Average Bitrate: Set an average bitrate for the output audio.

      Note

      The value must be a multiple of 8 within the range of 8 to 160. We recommend that you set this parameter to 64 or 128. Unit: Kbps.

    Bitrate Check

    This parameter is required if you set the Audio Bitrate parameter to Average Bitrate. This parameter specifies the transcoding method when the bitrate of the input audio is lower than the specified bitrate. Valid values:

    • Transcode Based on Bitrate of Input Audio: The actual bitrate of the original audio is used for transcoding.

    • Transcode Based on Specific Bitrate: The audio is re-encoded based on the specified average bitrate.

    • Do Not Transcode: The original audio is used without transcoding.

    Sound Channels

    Select the number of sound channels. You can select Audio Channels of Input Audio. Default value: 2.

    Volume Normalization

    After you turn on Volume Normalization, the system automatically adjusts the volume of audio files to ensure volume consistency. This resolves the issue of unstable volume due to the volume differences of input files. This parameter is supported only if there is a single output audio stream. If you have configured multiple audio streams, this feature is unavailable.

    Note

    Volume Normalization Professional Edition provides more natural and accurate volume control and is billed based on the processing duration. The service is suitable for applications that require higher audio quality. For more information, see Audio and video enhancement fees.

    Audio transcoding

    Configure audio parameters

    image

    Parameter

    Description

    Disable Audio

    Specifies whether to disable the audio. If you turn on Disable Audio, the output file does not include the audio stream or the corresponding audio information. This option is applicable if you want to extract the video stream from a video file.

    Encoding Format

    Select an encoding format. Different container formats support different encoding formats. The encoding formats displayed in the IMS console shall prevail.

    Note
    • If you want to play HLS videos on web pages, we recommend that you set the parameter to AAC. Other audio formats may not be supported by the web browsers, resulting in the video playing without sound.

    Encoding Profile

    The encoding profile of the output audio. This parameter is displayed only if you set the Encoding Format parameter to AAC.

    • If the input audio uses the surround sound format such as 5.1 or 7.1, we recommend that you set this parameter to aac_low.

    • If you want to play the output audio on general playback devices, we recommend that you set this parameter to aac_he. Compared with aac_low, this profile can achieve the same audio quality at half the bitrate. A common low bitrate is 64 Kbit/s.

    • If you want to play the output audio on high-end playback devices, we recommend that you set this parameter to aac_he_v2. This way, audio files are encoded in smaller sizes and have higher sound quality. Common low bitrates range from 32 Kbit/s to 48 Kbit/s.

    Sampling Rate

    Select a sampling rate from the drop-down list. Unit: Hz. The supported sampling rates vary based on the encoding format or container format. For more information, see Audio sample rates.

    Audio Bitrate

    Valid values: Bitrate of Input Audio and Average Bitrate.

    • Bitrate of Input Audio: The original bitrate of the input audio is used.

    • Average Bitrate: Set an average bitrate for the output audio.

      Note

      The value must be a multiple of 8 within the range of 8 to 160. We recommend that you set this parameter to 64 or 128. Unit: Kbps.

    Bitrate Check

    This parameter is required if you set the Audio Bitrate parameter to Average Bitrate. This parameter specifies the transcoding method when the bitrate of the input audio is lower than the specified bitrate. Valid values:

    • Transcode Based on Bitrate of Input Audio: The actual bitrate of the original audio is used for transcoding.

    • Transcode Based on Specific Bitrate: The audio is re-encoded based on the specified average bitrate.

    • Do Not Transcode: The original audio is used without transcoding.

    Sound Channels

    Select the number of sound channels. You can select Audio Channels of Input Audio. Default value: 2.

    Volume Normalization

    After you turn on Volume Normalization, the system automatically adjusts the volume of audio files to ensure volume consistency. This resolves the issue of unstable volume due to the volume differences of input files. This parameter is supported only if there is a single output audio stream. If you have configured multiple audio streams, this feature is unavailable.

    Note

    Volume Normalization Professional Edition provides more natural and accurate volume control and is billed based on the processing duration. The service is suitable for applications that require higher audio quality. For more information, see Audio and video enhancement fees.

    Container format conversion

    Converts the container format of videos without changing the resolution or bitrate. Supports output formats: MP4, FLV, M3U8 (TS segments), and M3U8 (fMP4 segments).

    Subtitle template

    image

    Parameter

    Description

    Template Name

    The name of the subtitle template.

    External Subtitle File Format

    The format of the external subtitle file. Valid values: srt and ass.

    External Subtitle Encoding Format

    The encoding format of the external subtitle. If this parameter is set to auto, the detected encoding format may not be the actual encoding format. We recommend that you set this parameter to a specific encoding format.

    Watermark template

    image

    Parameter

    Description

    Template Name

    The name of the watermark template.

    Watermark Type

    The watermark type. Valid values: Image Watermark and Text Watermark.

    Image watermark configurations

    Watermark Material

    The image to be used as the watermark. Only PNG and GIF images are supported. The image can be up to 20 MB in size.

    Watermark Position

    The watermark position.

    Image Width

    • By Value: the width value of the image watermark. Valid values: 8 to 4096. Unit: pixel.

    • By Percentage: the percentage of the width of the image watermark relative to the video width. The value of this parameter is accurate to two decimal places. Valid values: 0 to 100. Unit: percent (%).

    Image Height

    • By Value: the height value of the image watermark. Valid values: 8 to 4096. Unit: pixel.

    • By Percentage: the percentage of the height of the image watermark relative to the video height. The value of this parameter is accurate to two decimal places. Valid values: 0 to 100. Unit: percent (%).

    Horizontal Offset

    • By Value: the horizontal offset value of the image watermark. Valid values: 8 to 4096. Unit: pixel.

    • By Percentage: the percentage of the horizontal offset of the image watermark relative to the video width. The value of this parameter is accurate to two decimal places. Valid values: 0 to 100. Unit: percent (%).

    Vertical Offset

    • By Value: the vertical offset value of the image watermark. Valid values: 8 to 4096. Unit: pixel.

    • By Percentage: the percentage of the vertical offset of the image watermark relative to the video height. The value of this parameter is accurate to two decimal places. Valid values: 0 to 100. Unit: %.

    Animated Watermark (Timeline)

    Specifies whether to enable the animated watermark feature. If you enable this feature, the watermark is displayed only within a specific period of time.

    Start Time

    The time when the watermark occurs. The value of this parameter ranges from 0 to the value of the video duration. Unit: seconds.

    Ending Mode

    Specifies how long the watermark lasts. Valid values:

    • To End: The watermark lasts until the video ends.

    • Duration: The watermark is displayed within the specified period of time. The value of this parameter ranges from 0 to the value of the video duration. Unit: seconds.

    Text watermark configurations

    Text Watermark Content

    The text to be displayed as the watermark.

    Font

    The font.

    Font Size

    The font size. Valid values: 5 to 119. Unit: pixel.

    Font Color

    The font color.

    Font Transparency

    The font transparency. Valid values: 0 to 100. Unit: pixel.

    Horizontal Offset

    • By Value: the horizontal offset value of the text watermark. Valid values: 8 to 4096. Unit: pixel.

    • By Percentage: the percentage of the horizontal offset of the text watermark relative to the video width. The value of this parameter is accurate to two decimal places. Valid values: 0 to 100. Unit: percent (%).

    Vertical Offset

    • By Value: the vertical offset value of the text watermark. Valid values: 8 to 4096. Unit: pixel.

    • By Percentage: the percentage of the vertical offset of the text watermark relative to the video height. The value of this parameter is accurate to two decimal places. Valid values: 0 to 100. Unit: percent (%).

    Outline Width

    The width of the text outline. Valid values: 0 to 4096. Unit: pixel.

    Outline Color

    The color of the text outline.

Call an API operation

To create a custom template, you can call the CreateCustomTemplate operation and configure the Type parameter based on your business requirements.