VideoEncodeConfig

Parameter

Type

Description

width

int

Width of the encoded video frame data. The default value is 1920. The value must be the same as the width (original_width) of the image to be encoded.

  • Atlas 200/300/500 inference product: The value range is [128, 1920]. The input video width must be a multiple of 16.
  • Atlas 200I/500 A2 inference product: The value range is [114, 8192]. The input video width must be a multiple of 2.
  • Atlas inference product: The value range is [128, 4096]. The input video width must be a multiple of 2. The maximum resolution (width × height) for video encoding cannot exceed 4096 × 2304.

height

int

Height of the encoded video frame data. The default value is 1080. The value must be the same as the height (original_height) of the image to be encoded.

  • Atlas 200/300/500 inference product: The value range is [128, 1920]. The input video height must be a multiple of 2.
  • Atlas 200I/500 A2 inference product: The value range is [114, 8192]. The input video height must be a multiple of 2.
  • Atlas inference product: The value range is [128, 4096]. The input video height must be a multiple of 2. The maximum resolution (width × height) for video encoding cannot exceed 4096 × 2304.

outputVideoFormat

StreamFormat enumeration

Encoded output video format. H.264 videos support base.h264_baseline_level, base.h264_main_level (default), and base.h264_high_level. H.265 videos support only base.h265_main_level.

inputImageFormat

image_format enumeration

Input image format. Only base.nv12 (default) and base.nv21 are supported.

keyFrameInterval

int

I-frame interval. The default value is 30.

  • Atlas 200/300/500 inference product: [1, 2000]
  • Atlas 200I/500 A2 inference product: [1, 65536]
  • Atlas inference product: [1, 65536]

srcRate

int

Frame rate of input streams, in fps. The default value is 30.

  • Atlas 200/300/500 inference product: The value range is [1, 120].
  • Atlas 200I/500 A2 inference product: The value range is [1, 240].
  • Atlas inference product: The value range is [1, 240].

rcMode

int

  • Atlas 200/300/500 inference products
    • 0: CBR mode (default)
    • 1: VBR mode
    • 2: CBR mode
  • Atlas 200I/500 A2 inference products
    • 0: VBR mode (default)
    • 1: VBR mode
    • 2: CBR mode
  • Atlas inference product
    • 0 or 1: CBR mode
    • 2: VBR mode
    • 3: AVBR mode
    • 4: QVBR mode
    • 5: CVBR mode

shortTermStatsTime

int

Short-term statistical time of the bit rate, in seconds. The value range is [1, 120]. The default value is 60.

This parameter takes effect only when rcMode is set to 5 on Atlas inference product.

longTermStatsTime

int

Long-term statistical time of the bit rate, in minutes. The value range is [1, 1440]. The default value is 120.

This parameter takes effect only when rcMode is set to 5 on Atlas inference product.

longTermMaxBitRate

int

Maximum long-term output bit rate of the encoder, in kbps. The default value is 300. Value range: [2, maxBitRate].

This parameter takes effect only when rcMode is set to 5 on Atlas inference product.

longTermMinBitRate

int

Minimum long-term output bit rate of the encoder, in kbps. The default value is 0. Value range: [0, longTermMaxBitRate].

This parameter takes effect only when rcMode is set to 5 on Atlas inference product.

maxBitRate

int

Output bit rate, in kbps. The default value is 300.

  • Atlas 200/300/500 inference product: The value range is [10, 30000].
  • Atlas 200I/500 A2 inference product: The value range is [2, 614400].
  • Atlas inference product: The value range is [2, 614400].

ipProp

int

I-frame to P-frame bit allocation ratio within a GOP. The value range is [1, 100]. The default value is 70.

sceneMode

int

Scene mode.

  • 0 (default): scene where the camera does not move or moves periodically and continuously. H.264 and H.265 are supported.
  • 1: motion scenario where the bit rate is high. H.265 is supported.

This parameter takes effect only on Atlas inference product.

NOTE:

When the output video format is set to H.264 and sceneMode is set to 1, the value of sceneMode is automatically switched to 0 because H.264 does not support motion scenes where the bit rate is high.

