From 1141ecc43a1e006a48171e59f4ec8d1c9bd96c18 Mon Sep 17 00:00:00 2001 From: 134 Date: Sat, 19 Sep 2026 14:33:06 +0800 Subject: [PATCH] Bound separation input WAV duration to the probed length The unbounded apad filter made ffmpeg pad the 3-second test clip endlessly (a 22.9GB WAV) until the disk filled, which was the real cause of the voice separation failures. Trim to the probed duration and drop apad. --- app/api/canvas/audio-separate/route.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/api/canvas/audio-separate/route.ts b/app/api/canvas/audio-separate/route.ts index 0ab3de8d9..c5050c390 100644 --- a/app/api/canvas/audio-separate/route.ts +++ b/app/api/canvas/audio-separate/route.ts @@ -58,14 +58,15 @@ export async function POST(request: Request) { const info = await probeMedia(input, 600); if (!info.hasAudio) throw new Error("当前视频没有音轨"); const inputAudio = path.join(dir, "separation-input.wav"); + const durationSeconds = Math.round(info.duration / 1e6); await ffmpeg( [ ...mediaSafety, "-i", input, "-vn", - "-af", - "apad", + "-t", + String(durationSeconds), "-ac", "2", "-ar",