MediaConvertVideo

Updated at:

Parameter

Type

Description

Example

object

The configuration of a transcoded output.

Bufsize

integer

The buffer size. It controls bitrate fluctuations. A larger value allows for more bitrate variation and potentially higher video quality.

  • Unit: Kbps.

  • Valid values: [1000,128000].

  • Default value: 6000.

20000

Qscale

integer

The video quality scale. This parameter applies to VBR mode. A higher value means lower video quality and a higher compression ratio.

  • This parameter takes effect only if Codec is set to H.264.

  • Valid values: [0,51].

13

ScanMode

string

The scan mode. Valid values:

  • If you leave this parameter empty, the output follows the source's original scan mode.

  • auto: automatic deinterlacing

  • progressive

  • interlaced

  • By default, this parameter is left empty.

Best practice: The interlaced scan mode saves data traffic than the progressive scan mode but provides poor image quality. Therefore, the latter is commonly used in mainstream video production.

  • If you set ScanMode to progressive or interlaced, but this scan mode does not match that of the input, the video fails to be transcoded.

  • To improve compatibility, leave this parameter empty or set it to auto.

auto

LongShortMode

boolean

Specifies whether to enable orientation-adaptive scaling. This parameter takes effect if at least one of the Width and Height parameters is specified. Valid values:

  • true

  • false

  • Default value: false.

Best practice: Enable this feature when your inputs include both horizontal and vertical videos. This prevents videos from stretching.

true

Fps

any

The frame rate of the video stream.

  • Unit: frames per second (FPS).

  • Valid values: (0,60].

  • Default value: the frame rate of the input file. If the original frame rate exceeds 60 FPS, 60 is used.

  • Recommended values: 24, 25, and 30.

25

Gop

any

The keyframe interval.

  • Set by time: The time interval, in seconds. Valid values: [1,100000].

  • Set by frame count: The number of frames. Valid values: [1,100000].

  • Default value: 10s.

Best practice: Set this parameter to 2-7s to improve the Time-to-First-Frame and seeking performance.

10s

Remove

boolean

Specifies whether to delete the video stream. Valid values:

  • true: deletes the video stream. All video-related parameters are invalid.

  • false: retains the video stream.

  • Default value: false.

false

Bitrate

integer

The average bitrate of the output. If you use the CRB, ABR, or VBR bitrate control mode, you must specify Bitrate, and you must set TransMode to a valid value.

  • Unit: Kbps.

  • Valid values: -1 and [10,50000]. A value of -1 indicates that the original bitrate of the input is used.

Best practices:

  • CBR: Set TransMode to CBR and Bitrate, Maxrate, and Bufsize to the same value.

  • ABR: Set TransMode to onepass and specify Bitrate. You can also specify Maxrate and Bufsize to control the bitrate range.

  • VBR: Set TransMode to twopass and specify Maxrate/BitrateBnd and Bufsize.

6000

Profile

string

The codec profile.

  • This parameter takes effect only if Codec is set to H.264.

  • Valid values: baseline, main, and high.

  • Default value: high.

Best practice: For multi-bitrate streaming, use baseline for the lowest quality rendition to ensure maximum compatibility with older devices. Use main or high for other renditions.

high

Crop

string

Crops the video frame. You can set automatic black border removal or custom cropping.

  • Specify this parameter if the input resolution is greater than the output resolution. Do not specify AdjDarMethod if this parameter is specified.

  • To automatically remove black borders, set this parameter to border.

  • To use custom cropping, set the parameter in the format of {width}:{height}:{left}:{top}.

    • width: the width of the output video.

    • height: the height of the output video.

    • left: the distance between the left border of the output and that of the original frame.

    • top: the distance between the top border of the output and that of the original frame.

Example: 1920:800:0:140.

1920:800:0:140

Codec

string

The video codec.

  • Valid values: H.264, H.265, AV1, GIF, and WEBP.

  • Default value: H.264.

H.264

Maxrate

integer

The maximum bitrate of the output.

  • Unit: Kbps.

  • Valid values: [10,50000].

10000

Pad

string

The black borders added to the video.

  • Specify this parameter if the input resolution is smaller than the output resolution. If you specify this parameter, do not specify IsCheckReso, IsCheckResoFail, or AdjDarMethod.

  • Format: {width}:{height}:{left}:{top}.

    • width: the width of the output video.

    • height: the height of the output video.

    • left: the distance between the left border of the output and that of the original frame.

    • top: the distance between the top border of the output and that of the original frame.

Example: 1920:1080:0:140.

1920:1080:0:140

MaxFps

any

The maximum frame rate.

25

Crf

any

The quality control factor. To use the CRF mode, you must specify Crf and set TransMode to fixCRF. A larger value means lower quality and a higher compression ratio.

  • Valid values: [20,51].

  • If Codec is set to H.264, the default value is 23. If Codec is set to H.265, the default value is 26. If Codec is set to AV1, the default value is 32.

Best Practice:

  • A value of 0 specifies lossless quality. A value of 51 specifies the worst quality. A recommended range is [23, 29]. You can adjust the value based on the complexity of the image. If you increase the value by six, the bitrate is reduced by half. Under the same definition, you can set the value for an animated cartoon higher than that for a shot video.

  • CRF targets perceptual quality, not a fixed bitrate. Use it with Maxrate and Bufsize to control bitrate fluctuations.

23

Height

integer

The height or short edge of the output. If LongShortMode is set to false or left empty, this parameter specifies the height of the output. If LongShortMode is set to true, this parameter specifies the short edge of the output.

  • Unit: pixel.

  • Valid values: [128,4096]. The value must be an even number.

  • Default value:

    • If neither Width nor Height is specified, the dimension of the input is used.

    • If only Width is specified, Height is auto-scaled.

1080

Width

integer

The width or long edge of the output. If LongShortMode is set to false or left empty, this parameter specifies the width of the output. If LongShortMode is set to true, this parameter specifies the long edge of the output.

  • Unit: pixel.

  • Valid values: [128,4096]. The value must be an even number.

  • Default value:

    • If neither Width nor Height is specified, the dimension of the input is used.

    • If only Height is specified, Width is auto-scaled.

1920