Skip to content

fix: tone-map HDR10 videos at Analysis - #41

Merged
mathieuletyrant merged 1 commit into
mainfrom
claude/pr-deploy-umbrel-update-41czlf
Nov 17, 2026
Merged

mathieuletyrant merged 1 commit into
mainfrom
claude/pr-deploy-umbrel-update-41czlf

Conversation

@mathieuletyrant

Copy link
Copy Markdown
Owner

Why

HDR10 files, and Dolby Vision files with an HDR10 base (PQ transfer, BT.2020), were read as if they were SDR. Their colors came out washed out and dim, auto exposure hit its 3× cap, and a fire scene lit the Strip pale beige instead of orange.

What

  • ffprobe now also reads the stream's color_transfer. smpte2084 (PQ) means HDR.
  • For HDR, ffmpeg keeps the 10 bits (p010 on VA-API/QSV) and sends rgb48le with the BT.2020 matrix stated explicitly.
  • Rust then tone-maps each pixel (color::hdr_to_srgb): PQ → linear light (a 64K-entry LUT), BT.2020 → BT.709, highlights rolled off above 0.75 of reference white (203 nits), applied to the strongest channel so the hue holds, then sRGB encoding.
  • SDR files take exactly the same path as before.

Tracks

Track version 3 marks the new Analysis, with the same layout as version 2. A version 2 Track stays fresh for an SDR video. That check runs ffprobe once per file and size, and the result is cached for the life of the process. So the next Scan only re-analyzes HDR videos.

Tests

cargo test passes (43 tests). The new tests cover parsing the probe output, the ffmpeg arguments for HDR, reference white mapping to SDR white, highlight roll-off, and the fire scene staying orange.


Generated by Claude Code

HDR10 and Dolby Vision files with an HDR10 base (PQ transfer, BT.2020)
were read as SDR: colors came out washed out and dim, auto exposure hit
its 3x cap, and a fire scene lit the Strip pale beige instead of orange.

ffprobe now reads the stream's transfer. For PQ, ffmpeg keeps 10 bits
(p010 on VA-API/QSV) and hands rgb48le with the BT.2020 matrix to Rust,
which decodes PQ, converts BT.2020 to BT.709, rolls highlights off above
0.75 of reference white (203 nits) on the strongest channel, and encodes
sRGB. SDR files take the exact same path as before.

Track version 3 marks the new Analysis. A version 2 Track stays fresh
for an SDR video (checked once per file with ffprobe, cached), so the
next Scan only re-analyzes HDR videos.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MqWWDXiAgEaacHoS4Cw5SA
@mathieuletyrant
mathieuletyrant merged commit 53d93fc into main Nov 17, 2026
1 check 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.

2 participants