Unknown encoder 'libx264' and Encoder not found are among the most common errors you’ll run into with FFmpeg. This article walks through the typical error patterns and how to fix them.

Tested with ffmpeg 6.1


Error 1: Unknown encoder / Encoder not found

Error message

Unknown encoder 'libx264'
Encoder libx265 not found.

Cause

This happens when your FFmpeg build doesn’t include the target codec library. Many Linux distributions ship a minimal build due to licensing concerns.

How to fix

1. Check which encoders are available:

ffmpeg -encoders | grep 264
ffmpeg -encoders | grep 265
ffmpeg -encoders | grep hevc

2. Install a full FFmpeg build:

# Ubuntu / Debian — from the universe repository
sudo apt update && sudo apt install ffmpeg

# macOS — Homebrew (with gpl + nonfree options)
brew install ffmpeg

# Windows — the full build from the official site
# Download "full_build" from https://ffmpeg.org/download.html

3. Use an alternative encoder:

PurposeRecommended encoderExample command
H.264libx264-c:v libx264
H.264 (alternative)libopenh264-c:v libopenh264
H.265/HEVClibx265-c:v libx265
AV1libaom-av1-c:v libaom-av1
AV1 (fast)libsvtav1-c:v libsvtav1
VP9libvpx-vp9-c:v libvpx-vp9

Error 2: codec not currently supported in container

Error message

Encoder mpeg4 not supported in MPEG-4 Part 2 container.

or

Codec vp9 is not supported by the mp4 muxer.

Cause

The codec and output container combination isn’t supported.

How to fix

Change the container:

# Use WebM for VP9
ffmpeg -i input.mp4 -c:v libvpx-vp9 output.webm

# Use MKV or WebM for AV1
ffmpeg -i input.mp4 -c:v libaom-av1 output.mkv

Change the codec:

# For MP4, use H.264
ffmpeg -i input.mkv -c:v libx264 -c:a aac output.mp4

Error 3: Requested output format ‘xxx’ is not a suitable output format

Error message

Unable to find a suitable output format for 'output.mts'

Cause

FFmpeg can’t determine the output format from the file extension.

How to fix

Specify the format explicitly with -f:

ffmpeg -i input.mp4 -f mpegts output.mts

List available formats:

ffmpeg -formats

Error 4: width/height not divisible by 2

Error message

height not divisible by 2 (1280x721)

Cause

Codecs like H.264 require width and height to be multiples of 2.

How to fix

ffmpeg -i input.mp4 -vf scale=1280:-2 output.mp4

-2 means “preserve aspect ratio while rounding to an even number.”


Check Codec Compatibility in Advance

# List available encoders
ffmpeg -encoders

# List available decoders
ffmpeg -decoders

# Details of a specific codec
ffmpeg -h encoder=libx264

Checking Build Flags

ffmpeg -buildconf | grep enable

If --enable-libx264 or --enable-libx265 appears, the codec is available in your build.


Frequently Asked Questions

What does “Codec not currently supported in container” mean?

You’re trying to mux an audio/video codec into a container that does not allow it (e.g. Opus into MP4 with strict profile). Either change container (.mkv) or transcode the offending stream.

Why does Opus fail in an MP4?

MP4 standard support for Opus only landed recently. Some old players reject it. Either re-encode to AAC (-c:a aac) or use MKV which has long-supported Opus.

How do I check supported codecs?

ffmpeg -codecs lists every codec compiled into your build. ffmpeg -encoders and -decoders give per-direction support — useful when reading vs writing differs.

Can I bypass the codec check?

Add -strict experimental to allow experimental codec/container combinations. Useful for AV1 or VVC where standards are still maturing — but breaks playback on some clients.

Why does my fix work locally but break on a server?

Different FFmpeg builds. Servers often have minimal builds without libfdk_aac, libx265, or hardware encoders. Use ffmpeg -encoders on the server to confirm available codecs.



Tested with ffmpeg 6.1.1 / Ubuntu 24.04
Primary source: ffmpeg.org/ffmpeg-codecs.html