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
-movflags +faststart— Places the moov atom at the beginning of the file (also useful for web streaming playback)-c copy— No re-encoding (fast, lossless)
Note: If the file is completely corrupted (e.g., recording was interrupted), this method cannot repair it. Consider dedicated tools such as
mp4recoveroruntrunc.
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
-err_detect ignore_err— Ignores decode errors and continues processing- Some frames may be missing, but it may be possible to create a playable file
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
| Option | Behavior |
|---|---|
-y | Overwrite existing file without confirmation |
-n | Exit 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
- Read the error log carefully: The specific cause appears immediately before
Conversion failed! - Enable verbose logging: Add
-v verboseor-v debugfor more detailed information
ffmpeg -v verbose -i input.mp4 output.mp4
- 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
scale=width:-2— Specifies the width and automatically adjusts the height to an even number while preserving the aspect ratio-2means “round down to a multiple of 2 while preserving aspect ratio”
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
trunc(iw/2)*2— Round down input width to a multiple of 2trunc(ih/2)*2— Round down input height to a multiple of 2
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
Related Articles
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