mxpi_videoencoder

Function

Encodes videos.

Synchronous/Asynchronous (Status)

Asynchronous

Constraints

  • Maximum resolution of the input image:
    • 1920 x 1920 for the Atlas 200/300/500 inference product.
    • 1920 x 1920 for the Atlas 200I/500 A2 inference product.
    • 4096 x 4096 for the Atlas inference product.
  • Minimum resolution of the input image: 128 x 128
  • Input image formats: YUV420SP NV12 and YUV420SP NV21
  • Output stream formats: H.264 MP and H.265 MP
  • Output memory: The output memory does not need to be managed by users. Instead, it is managed by the system.
  • For H.264 streams on the Atlas inference product, the maximum resolution cannot exceed 4096 x 2304.

Plugin Base Class (Factory)

mxpi_videoencoder

Input/Output

  • Input: buffer (data type: MxpiBuffer), metadata (data type: MxpiVisionList)
  • Output: buffer (data type: MxpiBuffer)

Port Format (Caps)

  • Static input: {"ANY"}
  • Static output: {"ANY"}

Property

For details, see Table 1.

Table 1 mxpi_videoencoder plugin properties

Property Name

Description

Mandatory or Not

Modifiable or Not

iFrameInterval

Video I-frame interval. The value range is [1, 2000]. The default value is 30.

No

Yes

imageHeight

Input image height. The default value is 1080.

  • Value range for the Atlas 200/300/500 inference product: [128, 1920]
  • Value range for the Atlas 200I/500 A2 inference product: [128, 1920]
  • Value range for the Atlas inference product: [128, 4096]

No

Yes

imageWidth

Input image width. The default value is 1920.

  • Value range for the Atlas 200/300/500 inference product: [128, 1920]
  • Value range for the Atlas 200I/500 A2 inference product: [128, 1920]
  • Value range for the Atlas inference product: [128, 4096]

No

Yes

fps

Whether to print the video encoding frame rate. The default value is 0. The value can only be 0 or 1.

  • 0: Do not print the frame rate.
  • 1: Print the frame rate.

No

Yes

dataSource

Index of the input data (generally the name of the upstream element). The default value is the key value of the output port of the upstream plugin.

No

Yes

inputFormat

Input image format. The default format is YUV420SP_NV12. Currently, only YUV420SP_NV12 or YUV420SP_NV21 is supported.

No

Yes

outputFormat

Output stream format. The default format is H.264. Only H.264 or H.265 is supported.

No

Yes

vencChannelId

Stream channel ID. The VENC and JPEGE share the same channel. The default value is 0.

  • For the Atlas 200/300/500 inference product, the channel ID is allocated by the system. No need to set this parameter.
  • For the Atlas 200I/500 A2 inference product, the channel ID is allocated by the system. No need to set this parameter.
  • For the Atlas inference product, the value range is [0, 127].

No

Yes

rcMode

Bit rate control mode. The default value is 2. Possible values are as follows:

  • 1: variable bit rate (VBR) mode.
  • 0 and 2: constant bit rate CBR mode.

No

Yes

srcRate

Frame rate (fps) of the input stream. The default value is 30. The value range is [1, 120].

No

Yes

maxBitRate

Output bit rate (kbps). The default value is 300. The value range is [10, 30000].

No

Yes

ipProp

Ratio of the number of bits in a single I frame to the number of bits in a single P frame in a GOP. The default value is 70 in CBR mode and 80 in VBR mode. The value range is [1, 100].

NOTE:

This property is not supported by the Atlas inference product.

No

Yes

frameReleaseTimeOut

Maximum duration for storing video frames in the memory. The default value is 5, in seconds. The value range is [1, 10]. You need to adjust the timeout period based on service requirements. A longer timeout period indicates higher video quality, but occupies more memory and deteriorates performance.

No

Yes