我要评分
获取效率
正确性
完整性
易理解

SetEncodeParam

Function Usage

Sets encoding parameters.

Prototype

int32_t SetEncodeParam(EncodeParamT params[], uint32_t num) = 0

Parameter Description

Field Name

Input/Output

Field Type

Description

params

Input

EncodeParamT[]

List of the encoding parameters to be configured.

num

Input

uint32_t

Number of the encoding parameters to be configured.

Enumeration of EncodeParamT:
 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
42
43
44
45
46
47
48
49
50
51
enum EncodeParamIndex : uint32_t {
    ENCODE_PARAM_NONE,
    ENCODE_PARAM_RATE_CONTROL, // Sets the bit rate control mode.
    ENCODE_PARAM_BITRATE, // Sets the bit rate.
    ENCODE_PARAM_FRAMERATE, // Sets the frame rate.
    ENCODE_PARAM_GOPSIZE, // Sets the GOP size.
    ENCODE_PARAM_PROFILE, // Sets the profile.
    ENCODE_PARAM_KEYFRAME, // Sets the key frame.
    ENCODE_PARAM_STREAM_WIDTH,// Sets the output stream width.
    ENCODE_PARAM_STREAM_HEIGHT,// Sets the output stream height.
    ENCODE_PARAM_CRF, // Sets the CRF level.
    ENCODE_PARAM_CRF_MAXRATE,// Sets the maximum CRF bit rate.
    ENCODE_PARAM_MAX
};
struct EncodeParamBase {
    explicit EncodeParamBase(EncodeParamIndex index) : id(index) {}
    EncodeParamIndex id;
};
struct EncodeParamRateControl : public EncodeParamBase {
    EncodeParamRateControl() : EncodeParamBase(ENCODE_PARAM_RATE_CONTROL) {}
    uint32_t rateControl = 0;
};
struct EncodeParamBitRate : public EncodeParamBase {
    EncodeParamBitRate() : EncodeParamBase(ENCODE_PARAM_BITRATE) {}
    uint32_t bitRate = 0;
};
struct EncodeParamFrameRate : public EncodeParamBase {
    EncodeParamFrameRate() : EncodeParamBase(ENCODE_PARAM_FRAMERATE) {}
    uint32_t frameRate;
};
struct EncodeParamGopsize : public EncodeParamBase {
    EncodeParamGopsize() : EncodeParamBase(ENCODE_PARAM_GOPSIZE) {}
    uint32_t gopSize;
};
struct EncodeParamProfile : public EncodeParamBase {
    EncodeParamProfile() : EncodeParamBase(ENCODE_PARAM_PROFILE) {}
    uint32_t profile;
};
struct EncodeParamKeyframe : public EncodeParamBase {
    EncodeParamKeyframe() : EncodeParamBase(ENCODE_PARAM_KEYFRAME) {}
    uint32_t n;
};
struct EncodeParamStreamWidth : public EncodeParamBase {
    EncodeParamStreamWidth() : EncodeParamBase(ENCODE_PARAM_STREAM_WIDTH) {}
    uint32_t streamWidth;
};
struct EncodeParamStreamHeight : public EncodeParamBase {
    EncodeParamStreamHeight() : EncodeParamBase(ENCODE_PARAM_STREAM_HEIGHT) {}
    uint32_t streamHeight;
};
using EncodeParamT = EncodeParamBase *;

Return Value Description

Data type: GpuEncoderErrorCode

The value can be any of the following:

  • OK: The encoding parameters are set successfully.
  • ERR_NEED_RESET: The encoding parameters take effect only after the Reset API is called.
  • Other: Failed to set the encoding parameters.