Files
hyperframes/packages
Vance Ingalls c7cac1c965 feat(hdr): inject mdcv/clli MP4 container boxes for HDR10 outputs
x265 emits HDR10 mastering display + content light level metadata as
in-band HEVC SEI messages, but FFmpeg's `mov` muxer doesn't extract
those into the container-level `mdcv` (Mastering Display Color Volume)
and `clli` (Content Light Level Info) boxes that ingest pipelines
read. Without them, YouTube, Apple AirPlay, and most HDR TVs see only
stream-level color tagging (`colr`) and treat the file as SDR BT.2020,
silently tone-mapping the output.

Add `mp4HdrBoxes.ts`, which surgically inserts `mdcv` + `clli` boxes
inside the HEVC sample entry (`hvc1`/`hev1`), bumps every parent box's
size, and rewrites every `stco`/`co64` chunk offset that points past
the insertion site so the file stays decodable. Reference: ISO/IEC
14496-15 (NAL-structured video) and ISO/IEC 23001-8 (CICP).

Wire the injection in two places:
  - `streamingEncoder.ts`: post-encode for direct HDR renders, so
    standalone calls into the engine emit YouTube-ready files.
  - `renderOrchestrator.ts`: post-mux for the producer pipeline,
    because FFmpeg's mp4 muxer rebuilds the container during
    mux/faststart and drops the boxes we injected into the
    intermediate video-only file.

Failures degrade to a warning — the file is still playable; only HDR
recognition on strict ingests is affected. Covered by 50+ unit tests
in `mp4HdrBoxes.test.ts` (parser fuzzing, box layout, stco/co64
rewriting, malformed-input rejection).

Made-with: Cursor
2026-04-19 18:34:32 -07:00
..
2026-04-19 23:35:35 +00:00
2026-04-19 23:35:35 +00:00