Skip to content

Tag blurred and HyperFrames masters BT.709 correctly on current ffmpeg - #3

Open
ThomasKirst wants to merge 1 commit into
Leonxlnx:mainfrom
ThomasKirst:fix/bt709-color-tags
Open

ThomasKirst wants to merge 1 commit into
Leonxlnx:mainfrom
ThomasKirst:fix/bt709-color-tags

Conversation

@ThomasKirst

@ThomasKirst ThomasKirst commented Oct 17, 2026 •

Copy link
Copy Markdown

Hi, and thanks for cinetic! We used 1.0.0 to make a 29 s product film for our app: a 16:9 master plus 9:16 and 1:1 re-layouts. The probe check caught a colour problem on the way, and this PR fixes it. It is small and self-contained. A second PR with two smaller things (#4) and an issue with notes from the project (#5) are separate.

The film, the debugging and these texts were made together with Claude (Opus 5.5) in Claude Code. Each measurement below comes from a small ffmpeg test that is easy to rerun; happy to share the commands.

Blurred masters: shifted colours and missing tags (accumulate.py)

With ffmpeg 9.0.2 (the current Homebrew version), every render.sh --blur master failed probe.py's colour check with bt709/unknown/unknown/tv.

The cause is the encoder call:

  • accumulate.py pipes finished BT.709 planes as -f rawvideo -i - and gives the colour tags only as output options.
  • ffmpeg 9 then reads the untagged pipe as BT.601 and auto-inserts a conversion to the requested matrix (auto_scale_0 in -v verbose).
  • So the colours shift, and primaries and transfer still come out as unknown.

The fix moves the four tags before -i, so they describe the planes as they are.

64×64 flat #00C2E0, piped as BT.709 yuv420p, crf 0 Y / U / V decoded tags
piped planes 149 / 161 / 42 –
before (tags on the output) 162 / 151 / 42 bt709/unknown/unknown/tv
after (tags on the input) 149 / 161 / 42, bit-exact bt709/bt709/bt709/tv

On accumulate.py itself (8 testsrc2 PNGs, --uniform 2) the tags go from bt709/unknown/unknown to bt709/bt709/bt709.

Sharp hf-finish.sh encodes: missing tags (refs #2)

This is point 3 of #2, and I could reproduce it on ffmpeg 9.0.2 as well: the PNG → H.264 encode comes out bt709/unknown/unknown/tv, because the filter graph's frame properties override the output-side tags. Following the suggestion in #2, the -vf chain now ends in setparams=color_primaries=bt709:color_trc=bt709:colorspace=bt709:range=tv. The decoded pixels are identical before and after (same MD5); only the tags change.

Points 1 and 2 of #2 (bash 3.2, BSD wc) are not part of this PR. For reference: bash -n scripts/hf-finish.sh already fails under macOS's /bin/bash 3.2 on main.

Docs

  • references/finishing.md §4: the corrected recipe, with a short note on both cases (filter graph vs. raw pipe).
  • probe.py: the hint now points to that recipe.
  • CHANGELOG.md: two entries under [Unreleased].

Checks

  • lint-film.test.mjs passes.
  • pick.test.py passes.
  • py_compile passes for all scripts.
  • In our film, the master and both variants pass probe.py with these changes.

- accumulate.py: tag the raw pipe on the input. On the output side ffmpeg 9 reads the untagged
  pipe as BT.601, converts it to BT.709 and still writes unknown primaries and transfer.
- hf-finish.sh: end the sharp encode's -vf chain in setparams so the tags survive (refs Leonxlnx#2).
- finishing.md: the corrected recipe; probe.py's hint points to it.
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