Unknown encoder 'libx264' means your ffmpeg was built without x264, as LGPL builds are, and it exits with code 8. Use libopenh264 or a GPL build, or send the args to ReelSDK, which has libx264, at $0.02 per compute minute.

Unknown encoder 'libx264'

We reproduced it with BtbN's LGPL build of ffmpeg 8.1, which lists 236 encoders, none of them libx264, and it quit before decoding a frame. ReelSDK ran the same command in about 11 seconds and returned 1080p H.264 High.

ErrorsUpdated

ffmpeg 8.1 lgpl build, -c:v libx264, exit code 8
[vost#0:0 @ 0x560921ebe240] Unknown encoder 'libx264'
[vost#0:0 @ 0x560921ebe240] Error selecting an encoder
Error opening output file out.mp4.
Error opening output files: Encoder not found

Source: BtbN FFmpeg-Builds README, checked November 2026.

Where it shows up

ffmpeg fails while it sets up the output

You ask for -c:v libx264, yourself or through a wrapper, on an ffmpeg that was compiled without x264. We ran ffmpeg -i in.mp4 -c:v libx264 out.mp4 with BtbN's lgpl build of ffmpeg 8.1 on a 1080p video.

ffmpeg prints Unknown encoder 'libx264', then Error selecting an encoder, Error opening output file out.mp4. and Error opening output files: Encoder not found. It exits with code 8 and writes no file. Your command is fine; the encoder is not in the binary.

Why it happens

x264 is GPL, so LGPL builds leave it out

FFmpeg's configure script lists libx264 and libx265 as GPL libraries: they are only built with --enable-gpl, and the result is a GPL binary. Builds meant to stay LGPL, often so they can ship inside closed-source apps, leave them out.

BtbN's build page says it plainly: the lgpl variant is "Lacking libraries that are GPL-only. Most prominently libx264 and libx265." Fedora's own ffmpeg package, ffmpeg-free, is built with x264 and x265 off and openh264 on. Both still have an H.264 encoder: libopenh264, Cisco's.

Causes and fixes

Which ffmpeg has libx264

Which ffmpeg has libx264
ffmpeg you havelibx264What to do
BtbN lgpl or lgpl-shared buildNo, built with --disable-libx264-c:v libopenh264, or the gpl build
Fedora ffmpeg-freeNo, x264 is off-c:v libopenh264, or the RPM Fusion ffmpeg
Debian 13 or Ubuntu 24.04 apt ffmpegYesCheck that your PATH runs this ffmpeg
ffmpeg-static from npmYes, in every version we checkedSpawn its path, not a system ffmpeg
imageio-ffmpeg from pipYesUse get_ffmpeg_exe() for the path
BtbN gpl buildYesNothing to fix

Source: BtbN FFmpeg-Builds README, checked November 2026.

The local fix

Use the H.264 encoder you have, or get a GPL build

Check what your build can encode with ffmpeg -hide_banner -encoders. On the lgpl build, -c:v libopenh264 -b:v 4M encoded the same video cleanly: a 5 MB H.264 file in Constrained Baseline profile, in under 4 seconds. libopenh264 takes a bitrate, so set -b:v.

For libx264 itself, install a build that has it. In our checks it was there in Debian 13's ffmpeg, in ffmpeg-static from npm, in imageio-ffmpeg from pip, and in BtbN's gpl build, where -c:v libx264 -crf 23 wrote a 5.3 MB H.264 High file.

check-encoders.sh
ffmpeg -hide_banner -encoders | grep 264
# lgpl build:  V....D libopenh264  OpenH264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
# gpl build:   V....D libx264      libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
openh264.sh
ffmpeg -i in.mp4 -c:v libopenh264 -b:v 4M -c:a aac out.mp4
gpl-build.sh
# Debian or Ubuntu
sudo apt install ffmpeg

# Fedora: swap ffmpeg-free for the RPM Fusion build
sudo dnf swap ffmpeg-free ffmpeg --allowerasing

ffmpeg -i in.mp4 -c:v libx264 -crf 23 -c:a aac out.mp4

Skip the binary

Or send the same args to the API

POST /v1/ffmpeg runs your args on ffmpeg 8.1 with libx264 built in, on a fresh machine per job, so -c:v libx264 just works. The same command wrote a 1080p H.264 High out.mp4 about 11 seconds after the request.

Compute is $0.02 per minute, billed per second with a 1 s minimum, so that job cost well under a cent. Failed jobs are not billed, and a new account gets $0.50 of free credit.

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", "-c:v", "libx264", "-crf", "23", "-c:a", "aac",
      "out.mp4"
    ],
    "outputs": ["out.mp4"]
  }),
});
const { job } = await res.json();
The same -c:v libx264 -crf 23 command on the API: 1920x1080 in H.264 High.Input: 1920x1080 input

Two ffmpegs on one machine

If ffmpeg -encoders in your terminal shows libx264 and your app still fails, your app runs a different binary. The first lines of the error output name the build: an lgpl build prints --disable-libx264 in its configuration: line. Print the path your code spawns and run -encoders on that exact file.

Hardware encoders such as h264_nvenc, h264_qsv and h264_vaapi appear in the encoder list of both BtbN builds, but they only run with the matching GPU and driver, so they are no fallback on a plain server.

FAQ

Questions, answered

Why would an ffmpeg build leave out libx264?

Licensing. x264 is GPL, and FFmpeg only builds it with --enable-gpl, which makes the whole binary GPL. LGPL builds such as BtbN's lgpl variant and Fedora's ffmpeg-free leave it out and ship libopenh264 instead.

Is libopenh264 a drop-in replacement?

For most H.264 jobs, yes, with two changes: it takes a bitrate (-b:v) rather than -crf, and it writes Constrained Baseline profile. On our 10-second test video, -b:v 4M gave 5 MB and libx264 -crf 23 gave 5.3 MB in High profile.

How do I check whether my ffmpeg has libx264?

Run ffmpeg -hide_banner -encoders | grep libx264. A build with x264 prints a line for libx264 (and libx264rgb); an LGPL build prints nothing.

Does the API have libx264?

Yes. POST /v1/ffmpeg runs ffmpeg 8.1 with libx264, and the -c:v libx264 -crf 23 job on this page wrote an H.264 High file.

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