encodeParams
Variable Description
Encoding parameters.
Variable Data 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 | struct EncodeParams { uint32_t bitrate = 3000000; // Bit rate uint32_t gopSize = 30; // I-frame interval ProfileType profile = BASELINE; // Encoding complexity RCMode rcMode = CBR; // Rate control mode uint32_t forceKeyFrame = 0; // Forcibly generate an I-frame in frame N after the setting. 0 indicates that the setting does not take effect. bool interpolation = false; // Frame interpolation uint32_t crf = 34; // CRF bit rate control level uint32_t maxCrfRate = 20000000; // Maximum CRF bit rate int32_t vbvBufferSize = 1000; // Size of the CRF bit rate buffer uint32_t streamWidth = 720; // Width of the output stream resolution uint32_t streamHeight = 1280; // Height of the output stream resolution } __attribute__((packed)); enum ProfileType : uint32_t { BASELINE, MAIN, HIGH }; enum RCMode : uint32_t { ABR, // Average bit rate, not supported currently CRF, // Constant rate factor, not supported currently CBR, // Constant bit rate CAPPED_CRF, // Capped CRF RC_MODE_MAX }; |
Restrictions
Only the constant bit rate (CBR) and CAPPED_CRF modes are supported in rate control.
Property Field Name |
Description |
Value Range |
Default Value |
|---|---|---|---|
bitrate |
Encoding bit rate. |
Unit: bit/s |
3000000 |
gopSize |
Encoding GOP size. |
30 to 3000 |
30 |
profile |
Encoding profile. (Only main can be used for H.265 encoding.) |
|
0 |
rcMode |
Bit rate control mode. |
|
2 |
forceKeyFrame |
Forced I-frame encoding. |
|
0 |
interpolation |
Frame interpolation. |
|
false |
crf |
CRF bit rate control level. |
0 to 51 |
34 |
maxCrfRate |
Maximum CRF bit rate. |
500,000 to 100,000,000 |
20000000 |
vbvBufferSize |
Size of the CRF bit rate buffer. |
1000 |
|
streamWidth |
Output frame width. |
[240, cloud phone rendering resolution]. The output frame width must be a multiple of 8. |
720 |
streamHeight |
Output frame height. |
[240, cloud phone rendering resolution]. The output frame height must be a multiple of 8. |
1080 |
- The rcMode parameter supports the CBR mode and capped CRF mode. Both Quadra and DC1000 support the two rate control modes.
- If rcMode is set to CBR, you can use the bitrate variable to specify the constant bit rate. If rcMode is set to capped CRF, use the crf, maxCrfRate, and vbvBufferSize variables to control the bit rate when Quadra is used, or use the crf and maxCrfRate variables to control the bit rate when DC1000 is used.