Make I-frame max QP and encode quality level configurable - #32
Conversation
EncodeConfig grows max_qp_i, capping the QP of I/IDR frames under rate control (H.264/H.265), and encode_quality_level, the Vulkan video encode quality level applied to the session parameters and the first-frame control command of all codecs. Both default to the previous hardcoded behavior. Capping the I-frame QP keeps the first GOP from visibly banding while the driver's rate control is still adapting to the content: the initial QP estimate on a cold encoder can land well above what a static, dark scene needs, and skip-coded P-frames then carry the banded keyframe until the next IDR.
|
Hmm I tried these settings but had poor results:
What were your results like? |
|
But |
Do you have an isolated way to verify this? In my tests the output was the same, regardless of that setting. |
EncodeConfig grows two knobs, both defaulting to the previous hardcoded behavior:
max_qp_icaps the QP of I/IDR frames in rate-controlled modes (H.264/H.265; the codec defaults of 42/51 apply when unset, values below the codec's min bound are raised to it, AV1 and CQP/disabled are unaffected).encode_quality_levelsets the Vulkan video encode quality level, previously hardcoded to 0. It is applied consistently to session parameters creation and the first-frame RESET/RATE_CONTROL/QUALITY_LEVEL control command in all three codecs, since the spec requires the bound session parameters to match the session's effective quality level.Motivation: on a cold encoder the driver's rate control opens the stream with a conservative QP estimate. On static content the skip-coded P-frames then carry that first coarse keyframe until the next IDR, which shows up as gradient banding for the whole first GOP. Bounding
qp_iforces the first keyframe to spend enough bits regardless of the initial estimate; verified on NVIDIA (RTX 3080 dev, L40S production) withmax_qp_i: 28under VBR.🤖 Generated with Claude Code