hyperframes icon indicating copy to clipboard operation
hyperframes copied to clipboard

Proposal: a known-colour render check that works on any machine

Open diegolopezrm opened this issue 1 month ago • 1 comments

Problem

The render tests compare each output with a golden video made by the same pipeline inside the Docker test image. That catches changes, but not colours that were wrong when the golden was made: when #4564 fixed the BT.709 matrix it had to regenerate eight goldens, because the old shift was baked into them. And outside Docker nothing looks at colour. The Windows job checks size, fps and duration, and there's no render job on macOS, where renders use drawElement capture and the system ffmpeg by default.

Proposed solution

One small composition with 20 flat swatches whose sRGB values are known: primaries, a few skin and brand-like tones, and greys from 0 to 255 including 8, 16 and 32. Render it, decode one frame using the output's own colour tags, and check the centre of each swatch against its authored value, within 2 levels. There's no golden file, so the same check runs in Docker, on Windows and on a Mac. An output without colour tags fails, since players have to guess how to read it.

I built a prototype outside the repo and ran it against an old release and the current one:

build where swatches off by more than 2 worst
0.8.78 Docker 13 of 20 39
0.8.78 macOS 12 of 20 4
0.8.143 Docker, mp4 0 2
0.8.143 macOS, mp4 (drawElement, screenshot and --gpu) 0 2

So it would have caught the two encode problems #4564 fixed, and #4899, before they shipped. It also turned up #5380: --format mov writes ProRes with the BT.601 matrix and no tags. A second fixture could do the same with a known-colour video clip, to cover footage extraction too.

Where it could go, roughly in this order:

  1. A fixture in packages/producer/tests/ with the expected colours in its meta.json, checked by the regression harness next to PSNR, for mp4, webm, mov and png-sequence.
  2. The same check in the Windows render job, which already renders a canary.
  3. A macOS job, if the runners can do drawElement capture. I'm not sure they have a GPU.

Alternatives considered

Comparing a Docker render against a Mac render directly. Chrome and ffmpeg versions differ between them, so text and edges never match exactly and you end up tuning PSNR per platform. Flat swatches with known values avoid that.

Additional context

A few questions before I write anything. Does this belong in the regression harness, or would you rather have a separate script? Is it OK to fail untagged output, or should WebM keep relying on Chrome reading untagged VP9 as BT.601? Is ±2 a reasonable tolerance? Happy to send it in small PRs, starting with the fixture and the harness check.

diegolopezrm avatar Oct 09 '26 22:10 diegolopezrm

Thanks for this, and for the #5382 fix that came out of it. One update for context: since you filed, #5742 (in 0.8.174) made every encoder write full colour tags, so failing untagged output should affect fewer formats than when you wrote this. The three questions at the end are ours to answer; we'll reply here before you start on the fixture.

miguel-heygen avatar Oct 24 '26 18:10 miguel-heygen