Skip to content

Detect ProRes 4444 alpha from sample-entry depth (3.1.1) - #4

Merged
aagedal merged 1 commit into
mainfrom
fix/prores-4444-alpha
Oct 31, 2026
Merged

aagedal merged 1 commit into
mainfrom
fix/prores-4444-alpha

Conversation

@aagedal

@aagedal aagedal commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Problem

MP4Parser.applyFourCCDefaults set pixelFormat = "yuva444p12le" for every ProRes 4444 / 4444 XQ (ap4h / ap4x) stream. Alpha is optional in 4444, and opaque camera and grading masters were reported with an alpha plane. ffprobe reports yuv444p12le for those. Aagedal Media Converter uses this field to decide whether to keep alpha, so opaque masters got a forced alpha plane in ProRes exports and an all-white matte sidecar.

Fix

  • The VisualSampleEntry depth decides alpha for ap4h/ap4x: 32 gives yuva444p12le, 24 gives yuv444p12le.
  • For any other depth, the first frame header's alpha_channel_type decides (the field ffprobe uses). This is a 26-byte read at the first stco/co64 offset in the already-mapped file, the same pattern the tmcd and BRAW paths use. With no usable signal the stream is reported opaque.
  • hasAlphaChannel is now true or false for these streams.
  • For ProRes the depth field no longer feeds bitDepth, so 4444 stays at 12.
  • FourCC defaults now apply even when a sample entry has no child boxes. Before, they were skipped by an early return.

Matroska (V_PRORES) and MXF don't assume alpha. MKV reports no ProRes pixel format at all. MXF derives yuv444p12le from the CDCI descriptor, so it misses alpha on 4444-with-alpha MXF (ffprobe needs the frame for that). That's a separate gap and isn't changed here.

Release

Bumps to 3.1.1 (CLI version, README, CHANGELOG, RELEASE_CHECKLIST). Not tagged. Tag after merge, once confirmed.

Testing

  • New synthetic sample-entry tests in MP4ParserTests: depth 24, depth 32, ap4x, depth 48 (not read as bitDepth), missing depth with a frame-header alpha of 1 or 0, depth taking precedence over the frame header, and the opaque default.
  • Real files: ffmpeg prores_ks ap4h/ap4x MOVs with and without alpha, plus copies with the depth zeroed (frame-header path). pixelFormat matches ffprobe in all 8 cases.
  • scripts/verify-release.sh 3.1.1 passed: 1686 library tests (21 skipped, 0 failures), CLI tests, and the release archive build.

🤖 Generated with Claude Code

ap4h/ap4x streams were always reported as yuva444p12le, but alpha is
optional in ProRes 4444 and most masters are opaque. Use the
VisualSampleEntry depth (32 = alpha, 24 = opaque) and, when that is
inconclusive, the first frame header's alpha_channel_type, matching
ffprobe. Also set hasAlphaChannel, keep the depth out of bitDepth for
ProRes, and apply FourCC defaults to sample entries with no children.

Prepare the 3.1.1 patch release (version, README, changelog, checklist).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aagedal
aagedal merged commit 9cb98a4 into main Oct 31, 2026
3 checks 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.

1 participant