Mintplex-Labs/anything-llm · error · Error
FFMPEG conversion failed
Error message
FFMPEG conversion failed
What it means
After spawnSync runs ffmpeg with the conversion args, if result.status !== 0 the wrapper throws. ffmpeg writes its diagnostics to stderr, which is logged just before the throw — so the real reason is in the logs, not the exception text.
Source
Thrown at collector/utils/WhisperProviders/ffmpeg/index.js:108
await this.ffmpegPath(),
[
"-i",
inputPath,
"-ar",
"16000",
"-ac",
"1",
"-acodec",
"pcm_f32le",
"-y",
outputPath,
],
{ encoding: "utf8" }
);
// ffmpeg writes progress to stderr
if (result.stderr) this.log(result.stderr.trim());
if (result.status !== 0) throw new Error(`FFMPEG conversion failed`);
this.log(`Conversion complete: ${path.basename(outputPath)}`);
return true;
}
}
module.exports = { FFMPEGWrapper };
View on GitHub (pinned to 526360e320)
Solutions
- Read the logged stderr line — it carries ffmpeg's actual error reason.
- Reproduce manually: `ffmpeg -i <input> -ar 16000 -ac 1 -acodec pcm_f32le -y <out>`.
- Confirm the build has pcm_f32le: `ffmpeg -encoders | grep pcm_f32le`.
- Verify the output directory is writable and has free space.
Example fix
// before
if (result.status !== 0) throw new Error(`FFMPEG conversion failed`);
// after — surface ffmpeg's stderr in the exception
if (result.status !== 0) {
const detail = (result.stderr || "").trim().split("\n").pop();
throw new Error(`FFMPEG conversion failed (status ${result.status}): ${detail}`);
} Defensive patterns
Strategy: try-catch
Validate before calling
const { spawnSync } = require("child_process");
function inputDecodable(input) {
const r = spawnSync("ffmpeg", ["-i", input, "-f", "null", "-"], { stdio: "pipe" });
// ffmpeg returns non-zero but still decodes; rely on stderr codec lines instead if needed
return r.stderr && /Audio:/.test(r.stderr);
} Try / catch
try { await ffmpeg.convertAudioToWav(inPath, outPath); }
catch (e) {
if (e.message === "FFMPEG conversion failed") {
/* check server logs for the ffmpeg stderr line just before this throw */
return null;
}
throw e;
} Prevention
- Validate the input is a real audio file before conversion.
- Use a ffmpeg build with a full encoder set (not a minimal distro).
- Log result.stderr alongside the exception for diagnostics.
When it happens
Trigger: ffmpeg exited non-zero: corrupt/unreadable input, unsupported input codec, missing pcm_f32le encoder, disk full, outputPath directory unwritable, or an invalid output path.
Common situations: Input is not real audio (wrong MIME); a stripped ffmpeg build lacking pcm_f32le; outputPath on a read-only/full volume; truncated download fed as input.
Related errors
- Audio conversion failed.
- FFMPEG candidate path not found.
- FFMPEG candidate path is not valid ffmpeg binary.
- FFMPEG binary not found.
- Input file ${inputPath} does not exist.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/246403e2331dc699.
Report an issue: GitHub.