acl.himpi.venc_set_h265_vui

C Prototype

hi_s32 hi_mpi_venc_set_h265_vui(hi_venc_chn chn, const hi_venc_h265_vui *h265_vui)

Python Function

ret = acl.himpi.venc_set_h265_vui(chn, h265_vui)

Function Usage

Sets the VUI parameters of an H.265 channel.

The VUI parameters mainly include the format information of the decoded image, such as the sampling aspect ratio, optical-to-electrical conversion, and color space. The VUI parameters are optional in the protocol and do not affect the video encoding process. However, it is recommended that the decoder/player perform correction.

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.

h265_vui: dict, dictionary of VUI attributes of an H.265 encoding channel. For details, see hi_venc_h265_vui.

Return Value

ret: int, error code.

Restrictions

  • This API is used to set the VUI parameters of an H.265 encoding channel.
  • This API must be called after an encoding channel is created and before the channel is destroyed. If this API is called during encoding, the configuration takes effect only after the next I-frame is encoded.
  • It is recommended that this API be called after an encoding channel is created and before encoding is started, to reduce the number of the API calls during encoding.
  • It is recommended that this API be called only in an H.265 encoding channel.
  • Currently, only the hi_venc_vui_video_signal and hi_venc_vui_h265_time_info attributes in hi_venc_h265_vui is available for users to configure. Other attributes are reserved and must be set to the default values. Otherwise, encoding fails. It is recommended that acl.himpi.venc_get_h265_vui be called before this API to obtain the default VUI configurations of the current encoding channel, so that errors in reserved attributes can be avoided.
  • hi_venc_vui_h265_time_info contains clock counting parameters that are not effective by default. To control the display frame rate, you need to configure related parameters. Note that the display frame rate affects only the playback speed of the player. To control the bit rate control frame rate during encoding, you need to set the hi_venc_rc_attr attribute in acl.himpi.venc_create_chn.

    You are advised to set the control frame rate to be the same as the display frame rate. Otherwise, the bit rate during playback may be different from the encoding bit rate configured by the user, and the playback bit rate will vary with the configured display frame rate.

    If you want to adjust the playback speed, you are advised to adjust the display frame rate within a proper range. Generally, the normal video playback speed is 30 fps, indicating that the display frame rate is 30 fps.

    • If the display frame rate is increased, the playback speed increases. For example, if the playback speed is 3x, the display frame rate is set to 90 fps.
    • If the display frame rate is decreased, the playback speed decreases. For example, if the playback speed is 0.5x, the display frame rate is set to 15 fps.
  • The VUI parameter is optional. The final effect of setting parameters (such as the display frame rate and pixel value range) by calling this API depends on the decoder/player behavior or user-defined decoding/playback behavior.