hi_mpi_venc_create_chn
Applicability
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
☓ |
Description
Creates an encoding channel.
Prototype
hi_s32 hi_mpi_venc_create_chn (hi_venc_chn chn, const hi_venc_chn_attr *attr)
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
chn |
Input |
Encoding channel ID. |
|
attr |
Input |
Pointer to the encoding channel attributes. |
Returns
- 0: success
- Other values: failure. For details, see VENC/JPEGE Return Codes.
Restrictions
- The channel ID of a single device cannot exceed the maximum channel ID.
- An encoding channel has the encoder attributes, rate controller (RC) attributes, and group of pictures (GOP) attributes.
- In the encoder attributes, the stream buffer depth, stream fetching mode, and encoding profile must be set according to Table 1.
- The recommended encoding sizes are 3840 x 2160 (4K), 1920 x 1080 (1080p), and 1280 x 720 (720p).
- For H.264/H.265 encoding, a frame buffer consists of YHeaderSize, CHeaderSize, YSize, CSize, PmeSize, PmeInfoSize, and TmvSize. The encoder calculates the buffer allocation based on the maximum width and height by default. When configuring the channel width and height, ensure that each frame buffer calculated based on the channel width and height does not exceed that calculated based on the maximum channel width and height.
- The input/output frame rate (src_frame_rate/dst_frame_rate) in the attributes of the RC is used to allocate the bitrate (bit_rate) during encoding, but not the final display frame rate of the player. For details about how to set the display frame rate, see hi_mpi_venc_set_h264_vui or hi_mpi_venc_set_h265_vui.
You are advised to set the control frame rate to be the same as the display frame rate. Otherwise, the playback bit rate may be different from the configured encoding bit rate. The playback bit rate will vary with the configured display frame rate.
- For Ascend virtual instances, the requirements on the number of channels are as follows:
For
Atlas A2 training products /Atlas A2 inference products , the maximum number of JPEGE channels is 256.For
Atlas 200I/500 A2 inference products : Number of VENC channels = (Number of allocated VENC hardware units/Number of VENC hardware units) x 128. If the total number of channels is not an integer, round down the value. The number of JPEGE channels is independent of the computing power, but the maximum number of JPEGE and VENC channels is 128.For
Atlas inference products : Total number of VENC and JPEGE channels = (Total number of allocated VENC and JPEGE hardware units/Total number of VENC and JPEGE hardware units) x 256. If the total number of channels is not an integer, round down the value.To check the compute resource specifications of the Ascend virtual instances in different scenarios, run the npu-smi info -t template-info command on the server with the Ascend AI Processor installed.
Restrictions on Encoder Attributes
|
Encoding Protocol |
Encoding Mode |
Stream Buffer Depth |
Stream Fetching Mode |
Encoding Profile |
|---|---|---|---|---|
|
H.264 |
Frame |
|
Frame/Slice |
Baseline Main Profile High Profile |
|
JPEG |
Frame |
|
Frame/Ecs |
Baseline |
|
H.265 |
Frame |
|
Frame/Slice |
Main Profile Main 10 Profile (not supported currently) |
|
Frame/Slice |
Main 10 Profile (not supported currently) |