mxpi_videodecoder

Function

Decodes videos. Currently, only the H.264 and H.265 formats are supported.

Synchronous/Asynchronous (Status)

Asynchronous

Constraints

  • Maximum resolution of the input video: 4096 x 4096
  • Minimum resolution of the input video: 128 x 128
  • widthStride (width after alignment) of the output image: The decoding plugin automatically rounds up the input width to the nearest multiple of 16.
  • heightStride (height after alignment) of the output image: The decoding plugin automatically rounds up the input height to the nearest multiple of 2.
  • Input video formats: H.264 BP/MP/HP level 5.1 YUV420 encoded video streams and H.265 8/10-bit level 5.1 YUV420 encoded video streams
  • Output image formats: YUV420SP NV12 and YUV420SP NV21

Plugin Base Class (Factory)

mxpi_videodecoder

Input/Output

Input: buffer (data type: MxpiBuffer) and metadata (data type: MxpiFrame)

Output: buffer (data type: MxpiBuffer) and metadata (data type: MxpiVisionList)

Port Format (Caps)

Static input: {"video/x-h264"}

Static output: {"image/yuv"}

Property

For details, see Table 1.

Table 1 mxpi_videodecoder 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

inputVideoFormat

Format of the input video stream. The default format is H.264. Currently, only H.264 or H.265 can be entered. If other formats are entered, an error is reported during running. The file format must be the same as that of the stream pulling plugin.

The video format can now be obtained from the upstream plugin (such as the stream pulling plugin) without being set by users. Therefore, this property has been discarded.

No

Yes

outputImageFormat

Format of the output image to be decoded. The default format is YUV420SP_NV12. Currently, only YUV420SP_NV12 or YUV420SP_NV21 can be entered. If other formats are entered, an error is reported during running.

No

Yes

vdecChannelId

Video decoding channel ID. The default value is 0.

  • For the Atlas 200/300/500 inference product, the value ranges from 0 to 31.
  • For the Atlas inference products, the value ranges from 0 to 255.

Each video decoding plugin must use a different decoding channel ID.

No

Yes

outMode

Frame output mode. The value can be 0 or 1. The default value is 0.

  • 0: delayed frame output mode. The VDEC starts to output the decoding result only after receiving multiple frames in the stream.
  • 1: real-time frame output mode. The VDEC starts to output the decoding result in real time after obtaining a frame in the stream. Only H.264/H.265 standard streams with simple reference relationships are supported (no long-term reference frames or B-frames).

No

Yes

outPicWidthMax

Maximum width of the decoded stream. The value ranges from 0 to 4096.

No

Yes

outPicHeightMax

Maximum height of decoded streams. The value ranges from 0 to 4096.

No

Yes

skipFrame

Quantity of skipped frames. The default value is 0. The value range is [0, 100].

No

Yes

vdecResizeWidth

Resized width after decoding. The default value is 0, indicating that resizing is not performed. The value range is [0, 4096]. This parameter is reserved on the Atlas 200/300/500 inference product.

No

Yes

vdecResizeHeight

Resized height after decoding. The default value is 0, indicating that resizing is not performed. The value range is [0, 4096]. This parameter is reserved on the Atlas 200/300/500 inference product.

No

Yes

There is a restriction on the internal input buffer of the decoding plugin. If the backend processing is slow, backpressure is triggered. As a result, the input buffer cannot be consumed. When frames are sent again, a sendframe error is reported. As a result, the decoding plugin cannot work properly.