fix(cli): warn when a WebM render silently drops its alpha channel [P2]#2044
Open
miguel-heygen wants to merge 1 commit into
Open
fix(cli): warn when a WebM render silently drops its alpha channel [P2]#2044miguel-heygen wants to merge 1 commit into
miguel-heygen wants to merge 1 commit into
Conversation
HyperFrames always encodes WebM with an alpha-capable pixel format (yuva420p), but some ffmpeg/libvpx builds silently emit opaque yuv420p even when handed alpha input and -pix_fmt yuva420p. The render succeeds and plays back fine, so the lost transparency is only discovered after compositing (users report shipping a solid-black clip and colorkeying it out by hand). After a WebM render, best-effort ffprobe the output's pix_fmt; if it lacks alpha, print a non-blocking warning that names the concrete remedy (--format mov / ProRes 4444). Only WebM is checked (mp4 is intentionally opaque; mov/png carry alpha through paths that don't hit libvpx-vp9), and a failed probe stays silent rather than warning speculatively. Pure decision (pixelFormatHasAlpha / webmAlphaAdvisory) unit-tested; verified end-to-end that a transparent WebM render now surfaces the warning while an MP4 render stays silent.
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.
What
After a WebM render completes, best-effort
ffprobethe output'spix_fmt; if it lacks alpha, print a non-blocking warning that names the concrete remedy (--format mov).Why
HyperFrames always encodes WebM with an alpha-capable pixel format (
needsAlpha = isWebm || isMov || isPngSequence→yuva420p). But some ffmpeg/libvpx builds silently emit opaqueyuv420peven when handed genuine alpha (PNG) input plus-pix_fmt yuva420p -auto-alt-ref 0 -metadata alpha_mode=1— the encode args are already textbook-correct; the build just drops the alpha plane. The render succeeds and plays back fine, so the lost transparency is only discovered after compositing.Reproduced end-to-end (transparent HTML/CSS composition, single
<h1>, GSAP opacity tween, no video/image):Isolation confirmed it's the ffmpeg build, not HyperFrames: even a direct transparent RGBA PNG through the exact encode args yields
yuv420pon the affected build (libvpx-vp9 and libvpx/vp8). So the alpha-drop itself is upstream and unfixable in HF; what HF can do is stop shipping a silently-wrong file. This is the HF-side root fix: verify the output matches what we requested.Scope / safety
yuva420p, a probed non-alphapix_fmtis an unambiguous "alpha was requested but not delivered" signal — and on builds where VP9 alpha does work, the probe seesyuva420pand stays silent.ffprobestays silent rather than warning speculatively. Never fails a completed render.Tests
pixelFormatHasAlpha,webmAlphaAdvisory) unit-tested (7 cases).New user-facing output