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
[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
| ffmpeg you have | libx264 | What to do |
|---|---|---|
| BtbN lgpl or lgpl-shared build | No, built with --disable-libx264 | -c:v libopenh264, or the gpl build |
| Fedora ffmpeg-free | No, x264 is off | -c:v libopenh264, or the RPM Fusion ffmpeg |
| Debian 13 or Ubuntu 24.04 apt ffmpeg | Yes | Check that your PATH runs this ffmpeg |
| ffmpeg-static from npm | Yes, in every version we checked | Spawn its path, not a system ffmpeg |
| imageio-ffmpeg from pip | Yes | Use get_ffmpeg_exe() for the path |
| BtbN gpl build | Yes | Nothing 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.
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)ffmpeg -i in.mp4 -c:v libopenh264 -b:v 4M -c:a aac out.mp4# 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.mp4Skip 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.
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();-c:v libx264 -crf 23 command on the API: 1920x1080 in H.264 High.Input: 1920x1080 inputTwo 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.
- 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.
- ffmpeg exited with code 1: Conversion failed!fluent-ffmpeg reports only ffmpeg's exit code and last line. The real cause is in stderr: print it, or use -v error to see it alone.
- FileNotFoundError: No such file or directory: 'ffmpeg'Python asked the OS for a program called ffmpeg and found none on its PATH. Install it, use imageio-ffmpeg, or call ffmpeg over HTTP.
- 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.
- Choose a CRF value in ffmpegWhat CRF does in libx264, the file size and VMAF score for CRF 18, 23, 28 and 33 on one clip, and how x265's scale differs.
- Compress a video with ffmpegShrink a video with ffmpeg: CRF 28 in x264 or x265, a smaller frame or a slower preset, with the size and quality each one gets you.
- Encode H.265 (HEVC) with ffmpegEncode HEVC with libx265: CRF 28 against x264 CRF 23 on one clip, the hvc1 tag Apple players need, and 10-bit output.
- Video conversionConvert WebM, MKV or MOV to MP4 and back in one ffmpeg call, about a third of a cent for 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.
Ready to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