displayRate

int

Frame rate for playing the output video. The value range is [1, 120]. The default value is 30.

This parameter takes effect only on Atlas inference product.

statsTime

int

Bit rate statistical time, in seconds. The value range is [1, 60]. The default value is 1.

This parameter takes effect only on Atlas inference product.

firstFrameStartQp

int

Start QP value of the first frame. The value range is [0, 47]. The default value is 32.

This parameter takes effect only on Atlas inference product.

SetThresholdI

func

MADi threshold for the macroblock-level bit rate of I-frames, used to measure the spatial texture complexity of the current frame.

For details about the parameters, see SetThresholdI Description.

This parameter takes effect only on Atlas inference product.

SetThresholdP

func

MADi threshold for the macroblock-level bit rate of P-frames, used to measure the spatial texture complexity of the current frame.

For details about the parameters, see SetThresholdP Description.

This parameter takes effect only on Atlas inference product.

SetThresholdB

func

MADi threshold for the macroblock-level bit rate of B-frames, used to measure the spatial texture complexity of the current frame.

For details about the parameters, see SetThresholdB Description.

This parameter takes effect only on Atlas inference product.

direction

int

Addition or subtraction direction control during texture-based macroblock-level bit rate control The value range is [0, 16]. The default value is 8.

This parameter takes effect only on Atlas inference product.

rowQpDelta

int

Maximum row-level adjustment range within one frame. The unit is the macroblock row. A larger adjustment amplitude indicates that the allowed QP row-level adjustment range is larger and the bit rate is more stable.

In the scenarios where the image complexity is unevenly distributed, the image quality may be uneven if the value of this parameter is too large.

The value range is [0, 10]. The default value is 1. If the value is set to 0, row-based macroblock-level bit rate control is disabled.

This parameter takes effect only on Atlas inference product.

SetThresholdI Description

Parameter

Type

Description

threshold_i

list

Value range of list: [0, 255]. If you do not use it to set the value of thresholdI, the default value of thresholdI is [0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255].

If the value of the subtraction direction is set to 0 or the value of the addition direction is set to 255, the current profile is disabled.

SetThresholdP Description

Parameter

Type

Description

threshold_p

list

Value range of list: [0, 255]. If you do not use it to set the value of thresholdP, the default value of thresholdP is [0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255].

If the value of the subtraction direction is set to 0 or the value of the addition direction is set to 255, the current profile is disabled.

SetThresholdB Description

Parameter

Type

Description

threshold_b

list

Value range of list: [0, 255]. If you do not use it to set the value of thresholdB, the default value of thresholdB is [0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255].

If the value of the subtraction direction is set to 0 or the value of the addition direction is set to 255, the current profile is disabled.

Recommended Configuration

The following table lists the recommended parameter settings that ensure good video encoding quality during video capture. In other scenarios, adjust the parameter settings as required.

Image Quality/Resolution

srcRate

keyFrameInterval

maxBitRate

4K

3840 × 2160/4096 × 2160

25 or 30

50 or 60

  • H.264: 8000 to 12000
  • H.265: 8000 to 12000

2K

2560 × 1440

25 or 30

50 or 60

  • H.264: 6000 to 10000
  • H.265: 6000 to 10000

1080p (Blu-ray)

1920 × 1080

25 or 30

50 or 60

  • H.264: 2000 to 6000
  • H.265: 1000 to 4000

720p (HD)

1280 × 720

25 or 30

50 or 60

  • H.264: 1000 to 3000
  • H.265: 800 to 2000

480p/D1_N (SD)

854 × 480/720 × 480

25 or 30

50 or 60

  • H.264: 600 to 1400
  • H.265: 300 to 700

576P/D1 (SD)

720 × 576

25 or 30

50 or 60

  • H.264: 600 to 1400
  • H.265: 300 to 700

270p (smooth)

480 × 270

25 or 30

50 or 60

-

CIF P/N

352 × 288/320 × 240

25 or 30

50 or 60

  • H.264: 250
  • H.265: 250