Unknown encoder 'libx264' and Encoder not found are two of the most common FFmpeg errors.
Error 1: Unknown encoder / Encoder not found
Error message
Unknown encoder 'libx264'
Error opening output files: Encoder not found
Cause
Your FFmpeg build doesn’t include the library for that codec. Some Linux distributions ship a reduced build as the standard package. Fedora’s ffmpeg-free, for example, has neither libx264 nor libx265.
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 (universe repository) / Debian (main)
sudo apt update && sudo apt install ffmpeg
# macOS — Homebrew (includes libx264 and libx265)
brew install ffmpeg
# Windows — gyan.dev's full build (linked from ffmpeg.org/download.html)
# Download the "full" build from https://www.gyan.dev/ffmpeg/builds/
3. Use an alternative encoder:
| Purpose | Recommended encoder | Example command |
|---|---|---|
| H.264 | libx264 | -c:v libx264 |
| H.264 (alternative) | libopenh264 | -c:v libopenh264 |
| H.265/HEVC | libx265 | -c:v libx265 |
| AV1 | libaom-av1 | -c:v libaom-av1 |
| AV1 (fast) | libsvtav1 | -c:v libsvtav1 |
| VP9 | libvpx-vp9 | -c:v libvpx-vp9 |
Error 2: codec not currently supported in container
Error message
[mp4 @ 000001db19c90c80] Could not find tag for codec wmav2 in stream #1, codec not currently supported in container
or
[webm @ 000002a992ff6d80] Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.
Cause
The output container (the file format, such as MP4 or WebM) can’t hold that codec.
How to fix
Change the container:
# VP9 into WebM (MP4 and MKV also work)
ffmpeg -i input.mp4 -c:v libvpx-vp9 output.webm
# AV1 into MKV (MP4 and WebM also work)
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: Unable to choose an output format
Error message
Unable to choose an output format for 'output.tmp'; use a standard extension for the filename or specify the format manually.
Cause
FFmpeg can’t tell the output format from the file extension.
How to fix
Set the format with -f:
ffmpeg -i input.mp4 -f mp4 output.tmp
To list the formats you can use:
ffmpeg -formats
Error 4: width/height not divisible by 2
Error message
height not divisible by 2 (1280x721)
Cause
With 4:2:0 color (yuv420p, the usual pixel format), H.264 and similar codecs need the width and height to be multiples of 2.
How to fix
ffmpeg -i input.mp4 -vf scale=1280:-2 output.mp4
-2 keeps the aspect ratio and rounds the height 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, your build has that codec.
What to Expect
The codec you choose changes both encoding time and file size. For an MP4 that plays on as many devices as possible, use H.264 and AAC:
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4
HEVC (libx265) and AV1 (libaom-av1) can give smaller files at similar visual quality, but they usually encode more slowly than H.264.
If Unknown encoder appears on a server or CI runner, the cause is usually a different FFmpeg build, not the input file. Compare the output of ffmpeg -encoders and ffmpeg -buildconf on your machine and on the server.
Frequently Asked Questions
What does “Codec not currently supported in container” mean?
You’re putting a stream into a container that doesn’t accept its codec, for example WMA audio (wmav2) into MP4. Change the container (for example to .mkv) or re-encode that stream.
Opus in an MP4 plays no sound
FFmpeg 8.1 writes Opus into MP4 as is, but players that don’t support Opus in MP4 play it silent. Re-encode the audio to AAC (-c:a aac), or use MKV, which has supported Opus for a long time.
How do I check supported codecs?
ffmpeg -codecs lists every codec FFmpeg knows, including some your build can’t use. The D and E flags at the start of each line show whether your build can decode (read) and encode (write) it. ffmpeg -encoders and ffmpeg -decoders list only the encoders and decoders your build has.
Can I bypass the codec check?
-strict experimental lets you use features FFmpeg marks as experimental, such as the built-in vorbis encoder. It does not make a container accept a codec it has no tag for (Could not find tag for codec …). AV1 and VVC go into MP4 and MKV without it. Files made with experimental features may not play in some players.
Why does my fix work locally but break on a server?
The two machines have different FFmpeg builds. Servers often run minimal builds without libfdk_aac, libx265 or hardware encoders. Run ffmpeg -encoders on the server to see what it has.
Related Articles
Primary source: ffmpeg.org/ffmpeg-codecs.html