When performing dynamic operations, the worst-case values must be picked for dynamic bitrate and dynamic b-frames. For example, start with b-frames=4 when dynamic change of number of B-pictures is required. Also start with the maximum planned bitrate. This allows the software to dimension resources for the maximum required ahead of time, such that no re-allocations are needed during processing.
Both the bitrate and the GOP length should be set to the largest possible value allowed by the application, to increase the video quality.
Dynamic parameters should not be changed frequently, as that can cause stability issues because the algorithm does not have time to settle. It is recommended that you wait for a time-period of at least twice or thrice the GOP length when changing the dynamic parameters.
An Intra/IDR frame is inserted on the first frame corresponding to a scene change.
Dynamic GOP changes comes in effect immediately, that is, either the current GOP is closed earlier, or it is extended so that its actual size corresponds to the new parameters.
Dynamic bitrate changes are considered immediately (can impact the QP of the next frames). However, the new average target bitrate can take some time depending on the content, bitrate delta, and so on. It can take up to ~1 GOP duration to converge.
Dynamic bitrate change
vcu2-gst-encode -w 3840 -h 2160 -e avc -r 5000 -o out.h264 -i in.yuv -d BR:100:1000
The syntax of the -d parameter is: <keyword>:<frame number>:<value>
| Keyword | Dynamic Property | Example |
|---|---|---|
| BR | target-bitrate | BR:100:1000 changes the target bitrate to 1000 Kbps at frame 100. |
| BFrm | b-frames | BFrm:10:2 changes the number of B-pictures to 2 at frame 10. |
| KF | key frame | KF:35 forces an IDR-picture at frame 35. |
| ROI |
Region of interest default-roi-quality |
ROI:10:1200x300:200x200:high, at frame 10, changes the region of interest to position 1200,300 with dimensions of 200x200, and default-roi-quality high. ROI:<frame number>:<top>x<left>:<width>x<height>:<ROI quality> |
| ROI_BY_VALUE |
Region of interest delta QP |
ROI_BY_VALUE:0:1200x300:200x200:10, at frame 0, changes the region of interest to position 1200,300 with dimensions of 200x200, and delta QP 10. Limitation: must be enabled at start of the stream (frame 0). ROI_BY_VALUE:<frame number>:<top>x<left>:<width>x<height> :<delta_qp> |
| GL | gop-length | GL:100:12 changes the GOP length to 12 after frame 100. |
| IL | long-term-ref | GL:10 marks frame 10 as long-term reference picture |
| UL | UL: 20 use previously marked frame as long-term picture | |
| BO | loop-filter-beta-offset | Deblocking Loop-filter Beta-offset. |
| TO | Deblocking Loop filter Tc-offset. | |
| SEIp | Insert SEI-prefix | |
| SEIs | Insert SEI-suffix | |
| LOAD_QP |
Load external QP table from a file. LOADQP:<frame_num>:<file_name> |