Error: ffmpeg exited with code 1: Conversion failed! means fluent-ffmpeg dropped ffmpeg's real error, which sits in stderr. Print stderr to see the cause, then fix the args; ReelSDK runs them for $0.02 per compute minute.

Error: ffmpeg exited with code 1: Conversion failed!

We triggered it with fluent-ffmpeg on Node.js 22 by scaling 1920x1080 video to 720 wide with -1, and the same args failed on ReelSDK with HTTP 422, at no charge. The real cause was in stderr: height not divisible by 2 (720x405).

ErrorsUpdated

fluent-ffmpeg 2.1.3, Node.js 22, ffmpeg 6.0, scale=720:-1 on a 1920x1080 clip
Error: ffmpeg exited with code 1: Conversion failed!

    at ChildProcess.<anonymous> (/home/user/workspace/node_modules/fluent-ffmpeg/lib/processor.js:180:22)
    at ChildProcess.emit (node:events:519:28)
    at ChildProcess._handle.onexit (node:internal/child_process:293:12)

Source: fluent-ffmpeg utils.js (extractError), checked November 2026.

Where it shows up

A Node.js job that dies with only an exit code

You run ffmpeg from Node.js with fluent-ffmpeg, and the job fails with nothing but a code. Our test: fluent-ffmpeg 2.1.3 on Node.js 22, .videoFilters('scale=720:-1').videoCodec('libx264') on a 10-second 1920x1080 clip. With ffmpeg 6.0, the error reads ffmpeg exited with code 1: Conversion failed!.

Point the same code at ffmpeg 7 or later and it becomes ffmpeg exited with code 187: Conversion failed!. Either way the message names no file, option or filter, and the stack trace only leads into fluent-ffmpeg's own processor.js.

Why it happens

The real error is in stderr, and fluent-ffmpeg drops it

fluent-ffmpeg builds its message from the last lines of stderr that do not start with [ or a space. ffmpeg prints its causes with a prefix such as [libx264 @ 0x...], so the line that matters, height not divisible by 2 (720x405), is thrown away and Conversion failed! is all that is left.

The exit code does not say much either. ffmpeg 4.4 and 6.0 exited with 1 for all six failures we tried. From ffmpeg 7.0, main() returns the error code itself and the shell keeps its low byte: 8.1 logged Task finished with error code: -542398533 (Generic error in an external library) and exited with 187.

Causes and fixes

Exit codes we measured, and the line that names the cause

Exit codes we measured, and the line that names the cause
Failureffmpeg 4.4 and 6.0ffmpeg 7.0 to 8.1Line in stderr
Input file missing1254No such file or directory
Odd height with libx2641187height not divisible by 2 (720x405)
Filter typo (scal=720:-2)1234Error parsing filterchain
Unknown option (-crff)18Unrecognized option 'crff'.
Bad x264 preset1234invalid preset 'superfastest'
Empty input (/dev/null)1183Invalid data found when processing input

Source: ffmpeg.c in FFmpeg 7.0, checked November 2026.

The local fix

Print stderr, read the first error line, fix that

The error handler gets stderr as its third argument, so print it. Or run the same args in a shell with -v error: on ffmpeg 6.0 that left two lines, and the first, height not divisible by 2 (720x405), is the cause. Do not trust the last line: in our full stderr, two [aac] lines came after the real error.

Here the fix is scale=720:-2, which rounds the height to an even 406. On ffmpeg 6.0 the fixed script finished in about 6 seconds and wrote a 720x406 file.

convert.mjs
import ffmpeg from "fluent-ffmpeg";

const started = Date.now();

ffmpeg("in.mp4")
  .videoFilters("scale=720:-2")
  .videoCodec("libx264")
  .on("error", (error, stdout, stderr) => {
    console.error(error.message);
    console.error(stderr);
  })
  .on("end", () => console.log(`done in ${Date.now() - started} ms`))
  .save("fixed.mp4");
find-the-cause.sh
ffmpeg -v error -y -i in.mp4 -vf scale=720:-1 -c:v libx264 out.mp4; echo "exit $?"
# [libx264 @ 0xd0bc540] height not divisible by 2 (720x405)
# [vost#0:0/libx264 @ 0xd1713c0] Error initializing output stream: Error while opening encoder ...
# exit 1

Skip the binary

Or run the same args on the API

POST /v1/ffmpeg takes the argv fluent-ffmpeg builds and runs it on ffmpeg 8.1 on a fresh machine per job. Our scale=720:-1 args failed with HTTP 422 FFMPEG_FAILED, at no charge; with scale=720:-2 the job wrote a 720x406 out.mp4 about 5 seconds after the request.

Compute is $0.02 per minute, billed per second, so the fixed job cost under a fifth of a cent, and your server no longer ships an ffmpeg binary at all.

convert.mjsTry it
const res = await fetch("https://api.reelsdk.com/v1/ffmpeg?wait=60", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.REELSDK_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "inputs": {
      "in.mp4": "https://api.reelsdk.com/f/lib/demo/landscape.mp4"
    },
    "args": [
      "-i", "in.mp4", "-y", "-vcodec", "libx264", "-filter:v",
      "scale=720:-2", "out.mp4"
    ],
    "outputs": ["out.mp4"]
  }),
});
const { job } = await res.json();
fluent-ffmpeg's argv with scale=720:-2 on the API: an even 720x406.Input: landscape.mp4

What the exit code tells you on ffmpeg 7 and later

From 7.0 the exit code is the low byte of ffmpeg's error code: 254 is -2, no such file; 234 is -22, invalid argument, which covered both a filter typo and a bad preset; 187 is a failure inside an external library such as libx264; 183 is invalid data; 8 is an unknown option.

That narrows the search, but only the stderr line tells you which file, filter or setting to change. If you spawn ffmpeg yourself instead of using fluent-ffmpeg, keep stderr and log it whenever the exit code is not 0.

FAQ

Questions, answered

What does ffmpeg exit code 1 mean?

Only that ffmpeg failed. ffmpeg 4.4 and 6.0 exited with 1 for all six failures we tried, from a missing file to a bad preset. The cause is in stderr.

Why does fluent-ffmpeg only say Conversion failed!?

It builds the message from the last stderr lines that do not start with [ or a space, and ffmpeg prefixes its real errors with [libx264 @ 0x...] or similar. The full text is the third argument of the error handler.

Why do I get 187 or 234 instead of 1?

You are on ffmpeg 7.0 or later, which exits with the low byte of the error code. With the same script, ffmpeg 7.1 gave 187 where 6.0 gave 1.

Is fluent-ffmpeg still maintained?

No. npm marks 2.1.3 as deprecated with Package no longer supported, and its GitHub repository is archived. It still ran in our tests, but nothing will change how it reports errors.

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains