Repository navigation
fix: tone-map HDR10 videos at Analysis - #41
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
color_transfer.smpte2084(PQ) means HDR.p010on VA-API/QSV) and sendsrgb48lewith the BT.2020 matrix stated explicitly.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.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 testpasses (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