Skip to content

fix(hdr): inject AV1 metadata for full-range clients - #166

Merged
hgaiser merged 2 commits into
hgaiser:mainfrom
lutyjj:fix/av1-metadata-full-range
Aug 5, 2026
Merged

fix(hdr): inject AV1 metadata for full-range clients#166
hgaiser merged 2 commits into
hgaiser:mainfrom
lutyjj:fix/av1-metadata-full-range

Conversation

@lutyjj

@lutyjj lutyjj commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

The inject_hdr gate still compares against the exact limited-range BT.2020+PQ preset, so full-range HDR sessions never carry MDCV/CLL metadata OBUs and the client tone-maps blind. The gate (and its comment) predates #154 - with the trailing-bits + AV1-units fixes in, the injected stream is spec-valid, so this drops the gate to is_hdr(), the same check the control-stream HDR state already uses.

Verified live: 4K AV1 full-range HDR session (moonlight-qt/VAAPI client), SDR→HDR transition plays with metadata injected. Also offline: captured the wire bitstream and the injected OBUs pass dav1d and ffmpeg -err_detect explode. Note this needs hgaiser/pixelforge#31 on the host to get a decodable transition key frame in the first place - independent bugs, but this one is only observable with that one fixed.

This finally fixes all of my troubles with AC4 on AV1 path, so I can finally start playing it rather than tinkering with the setup lol. (all of this was only for 1ms decode latency improvement vs HEVC path, heh).

Closes #155.


Host: NVidia 5060 Ti (driver 610.43.03), Arch

The injection gate compares the encoder color description against the
exact limited-range BT.2020+PQ preset, so full-range HDR sessions never
get MDCV/CLL metadata and the client tone-maps blind. The gate guarded
against the malformed AV1 metadata OBUs fixed in PR 154 (trailing bits,
AV1 units); with those in, the injected stream is spec-valid, so gate on
is_hdr() - the same check the control-stream HDR state uses.

Verified on a live 4K AV1 full-range HDR session (RTX 5060 Ti host,
driver 610.43.03; moonlight-qt/VAAPI client): the SDR->HDR transition
plays with metadata injected, and the captured wire bitstream with the
injected OBUs decodes clean under dav1d and ffmpeg -err_detect explode.
@hgaiser

hgaiser commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Thanks 👍

@hgaiser
hgaiser merged commit f7fac93 into hgaiser:main Aug 5, 2026
5 checks passed
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.

[Bug] Greenscreen on mid-stream colorspace switch (HDR<->SDR) on AV1 path

2 participants