Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(engine): remove -shortest from muxVideoWithAudio (#1648) (#1650)
Miguel Ángele9957ecaf469
diff --git a/packages/engine/src/services/chunkEncoder.test.ts b/packages/engine/src/services/chunkEncoder.test.tsindex da22a1143b..31a3d416cc 100644--- a/packages/engine/src/services/chunkEncoder.test.ts+++ b/packages/engine/src/services/chunkEncoder.test.ts@@ -394,10 +394,10 @@ describe("muxVideoWithAudio audio codec handling", () => {"make_zero","-r","30",- "-shortest","-y","/tmp/output.mp4",]);+ expect(calls[0]!.args).not.toContain("-shortest");expect(calls[0]!.args).not.toContain("-use_editlist");emitClose(calls[0]!.proc, 0);@@ -545,6 +545,30 @@ describe("muxVideoWithAudio audio codec handling", () => {await expect(muxPromise).resolves.toMatchObject({ success: true });});+ it("does not pass -shortest to ffmpeg (regression #1648)", async () => {+ const { spawn, calls } = createSpawnSpy();+ vi.resetModules();+ vi.doMock("child_process", () => ({ spawn }));++ const { muxVideoWithAudio } = await import("./chunkEncoder.js");++ for (const ext of [".mp4", ".mov", ".webm"] as const) {+ const muxPromise = muxVideoWithAudio(+ `/tmp/video-only${ext}`,+ "/tmp/audio.aac",+ `/tmp/output${ext}`,+ undefined,+ undefined,+ { num: 30, den: 1 },+ );+ if (ext !== ".webm") await flushMuxCodecResolution();+ const call = calls[calls.length - 1]!;+ expect(call.args).not.toContain("-shortest");+ emitClose(call.proc, 0);+ await muxPromise;+ }+ });+it("keeps WebM audio on the Opus transcode path", async () => {const { spawn, calls } = createSpawnSpy();vi.resetModules();diff --git a/packages/engine/src/services/chunkEncoder.ts b/packages/engine/src/services/chunkEncoder.tsindex 02f4ff1aaa..138e01caee 100644--- a/packages/engine/src/services/chunkEncoder.ts+++ b/packages/engine/src/services/chunkEncoder.ts@@ -768,7 +768,7 @@ export async function muxVideoWithAudio(// output container metadata. `-c:v copy` is retained; no re-encode.args.push("-r", fpsToFfmpegArg(fps));}- args.push("-shortest", "-y", outputPath);+ args.push("-y", outputPath);const processTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG.ffmpegProcessTimeout;const result = await runFfmpeg(args, { signal, timeout: processTimeout });