Function: venc_send_frame

C Prototype

aclError aclvencSendFrame(aclvencChannelDesc *channelDesc, acldvppPicDesc *input, void *reserve, aclvencFrameConfig *config, void *userdata)

Python Function

ret = acl.media.venc_send_frame(venc_channel_desc, input, reserve, config, userdata)

Function Usage

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

The Atlas Training Series Product does not support this API.

Input Description

venc_channel_desc: int, pointer address of a specified channel.

Must be the same as the channelDesc argument passed to the acl.media.venc_create_channel call.

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.

  • Create image description by calling acl.media.dvpp_create_pic_desc, and set image description parameters (such as the image format, width, and height) by calling acl.media.dvpp_set_pic_desc.

    The input image format is subject to the format set in the channel description. The acl.media.dvpp_set_pic_desc_format call 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

ret: int, error code.

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 example, see VENC.