Updated on 2023-08-28 GMT+08:00

Transcoding Settings

You can transcode a media file during or after upload using one of the four system templates or a custom template. If you need to obtain the transcoding completion status through callback, configure event notifications before transcoding.

Scenario Description

Audio and video distributed by VOD may be referenced by product websites and video websites or be played on devices like PCs and smartphones. VOD provides transcoding to change the media encoding format, packaging format, resolution, and bitrate, so that media can be used in different scenarios, devices, and network environments.

The transcoding function helps you achieve:

  • Compatible with different devices. You can transcode source audio and video into formats such as MP4 for playback on a wide range of devices.
  • Adaptation to different network environments. You can set the output bitrate based on the network bandwidth.
  • Low distribution costs. H.265 codec and low bitrate HD can reduce the bitrate by about 20% without changing the resolution, thereby cutting down media distribution costs.
  • HLS encryption. You can enable HLS encryption during transcoding to prevent secondary distribution if a media file is stolen.
  • Copyright protection. You can add watermarks such as logos to your video.
  • Audio extraction. Audio files can be extracted during transcoding. This function is used for those requiring audio only, such as radio stations and audio apps.
  • Video extraction. You can disable audio and output video only.

Transcoding Template Introduction

VOD provides four system transcoding templates. If you are a new user of the VOD service, you are advised to use the system template.
  • non_transcoding_template_group: This template does not transcode audio and video. If you do not select any transcoding template, this template takes effect by default.
  • system_template_group: In this template, common resolution, bitrate, and frame rate are preconfigured. If you are not familiar with those parameters, you are advised to use this template.
  • original_template_group: This template only changes the media packaging format.
  • adaptive_template_group: This template has image enhancement preconfigured and therefore it is used for repairing corrupt videos.

If you are familiar with audio and video parameters and system templates cannot meet your requirements, you can create a transcoding template.

Constraints

The following input formats are supported for transcoding:
  • Supported input file formats: MP4, TS, MOV, FLV, MPG, MXF, WMV, ADTS, AVI, MKV, and MPEG
  • Supported video codecs: H.264, H.265, MPEG-2, MPEG-4, MJPEG, WMV1/2/3, and ProRes 422
  • Supported audio codecs: AAC, AC3, EAC3, HE-AAC, MP2, MP3, PCM (s161e, s16be, s241e, s24be, DVD), and WMA

Editing a System Template

A system template has common parameters such as video resolution and codec preconfigured. Before using a system template, you are advised to check whether the settings of the system template meet your requirements. If the settings do not, you can edit the system template.

  1. Log in to the VOD console.
  2. In the navigation pane, choose Global Settings > Transcoding Templates.
  3. Locate the target system template and click Edit. On the displayed page, modify template parameters.

    The parameters that can be edited vary according to the system template.

    • system_template_group template

      You can change the video quality, container format, video codec, and watermark template, and enable Low Bitrate HD and encryption. Video Quality options include LD, SD, HD, UHD, 2K, and 4K. Table 3 lists the mapping between resolution and bitrate.

      Figure 1 System template
    • original_template_group template

      You can change the container format, MP4 or HLS.

      Figure 2 Packaging template
    • adaptive_template_group template

      Video codec can only be H.264. You can change the resolution. If the resolution is not set, the original resolution is used by default. After Low Bitrate HD is enabled, you can select Adaptive resolution.

      Figure 3 Adaptive template

  4. Click OK.

Creating a Template Group

