Function: venc_send_frame

Applicable Products

Product

Supported

Ascend 950PR / Ascend 950DT

x

Atlas A3 training products / Atlas A3 inference products

x

Atlas A2 training products / Atlas A2 inference products

x

Atlas training products

x

Atlas inference products

√

Atlas 200I/500 A2 inference products

√

Description

Sends an image to the encoder for encoding. This API is asynchronous.

Prototype

  • C Prototype
    1
    aclErroraclvencSendFrame(aclvencChannelDesc *channelDesc,acldvppPicDesc *input,void *reserve,aclvencFrameConfig *config,void *userdata)
    
  • Python Function
    1
    ret = acl.media.venc_send_frame(venc_channel_desc, input, reserve, config, userdata)
    

Parameters

Parameter

Description

venc_channel_desc

Int, pointer address of a specified channel.

The value must be the same as that of channelDesc specified when the acl.media.venc_create_channel API is called to create a channel.

The callback function for video encoding is specified in channel description.

input

Int, pointer address of the input image description. You need to allocate the input buffer in advance.

  • Call the acl.media.dvpp_create_pic_desc API to create the image description, and call the acl.media.dvpp_set_pic_desc series APIs to set the image description parameters (such as the image format, width, and height).

    The input image format is subject to the format set in the channel description. Calling the acl.media.dvpp_set_pic_desc_format API to set the input image format is invalid.

  • For details about the input resolution and format restrictions, see Functions and Restrictions.

reserve

Int, reserved parameter. It is set to 0.

config

Int, pointer address of the configuration data of a single frame.

userdata

Python object, user-defined data.

Return Value

Return Value

Description

ret

Int, error code. 0 on success; else, failure.

Restrictions

  • This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, call the synchronization API (for example, acl.rt.synchronize_stream) to ensure that the task is complete.
  • Before sending data, ensure that a channel is created. Otherwise, an error code is returned.
  • It is not allowed to send an empty stream packet with eos = 0 (stream length is 0 or stream address is empty).
  • When an empty image with EOS = 1 is sent, the current encoding ends.

Reference

For details about the API call sequence and examples, see VENC.