Transcoding template parameters

更新时间:
复制 MD 格式

This topic describes the parameters of a transcoding template and provides examples.

Parameter

Data type

Required

Description

Example

Type

string

Yes

The type of the transcoding template. Valid values:

  • Normal: normal transcoding template

  • AudioTranscode: audio transcoding template

  • Remux: container format conversion template

  • NarrowBandV1: Narrowband HD 1.0 template

  • NarrowBandV2: Narrowband HD 2.0 template

Normal

Container

JSON

Yes

The container format.

{"Format" : "mp4"}

Video

JSON

No

The parameters of the output video.

{"Codec" : "H.264", "Maxrate" : 900, "Rotate" : "auto", "Preset" : "medium", "PixFmt" : "yuv420p", "Width" : 640, "Bitrate" : 400 }

Audio

JSON

No

The parameters of the output audio.

{ "Codec" : "aac", "Bitrate" : 64, "Samplerate" : 44100, "Channels" : 2 }

MuxConfig

JSON

No

The container segment.

{ "Segment": { "Duration" : 5, "ForceSegTime" : "2,3" }}

Container

Parameter

Data type

Required

Description

Example

Format

String

Yes

The container format. Valid values: mp4, m3u8, flv, ts, hls-fmp4, mpd, mxf, mp3, ogg, flac, m4a, gif, and webp.

mp4

Video

Parameter

Data type

Required

Description

Example

Codec

string

No

The encoding format. Valid values: H.264, H.265, GIF, WEBP, AV1, and AVC-Intra.

H.264

Profile

string

No

The encoding profile. Default value: high. Valid values:

  • baseline: applicable to mobile devices.

  • main: applicable to standard-definition devices.

  • high: applicable to high-definition devices.

main

Bitrate

integer

No

The average bitrate of the video. Valid values: [10,50000]. Unit: Kbit/s.

3000

Crf

integer

No

The constant rate factor. Valid values: [0,51]. If you specify this parameter, the value of Bitrate is invalid. Default value:

  • 23: This value is used as the default value when the Codec parameter is set to H.264.

  • 26: This value is used as the default value when the Codec parameter is set to H.265.

23

Width

integer

No

The width of the output video.

  • Valid values: [128,4096].

  • Unit: pixels.

  • Default value: the width of the input video.

1920

Height

integer

No

The height of the output video.

  • Valid values: [128,4096].

  • Unit: pixels.

  • Default value: the height of the input video.

1080

Fps

integer

No

The video frame rate.

  • Valid values: (0,60]. The value is 60 if the frame rate of the input file exceeds 60.

  • Default value: the frame rate of the input video.

25

Gop

integer

No

The maximum number of frames between two keyframes.

  • Valid values: [1,1080000].

  • Default value: 250.

250

Preset

string

No

The preset video algorithm. This parameter is valid only if the Codec parameter is set to H.264.

  • Valid values: veryfast, fast, medium, slow, and slower.

  • Default value: medium.

medium

ScanMode

string

No

The scan mode. Valid values: interlaced and progressive.

progressive

PixFmt

string

No

The pixel format. Valid values: yuv420p, yuvj420p, yuv422p, yuvj422p, yuv444p, yuvj444p, nv12, nv16, nv20, yuv420p10, yuv422p10, and yuv444p10.

yuv420p

Remove

boolean

No

Specifies whether to remove the video. Valid values:

  • true

  • false

false

Crop

string

No

The crop mode. Two modes are supported:

  • border: If you set this parameter to border, black bars are automatically detected and removed.

  • Custom cropping: To use this mode, you must configure the parameter in the width:height:left:top format. Example: 1280:800:0:140.

1280:800:0:140

Pad

string

No

The information about the black bars.

  • Parameter format: width:height:left:top.

  • Example: 1280:800:0:140.

1280:800:0:140

LongShortMode

boolean

No

Specifies whether to enable the auto-rotate screen feature.

false

Bufsize

integer

No

The buffer size.

  • Valid values: [1000,128000].

  • Default value: 6000.

  • Unit: Kbit/s.

6000

Maxrate

integer

No

The maximum bitrate of the video. Valid values: [10,50000]. Unit: Kbit/s.

9000

AbrMax

string

No

The maximum adaptive bitrate (ABR). This parameter is valid only when the Type parameter is set to NarrowBandV1.

  • Valid values: [10,50000].

  • Unit: Kbit/s.

6000

Audio

Parameter

Data type

Required

Description

Example

Codec

string

No

The audio encoding and decoding format.

  • Valid values: AAC, MP3, VORBIS, and FLAC.

  • Default value: AAC.

Note

When the container format is m3u8 and the video codec is H.265, AAC is a valid audio codec.

AAC

Profile

string

No

The audio encoding profile. If the Codec parameter is set to AAC, you can set this parameter to aac_low, aac_he, aac_he_v2, aac_ld, or aac_eld.

aac_low

Samplerate

integer

No

The sampling rate.

  • Default value: 44100.

  • Valid values: 22050, 32000, 44100, 48000, and 96000.

  • Unit: Hz.

44100

Bitrate

integer

No

The audio bitrate of the output file.

  • Valid values: [8,1000].

  • Unit: Kbit/s.

  • Default value: 128.

128

Channels

integer

No

The number of sound channels. Default value: 2.

2

Remove

boolean

No

Specifies whether to delete the audio stream. Valid values: Valid values:

  • true

  • false

false

Volume

JSON

No

The volume control configurations.

For more information, see Audio.Volume.

Audio.Volume

Parameter

Data type

Required

Description

Example

Method

string

No

The volume adjustment method. Valid values:

  • auto

  • dynamic

  • linear

auto

IntegratedLoudnessTarget

integer

No

The output volume.

-6

TruePeak

integer

No

The maximum volume.

-1

LoudnessRangeTarget

integer

No

The range of the volume relative to the output volume.

It takes effect when Method is set to dynamic.

  • Unit: db.

  • Valid values: 1 to 20.

  • Default value: 8.

8

MuxConfig

Parameter

Data type

Required

Description

Example

Segment

JSON

Yes

The segment parameters.

For more information, see MuxConfig.Segment.

MuxConfig.Segment

Parameter

Data type

Required

Description

Example

Duration

integer

Yes

The segment length. Unit: seconds.

10

ForceSegTime

string

No

The time point at which a forced segment is generated.

2,3

Sample template

{
  "Type": "Normal",
  "Container": {
    "Format": "mp4"
  },
  "Video": {
    "Codec": "H.264",
    "LongShortMode": false,
    "Height": 2160,
    "Remove": false,
    "Profile": "high"
  },
  "Audio": {
    "Codec": "AAC",
    "Volume": {
      "Method": "auto"
    },
    "Remove": false,
    "Samplerate": 44100,
    "Bitrate": 128,
    "Channels": 2
  }
}