mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 23:03:09 +00:00
test(engine): pin ALPHA_MODE uppercase ffprobe tag regression
Locks in the case-insensitive behavior alongside the existing alpha_mode (lowercase) test. If either path regresses, the producer would silently extract alpha-having webms as opaque JPGs and the injected <img> overlays would cover every element below them on the z-stack — a bug that doesn't surface in the studio preview, only in production renders. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -225,6 +225,46 @@ describe("ffprobe missing-binary fallback", () => {
|
|||||||
expect(meta.hasAlpha).toBe(true);
|
expect(meta.hasAlpha).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Regression: newer libavformat builds (and the output of `hyperframes
|
||||||
|
// remove-background` itself) write the VP9-alpha sidecar tag as
|
||||||
|
// `ALPHA_MODE` (uppercase). The lowercase-only check classified those
|
||||||
|
// files as having no alpha, the producer extracted them as JPGs, and
|
||||||
|
// the injected <img> overlays were fully opaque rectangles that hid
|
||||||
|
// every static element below them on the z-stack. The bug was silent —
|
||||||
|
// studio preview rendered correctly via native <video> playback while
|
||||||
|
// production renders covered headlines and captions with the avatar.
|
||||||
|
it("extractMediaMetadata detects ALPHA_MODE (uppercase) streams from newer ffmpeg builds", async () => {
|
||||||
|
const { spawn } = createSpawnSpy([
|
||||||
|
{
|
||||||
|
kind: "exit",
|
||||||
|
code: 0,
|
||||||
|
stdout: JSON.stringify({
|
||||||
|
streams: [
|
||||||
|
{
|
||||||
|
codec_type: "video",
|
||||||
|
codec_name: "vp9",
|
||||||
|
width: 320,
|
||||||
|
height: 180,
|
||||||
|
r_frame_rate: "30/1",
|
||||||
|
avg_frame_rate: "30/1",
|
||||||
|
pix_fmt: "yuv420p",
|
||||||
|
tags: { ALPHA_MODE: "1" },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
format: { duration: "1.5" },
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
vi.resetModules();
|
||||||
|
vi.doMock("child_process", () => ({ spawn }));
|
||||||
|
|
||||||
|
const { extractMediaMetadata: extractMediaMetadataMocked } = await import("./ffprobe.js");
|
||||||
|
const meta = await extractMediaMetadataMocked("/tmp/alpha-uppercase.webm");
|
||||||
|
|
||||||
|
expect(meta.videoCodec).toBe("vp9");
|
||||||
|
expect(meta.hasAlpha).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it("extractMediaMetadata rethrows ffprobe-missing error for non-image files without fallback", async () => {
|
it("extractMediaMetadata rethrows ffprobe-missing error for non-image files without fallback", async () => {
|
||||||
const { spawn } = createSpawnSpy([{ kind: "missing" }]);
|
const { spawn } = createSpawnSpy([{ kind: "missing" }]);
|
||||||
vi.resetModules();
|
vi.resetModules();
|
||||||
|
|||||||
Reference in New Issue
Block a user