VencConfig
Description
Defines the video encoding structure.
Structure Definition
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | struct VencConfig { uint32_t maxPicWidth = MAX_VENC_WIDTH; uint32_t maxPicHeight = MAX_VENC_HEIGHT; uint32_t width = 0; uint32_t height = 0; // stream format reference acldvppStreamFormat MxbaseStreamFormat outputVideoFormat = MXBASE_STREAM_FORMAT_H264_MAIN_LEVEL; // output format reference acldvppPixelFormat MxbasePixelFormat inputImageFormat = MXBASE_PIXEL_FORMAT_YUV_SEMIPLANAR_420; uint32_t keyFrameInterval = 30; uint32_t deviceId = 0; // device id uint32_t channelId = 0; pthread_t encoderThreadId = 0; bool stopEncoderThread = false; uint32_t srcRate = 0; uint32_t rcMode = 0; uint32_t shortTermStatsTime = 60; uint32_t longTermStatsTime = 120; uint32_t longTermMaxBitRate = 300; uint32_t longTermMinBitRate = 0; uint32_t maxBitRate = 0; uint32_t ipProp = 0; uint32_t sceneMode = 0; uint32_t displayRate = 30; uint32_t statsTime = HI_AENC_CHN_ATTR_STATS_TIME; uint32_t firstFrameStartQp = FIRST_FRAME_START_QP; std::vector<uint32_t> thresholdI = {0, 0, 0, 0, 0, 0, 0, 0, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE}; std::vector<uint32_t> thresholdP = {0, 0, 0, 0, 0, 0, 0, 0, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE}; std::vector<uint32_t> thresholdB = {0, 0, 0, 0, 0, 0, 0, 0, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE, THRESHOLD_OF_ENCODE_RATE}; uint32_t direction = 8; uint32_t rowQpDelta = 1; std::function<void(std::shared_ptr<uint8_t>, uint32_t)>* userData; std::function<void(std::shared_ptr<uint8_t>, uint32_t, void**)>* userDataWithInput; std::function<void(std::shared_ptr<uint8_t>, uint32_t, void**, void*)>* userDataWithInputFor310P; }; |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
maxPicWidth |
Input |
Maximum reserved width of an encoding channel. By default, MAX_VENC_WIDTH is 4096. |
maxPicHeight |
Input |
Maximum reserved height of an encoding channel. By default, MAX_VENC_HEIGHT is 4096. |
width |
Input |
Input width |
height |
Input |
Input height |
outputVideoFormat |
Input |
Output stream format |
inputImageFormat |
Input |
Input image format |
keyFrameInterval |
Input |
I-frame interval |
deviceId |
Input |
Device ID |
channelId |
Input |
Decoding channel ID |
encoderThreadId |
Input |
ID of a callback thread |
stopEncoderThread |
Input |
Flag indicating whether a callback thread is running |
srcRate |
Input |
Frame rate of the input stream (fps) |
rcMode |
Input |
Bit rate control mode |
shortTermStatsTime |
Input |
Short-term statistical time of the bit rate, in seconds. The value range is [1, 120]. The default value is 60. This parameter takes effect only when rcMode is set to 5 on Atlas inference product. |
longTermStatsTime |
Input |
Long-term statistical time of the bit rate, in minutes. The value range is [1, 1440]. The default value is 120. This parameter takes effect only when rcMode is set to 5 on Atlas inference product. |
longTermMaxBitRate |
Input |
Maximum long-term output bit rate of the encoder, in kbps. The default value is 300. The value range is [2, maxBitRate]. This parameter takes effect only when rcMode is set to 5 on Atlas inference product. |
longTermMinBitRate |
Input |
Minimum long-term output bit rate of the encoder, in kbps. The default value is 0. The value range is [0, longTermMaxBitRate]. This parameter takes effect only when rcMode is set to 5 on Atlas inference product. |
maxBitRate |
Input |
Output bit rate (kbps) |
ipProp |
Input |
I-frame to P-frame bit allocation ratio within a GOP |
sceneMode |
Input |
Scene mode. The default value is 0.
This parameter takes effect only on Atlas inference product. NOTE:
When the output video format is set to H.264 and sceneMode is set to 1, the value of sceneMode is automatically switched to 0 because H.264 does not support motion scenes where the bit rate is high. |
displayRate |
Input |
Frame rate for playing the output video. The value range is [1, 120]. The default value is 30. This parameter takes effect only on Atlas inference product. |
statsTime |
Input |
Bit rate statistical time, in seconds. The value range is [1, 60]. The default value is 1. This parameter takes effect only on Atlas inference product. |
firstFrameStartQp |
Input |
Start QP value of the first frame. The value range is [0, 47]. The default value is 32. This parameter takes effect only on Atlas inference product. |
thresholdI |
Input |
MADi threshold for the macroblock-level bit rate of I-frames, used to measure the spatial texture complexity of the current frame. The value range is [0, 255]. The default value is [0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255]. If the value of the subtraction direction is set to 0 or the value of the addition direction is set to 255, the current profile is disabled. This parameter takes effect only on Atlas inference product. |
thresholdP |
Input |
MADi threshold for the macroblock-level bit rate of P-frames, used to measure the spatial texture complexity of the current frame. The value range is [0, 255]. The default value is [0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255]. If the value of the subtraction direction is set to 0 or the value of the addition direction is set to 255, the current profile is disabled. This parameter takes effect only on Atlas inference product. |
thresholdB |
Input |
MADi threshold for the macroblock-level bit rate of B-frames, used to measure the spatial texture complexity of the current frame. The value range is [0, 255]. The default value is [0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255]. If the value of the subtraction direction is set to 0 or the value of the addition direction is set to 255, the current profile is disabled. This parameter takes effect only on Atlas inference product. |
direction |
Input |
Addition or subtraction direction control during texture-based macroblock-level bit rate control. The value range is [0, 16]. The default value is 8. This parameter takes effect only on Atlas inference product. |
rowQpDelta |
Input |
Maximum row-level adjustment range within one frame. The unit is the macroblock row. A larger adjustment amplitude indicates that the allowed QP row-level adjustment range is larger and the bit rate is more stable. In the scenarios where the image complexity is unevenly distributed, the image quality may be uneven if the value of this parameter is too large. The value range is [0, 10]. The default value is 1. If the value is set to 0, row-based macroblock-level bit rate control is disabled. This parameter takes effect only on Atlas inference product. |
userData |
Input |
User-defined data. |
userDataWithInput |
Input |
User-defined data (pointer to be input). |
userDataWithInputFor310P |
Input |
User-defined data used on the Atlas inference product (pointer to be input). |