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); 4096 x 4096 (for the Atlas inference products).
  • 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 products, the maximum resolution cannot exceed 4096 x 2304.

Plugin Base Class (Factory)

mxpi_videoencoder

Input/Output

Input: buffer (data type: MxpiBuffer) and 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

deviceId

Ascend device ID, which is specified by the deviceId property in the stream_config field. You do not need to set the ID.

No

Yes

iFrameInterval

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

No

Yes

imageHeight

Input image height. The default value is 1080. For the Atlas 200/300/500 inference product, the value ranges from 128 to 1920, and for the Atlas inference products, the value ranges from 128 to 4096.

No

Yes

imageWidth

Input image width. The default value is 1920. For the Atlas 200/300/500 inference product, the value ranges from 128 to 1920, and for the Atlas inference products, the value ranges from 128 to 4096.

No

Yes

fps

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

  • 0: Print the frame rate.
  • 1: Do not 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 can be entered.

No

Yes

outputFormat

Output stream format. The default format is H.264. Only H.264 or H.265 can be entered.

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 inference products, the value ranges from 0 to 127.

No

Yes

rcMode

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

  • 1: variable bit rate (VBR) mode
  • 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 (kbit/s). 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 products.

No

Yes