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.
This commit is contained in:
parent
8b2955eb0b
commit
1141ecc43a
@ -58,14 +58,15 @@ export async function POST(request: Request) {
|
|||||||
const info = await probeMedia(input, 600);
|
const info = await probeMedia(input, 600);
|
||||||
if (!info.hasAudio) throw new Error("当前视频没有音轨");
|
if (!info.hasAudio) throw new Error("当前视频没有音轨");
|
||||||
const inputAudio = path.join(dir, "separation-input.wav");
|
const inputAudio = path.join(dir, "separation-input.wav");
|
||||||
|
const durationSeconds = Math.round(info.duration / 1e6);
|
||||||
await ffmpeg(
|
await ffmpeg(
|
||||||
[
|
[
|
||||||
...mediaSafety,
|
...mediaSafety,
|
||||||
"-i",
|
"-i",
|
||||||
input,
|
input,
|
||||||
"-vn",
|
"-vn",
|
||||||
"-af",
|
"-t",
|
||||||
"apad",
|
String(durationSeconds),
|
||||||
"-ac",
|
"-ac",
|
||||||
"2",
|
"2",
|
||||||
"-ar",
|
"-ar",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user