mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-01 19:42:03 +00:00
fix(engine): detect VP9 alpha tag case-insensitively in ffprobe
Newer libavformat builds write the VP9-alpha sidecar tag as 'ALPHA_MODE' (uppercase); older builds write 'alpha_mode'. ffprobe.ts only checked the lowercase form, so files produced by recent ffmpeg encoders (including the output of 'hyperframes remove-background' itself) were misclassified as having no alpha channel. Knock-on effect: the producer extracted them as JPGs (no alpha), the injected <img> overlays were fully opaque rectangles, and any element below them on the z-stack (text, captions, other layers) silently disappeared from the rendered output — even though the studio preview rendered the same composition correctly via native <video> playback. Symptom in our repro: a text-behind-subject composition showed the headline correctly in studio preview but the production render covered the headline entirely with the opaque avatar image. Fix: read videoStream.tags.alpha_mode OR videoStream.tags.ALPHA_MODE. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -277,7 +277,13 @@ export async function extractMediaMetadata(filePath: string): Promise<VideoMetad
|
||||
: null;
|
||||
const colorSpace = ffprobeColorSpace ?? stillImageMeta?.colorSpace ?? null;
|
||||
const pixelFormat = videoStream.pix_fmt || "";
|
||||
const alphaMode = videoStream.tags?.alpha_mode || "";
|
||||
// ffmpeg writes the VP9-alpha sidecar tag as either `alpha_mode` (older
|
||||
// builds) or `ALPHA_MODE` (libavformat ≥ 6.x). Read case-insensitively
|
||||
// so the alpha-aware extraction path triggers on both — without this
|
||||
// the producer extracted alpha-having webms as opaque JPGs and the
|
||||
// injected <img> covered everything below it on the z-stack.
|
||||
const tags = (videoStream.tags ?? {}) as Record<string, string | undefined>;
|
||||
const alphaMode = tags.alpha_mode ?? tags.ALPHA_MODE ?? "";
|
||||
const hasAlpha =
|
||||
/(^|[^a-z])yuva|rgba|argb|bgra|gbrap|gray[a-z0-9]*a/i.test(pixelFormat) || alphaMode === "1";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user