Common FFmpeg Errors and Solutions — From Unknown encoder to moov atom not found

When using FFmpeg, you may be puzzled by unfamiliar error messages. This article summarizes the causes and solutions for the most frequently encountered errors.

Verified with: ffmpeg 6.1


1. Unknown encoder ‘libx264’

Error message

Unknown encoder 'libx264'

or

Encoder libx264 not found.

Cause

libx264 is an external library for H.264 encoding. If --enable-libx264 was not included when building FFmpeg, this encoder cannot be used.

Solutions

1. Check available encoders:

ffmpeg -encoders | grep 264

2. Use a full build of FFmpeg:
The official site (ffmpeg.org/download.html) and distribution packages (Ubuntu: ffmpeg, macOS: brew install ffmpeg) typically include libx264.

3. Try an alternative encoder:

ffmpeg -i input.mp4 -c:v libopenh264 output.mp4

libopenh264 is Cisco’s H.264 encoder with separate licensing constraints, but it is available in many environments.


2. moov atom not found

Error message

moov atom not found

Cause

Occurs when the MP4 file’s structural information (moov atom) is at the end of the file, or when the file is incomplete (recording or download was interrupted).

Solution

Re-encode to move the moov atom to the beginning of the file (-movflags +faststart):

ffmpeg -i input.mp4 -movflags +faststart -c copy output.mp4

Note: If the file is completely corrupted (e.g., recording was interrupted), this method cannot repair it. Consider dedicated tools such as mp4recover or untrunc.


3. Invalid data found when processing input

Error message

Invalid data found when processing input

or

[mp4 @ ...] moov not found
Error while opening encoder for output stream

Cause

Occurs when the input file is corrupted, or when the file extension doesn’t match the actual file format.

Solutions

Use -err_detect ignore_err to ignore corrupted sections:

ffmpeg -err_detect ignore_err -i input.mp4 output.mp4

Explicitly specify the format:

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

Explicitly specifying -f avoids mismatches caused by incorrect file extensions.


4. Output file already exists

Error message

File 'output.mp4' already exists. Overwrite? [y/N]

or (asked interactively when -y is not specified)

Cause

A file with the same name already exists at the output destination. By default, FFmpeg asks for confirmation.

Solution

OptionBehavior
-yOverwrite existing file without confirmation
-nExit immediately with an error if the file exists
ffmpeg -y -i input.mp4 output.mp4
ffmpeg -n -i input.mp4 output.mp4

Explicitly specifying -y is common practice in scripts and batch processing.


5. Conversion failed! (exit code 1)

Error message

Conversion failed!

Cause

This message itself is a generic “something failed” error. The specific cause appears in the log just before it.

Diagnostic steps

  1. Read the error log carefully: The specific cause appears immediately before Conversion failed!
  2. Enable verbose logging: Add -v verbose or -v debug for more detailed information
ffmpeg -v verbose -i input.mp4 output.mp4
  1. Common cause checklist:
    • Is the input file path correct?
    • Does the output directory exist?
    • Is there sufficient disk space?
    • Is the specified codec available? (verify with ffmpeg -encoders)
    • Are there syntax errors in the filter?

6. height not divisible by 2

Error message

height not divisible by 2 (1920x1081)

or

width not divisible by 2

Cause

Codecs such as H.264 require that both the width and height of the resolution are multiples of 2. Occurs when an odd-pixel resolution is specified.

Solutions

Use the -2 specifier in the scale filter to automatically round to an even number:

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

Using the trunc function (adjust both width and height):

ffmpeg -i input.mp4 -vf scale=trunc(iw/2)*2:trunc(ih/2)*2 output.mp4

7. No such encoder ‘copy’ / Notes on Codec Specification

Error message

Unknown encoder 'Copy'

or

No such encoder 'COPY'

Cause

The copy in -c:v copy is case-sensitive. Copy and COPY are invalid. The type of quotation marks (e.g., full-width quotes) can also cause issues.

Solution

Always use lowercase ASCII characters.

# Wrong (uppercase)
ffmpeg -i input.mp4 -c:v Copy output.mp4

# Correct (lowercase ASCII)
ffmpeg -i input.mp4 -c:v copy output.mp4

Codec names must always be specified in lowercase ASCII alphanumeric characters (e.g., libx264, aac, copy, libvpx-vp9).


Basic Error Handling Flow

1. Read the full error message (check the entire log, not just the last few lines)
2. Use ffprobe to inspect the input file (verify codec and format are correct)
3. Use ffmpeg -encoders / -decoders to check codec availability
4. Add -v verbose for detailed logs
5. Reduce the command to its minimal form to isolate the issue


Tested with: ffmpeg 6.1.1 / Ubuntu 24.04 (GitHub Actions runner)
Primary sources: ffmpeg.org/ffmpeg.html / ffmpeg.org/ffmpeg-codecs.html / trac.ffmpeg.org