If system presets cannot meet your requirements, you can create a transcoding template based on your needs. To customize an audio transcoding template, select MP3 or ADTS for Output Format.

  1. Log in to the VOD console.
  2. In the navigation pane, choose Global Settings > Transcoding Templates.
  3. Click Create Custom Template Group. In the displayed dialog box, specify related parameters.
  4. Set basic information by referring to Table 1. Figure 4 shows the Basic Information area.

    Figure 4 Setting basic information
    Table 1 Basic information parameters

    Parameter

    Description

    Template Name

    A template name can be up to 128 characters long. It consists of letters, underscores (_), and digits only.

    Example: MP4_H264

    Output Format

    • Supported video formats: MP4, HLS, DASH_HLS, and DASH
    • Supported audio formats: ADTS and MP3

    Note: If Audio only is selected, video parameters are disabled.

    Segment Duration (s)

    HLS segment length. This parameter is used only when Output Format is HLS or DASH_HLS.

    Encryption

    Whether to encrypt output media files. Input media files cannot be encrypted. This parameter is unavailable if Output Format is not HLS. Before enabling this function, obtain the key URL by referring to HLS Encryption Settings.

  5. Set video parameters by referring to Table 2. Figure 5 shows the Video Parameters area.

    Figure 5 Video parameters

    If Audio only is selected, the output file does not contain any video information. This option is used in the scenario where audio is extracted from a media file. Perform step 7 to set audio parameters.

    Table 2 Video parameters

    Parameter

    Description

    Video Codec

    H.264 and H.265 are available.

    Frame Rate

    Number of frames displayed per second

    Value range: an integer ranging from 1 to 100

    Low Bitrate HD

    If this is enabled, the bitrate of an output will be lower than the configured bitrate.

    Watermark Template

    Select the default watermark template or a custom watermark template.

    • Default: If a default watermark template is set in Watermark Settings, the default template is used.
    • Custom template

    Quality

    Video quality. The options are 4K, 2K, UHD, HD, SD, and LD.

    Resolution (Width x Height)

    The default value is the recommended resolution for your selected video quality. You can change it based on your needs.

    If the width or height of one side is set to 0, the width or height of the other side is proportionally adaptive.

    • When the width is 0 and the height is not 0, the width is scaled proportionally.
    • When the height is 0 and the width is not 0, the height is scaled proportionally.

    Bitrate

    The default value is the recommended bitrate for your selected video quality. You can change it based on your needs.

    If the bitrate is set to 0, the recommended bitrate for your input file is used for output.

    • A maximum of six outputs are supported.
    • If you changed the default bitrate, you are billed based on the configured bitrate. For details, see VOD Pricing Details.

    You are advised to use the recommended resolution and bitrate. See Table 3.

    Table 3 Recommended resolutions and bitrates

    Video Quality

    Recommended Resolution

    Recommended Bitrate for H.265 (kbit/s)

    Recommended Bitrate for H.264 (kbit/s)

    4K

    3840 x 2160

    5,600

    8,000

    2K

    2560 x 1440

    4,900

    7,000

    UHD

    1920 x 1080

    2,100

    3,000

    HD

    1280 x 720

    700

    1,000

    SD

    854 x 480

    500

    600

    LD

    480 x 270

    200

    300

  6. Set audio parameters by referring to Table 4. Figure 6 shows the Audio Parameters area.

    Figure 6 Audio parameters

    If Video only is selected, the output file does not contain any audio information. This option is used in the scenario where video is extracted from a media file.

    Table 4 Audio parameters

    Parameter

    Description

    Audio Codec

    Audio codec. AAC or HEAAC1 is available.

    The default value is AAC.

    Audio Channel

    Number of audio sources during audio recording or number of speakers during audio playback. Stereo or Mono is available.

    The default value is Stereo.

    Sampling Rate

    Number of times that audio is collected per second.

    Possible values are AUTO, 22050, 3200, 44100, 48000, or 96000.

    The default value is AUTO, in Hz.

    Bitrate

    Bitrate of an output audio, in kbit/s.

    The value is 0 or an integer ranging from 8 to 1,000.

    If this parameter is set to 0, the audio bitrate is an adaptive value.

  7. Click OK.

    The new template is displayed on the Transcoding Templates page.

Editing or Deleting a Custom Template

After a custom template is created, you can click Edit in the template list to modify the template. You can also click Delete to delete templates that you no longer need. If a template is deleted, audio and video using this template will not be deleted.

Figure 7 Editing a custom template