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
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
| Failure | ffmpeg 4.4 and 6.0 | ffmpeg 7.0 to 8.1 | Line in stderr |
|---|---|---|---|
| Input file missing | 1 | 254 | No such file or directory |
| Odd height with libx264 | 1 | 187 | height not divisible by 2 (720x405) |
| Filter typo (scal=720:-2) | 1 | 234 | Error parsing filterchain |
| Unknown option (-crff) | 1 | 8 | Unrecognized option 'crff'. |
| Bad x264 preset | 1 | 234 | invalid preset 'superfastest' |
| Empty input (/dev/null) | 1 | 183 | Invalid 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.
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");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 1Skip 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.
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();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.
- Error: spawn ffmpeg ENOENTNode cannot find an ffmpeg program on PATH. Install it, spawn the ffmpeg-static path, or send the same args to an API.
- height not divisible by 2libx264 refuses a 4:2:0 frame with an odd width or height. Scale with -2, round odd sources to even, or send the args to an API.
- Unknown encoder 'libx264'Your ffmpeg build has no x264 inside. Use libopenh264, install a GPL build, or send the same args to an API that has libx264.
- moov atom not foundThe MP4's index is missing, usually because the file was cut off. Re-fetch it, repair it with untrunc, or move the moov first.
- ReelSDK vs fluent-ffmpegfluent-ffmpeg was archived in May 2025 but still gets 3.6 million downloads a week. ReelSDK runs the same ffmpeg arguments on ffmpeg 8.1: a 720p transcode plus thumbnail for about a fifth of a cent.
- Resize a video with ffmpegScale a video with scale=w:h: keep the aspect ratio with -2, fit a 1080x1920 frame with pad, and fix the odd-size error.
- Resize videoRender 9:16, 1:1, 4:5 and 16:9 copies of one video in a single ffmpeg call, about 2 cents for all 4 from a 30 s clip.
- ReelSDK vs self-hosted FFmpegTranscoding a minute of 1080p to 720p takes about 24 seconds of compute: about 0.8 cents on ReelSDK, about a tenth of a cent on a busy 4 vCPU box. Below about 11,000 minutes a month, the API costs less than an always-on box.
- How do I use ffmpeg?Install ffmpeg on macOS, Windows or Ubuntu, learn the order a command follows, and copy 6 everyday commands, or run it online.
Sources, checked November 2026
Ready to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
