Skip to content

Make I-frame max QP and encode quality level configurable - #32

Open
skirsten wants to merge 1 commit into
hgaiser:mainfrom
skirsten:configurable-encode-quality
Open

Make I-frame max QP and encode quality level configurable#32
skirsten wants to merge 1 commit into
hgaiser:mainfrom
skirsten:configurable-encode-quality

Conversation

@skirsten

@skirsten skirsten commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

EncodeConfig grows two knobs, both defaulting to the previous hardcoded behavior:

  • max_qp_i caps 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_level sets 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_i forces the first keyframe to spend enough bits regardless of the initial estimate; verified on NVIDIA (RTX 3080 dev, L40S production) with max_qp_i: 28 under VBR.

🤖 Generated with Claude Code

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant