acl.himpi.venc_set_chn_attr

C Prototype

hi_s32 hi_mpi_venc_set_chn_attr(hi_venc_chn chn, const hi_venc_chn_attr *chn_attr);

Python Function

ret = acl.himpi.venc_set_chn_attr(chn, chn_attr)

Function Usage

Sets the attributes of an encoding channel.

The Atlas 200/300/500 Inference Product does not support this API.

The Atlas Training Series Product does not support this API.

Input Description

chn: int, encoding channel ID.

chn_attr: dict, encoding channel attribute. For details, see hi_venc_chn_attr.

Return Value

ret: int, error code.

Restrictions

  • Only H.264/H.265 encoding channels support this API.
  • It is recommended that acl.himpi.venc_get_chn_attr be called before this API to obtain the attributes of the current encoding channel.
  • Encoding channel attributes include the encoder attribute, frame structure GOP attribute, and RC attribute.

    The attributes of a VENC channel are classified into dynamic attributes and static attributes. The static attributes are configured when the VENC channel is created and cannot be modified after the VENC channel is created. The values of the dynamic attributes are configured when a channel is created. Some parameters cannot be modified. The parameters that can be modified can be modified before the channel is destroyed.

    Error codes are returned if you set static attributes or modify parameters that cannot be modified. For details about static attributes, whether they are modifiable, and attribute value ranges, see hi_venc_chn_attr.

  • If gop_mode is not changed when configuring encoding channel attributes, the channel attributes take effect immediately. If gop_mode is changed, the channel attributes will take effect after a delay. The following lists the maximum delays (the HI_VENC_GOP_MODE_LOW_DELAY_B mode is not supported currently).
    • After the HI_VENC_GOP_MODE_LOW_DELAY_B mode is changed to the non-HI_VENC_GOP_MODE_LOW_DELAY_B mode, the maximum delay change (using the number of encoded frames as the unit) is 1 + b_frame_num.
    • After the non-HI_VENC_GOP_MODE_LOW_DELAY_B mode is changed to the other modes, the maximum delay change (using the number of encoded frames as the unit) is 1.
  • When changing the gop_mode, the I-slice refreshing for P-frames, frame skipping reference attributes (H.264/H.265), and pic_order_cnt_type (H.264 ) of the channel are restored to the default values. You need to re-configure them for further use.
  • If either the GOP or RC attribute is modified, the RC module is reinitialized, and all advanced RC parameters are restored to default values. If advanced parameters of the RC are adjusted in the client program, you need to set the parameters again. For details about the advanced parameters of the RC, see acl.himpi.venc_set_rc_param.
  • If gop_mode and rc_mode are modified at the same time, the modification may take effect with a delay (see the preceding table). It is recommended that you do not perform any operation until the parameters take effect after the delay. Otherwise the RC parameter value obtained by calling acl.himpi.venc_get_rc_param may be inaccurate.