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

  1. Read the logged stderr line — it carries ffmpeg's actual error reason.
  2. Reproduce manually: `ffmpeg -i <input> -ar 16000 -ac 1 -acodec pcm_f32le -y <out>`.
  3. Confirm the build has pcm_f32le: `ffmpeg -encoders | grep pcm_f32le`.
  4. 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

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


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/246403e2331dc699. Report an issue: GitHub.