Skip to content

How to Fix FFmpeg Codec Not Supported Errors

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about How to Fix FFmpeg Codec Not Supported Errors. We cover key concepts, practical examples, and best practices.

The Problem

FFmpeg shows Unknown encoder 'libx265', Codec 'aac' is not supported by the muxer, or Decoder not found. The input or output codec is not available in your FFmpeg build, or the codec is not compatible with the target container.

Quick Fix

Fix 1: Encoder Not Found

WRONG — using an encoder not compiled into FFmpeg:

ffmpeg -i input.mp4 -c:v libx265 output.hevc
# Unknown encoder 'libx265'

RIGHT — list available encoders and use one that is available:

ffmpeg -encoders | grep x265
# (if empty, libx265 is not installed)

# Use a different encoder:
ffmpeg -i input.mp4 -c:v libx264 -c:a aac output.mp4
# (libx264 is almost always available)

Install the missing encoder:

# Ubuntu/Debian:
sudo apt install x265 libx265-dev
# Or compile FFmpeg with --enable-libx265

Fix 2: Codec Not Supported by Container

ffmpeg -i input.mp4 -c:v libvpx-vp9 output.mp4
# Error: Codec 'vp9' is not supported by the muxer for stream #0.0

RIGHT — use a compatible container:

# VP9 works in WebM:
ffmpeg -i input.mp4 -c:v libvpx-vp9 -c:a libopus output.webm

# Or re-encode to a container-compatible codec:
ffmpeg -i input.mp4 -c:v libx264 -c:a aac output.mp4

Fix 3: Decoder Not Found

ffmpeg -i input.avi output.mp4
# Could not find codec parameters for stream (Video: dvvideo)

RIGHT — list available decoders and use a build with the required decoder:

ffmpeg -decoders | grep dvvideo
# (if empty, the decoder is not compiled in)

# Re-encode using a transcoding approach:
ffmpeg -i input.avi -c:v libx264 -c:a aac output.mp4

Fix 4: Hardware Acceleration Not Working

ffmpeg -hwaccel cuda -i input.mp4 output.mp4
# Unknown decoder 'h264_cuvid'

RIGHT — check available HW accelerators:

ffmpeg -hwaccels
# Hardware acceleration methods:
# cuda
# (h264_cuvid is a decoder, not a hwaccel method)

# Use the correct HW decoder:
ffmpeg -c:v h264_cuvid -i input.mp4 -c:v h264_nvenc output.mp4

Fix 5: Copy Codec Without Re-encoding

ffmpeg -i input.mp4 -c copy output.mkv
# (copies all streams without re-encoding)

WRONG — the source codec may not be compatible with the output container.

RIGHT — only copy to compatible containers:

# H.264+AAC from MP4 to MKV (works — both support H.264 and AAC):
ffmpeg -i input.mp4 -c copy output.mkv

# H.264+AAC to WebM (fails — WebM does not support H.264):
ffmpeg -i input.mp4 -c:v libvpx-vp9 -c:a libopus output.webm

Fix 6: Audio Codec Conversion

ffmpeg -i input.mp4 -c:v copy -c:a mp3 output.mp4
# MP4 does not support MP3 audio

RIGHT — use a compatible audio codec:

ffmpeg -i input.mp4 -c:v copy -c:a aac output.mp4

Use DodaTech's Codec Checker to identify which codecs are available in your FFmpeg build and recommend compatible codec-container combinations.

Prevention

  • Check available encoders with ffmpeg -encoders before encoding.
  • Verify codec-container compatibility before processing.
  • Use -c copy only between compatible containers.
  • Install FFmpeg with full codec support (ffmpeg -encoders | wc -l for count).
  • Use static builds from johnvansickle.com/ffmpeg for full codec support.

Common Mistakes with codec not supported

  1. Using head and tail instead of pattern matching, causing runtime errors on empty lists
  2. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
  3. Using return to exit a function early instead of wrapping a pure value in the monad

These mistakes appear frequently in real-world FFMPEG code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### How do I install missing encoders in FFmpeg?

Install the codec library and recompile FFmpeg: sudo apt install libx265-dev && ./configure --enable-libx265 && make. Or use a static build from johnvansickle.com/ffmpeg which includes most encoders.

What encoders are available in the default FFmpeg build?

The default build includes libx264 (H.264), aac (native), and mpeg4. libx265 (H.265), libvpx-vp9 (VP9), and libopus (Opus) require additional libraries. Run ffmpeg -encoders to see exactly what is available.

How do I use NVIDIA GPU acceleration?

Use -hwaccel cuda for decoding and -c:v h264_nvenc for encoding: ffmpeg -hwaccel cuda -i input.mp4 -c:v h264_nvenc -c:a copy output.mp4. Check ffmpeg -encoders | grep nvenc for available NVENC encoders.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro