Find the error message you got, then check its cause and fix.
1. Unknown encoder ‘libx264’
Error message
Unknown encoder 'libx264'
FFmpeg 8.1 then also prints:
Error opening output files: Encoder not found
Cause
libx264 is an external library that encodes H.264. FFmpeg can only use it if it was built with --enable-libx264.
Solutions
1. Check which encoders your FFmpeg has:
ffmpeg -encoders | grep 264
2. Use a full build of FFmpeg:
ffmpeg.org itself only offers source code. The ready-made builds linked from its download page (gyan.dev and others on Windows) usually include libx264. So do the usual packages (Ubuntu: ffmpeg, macOS: brew install ffmpeg).
3. Try an alternative encoder:
ffmpeg -i input.mp4 -c:v libopenh264 output.mp4
libopenh264 is Cisco’s H.264 encoder. It comes with its own license terms, but many builds include it.
2. moov atom not found
Error message
moov atom not found
Cause
FFmpeg can’t find the moov atom, the part of an MP4 file that describes its structure. Usually a recording or download stopped partway, so the end of the file, where the moov would have been written, is missing. A healthy file with the moov at the end opens fine.
Solution
No FFmpeg option can fix a file with no moov. -movflags +faststart with -c copy fails with the same error, because FFmpeg can’t open the input at all.
- If a download or copy was cut short, get the file again
- For a recording that stopped partway, try a repair tool such as
untrunc. It rebuilds the index from a healthy file recorded with the same camera and settings
3. Invalid data found when processing input
Error message
Invalid data found when processing input
or (for an MP4 whose moov is missing)
[in#0 @ ...] moov atom not found
[in#0 @ ...] Error opening input: Invalid data found when processing input
Cause
The input is damaged or cut short, or it isn’t a media file at all (for example, a saved HTML error page). A wrong file extension alone doesn’t cause it, because FFmpeg detects the format from the file’s contents.
Solutions
If the file opens but errors appear partway through, try -err_detect ignore_err:
ffmpeg -err_detect ignore_err -i input.mp4 output.mp4
-err_detect ignore_err— ignore decode errors and keep going. Only some decoders use it, such as MPEG-4 Part 2 (Xvid/DivX); with H.264 the result is the same as without it- FFmpeg keeps going past decode errors even without it. Damaged frames may be dropped or show glitches, but you may still get a playable file
- It doesn’t help when the error appears while opening the input (a missing moov, or a file that isn’t media)
Check the actual format with ffprobe:
ffprobe input.mp4
You don’t need -f for a file with the wrong extension. Forcing a format that doesn’t match the contents, such as -f mp4 on a WebM file, causes this same error. If ffprobe shows the same error, the file is damaged or isn’t a media file.
4. Output file already exists
Error message
File 'output.mp4' already exists. Overwrite? [y/N]
FFmpeg asks this when the command has no -y.
Cause
A file with the same name already exists at the output location.
Solution
| Option | Behavior |
|---|---|
-y |
Overwrite the existing file without asking |
-n |
Never overwrite. If the file exists, stop without converting |
ffmpeg -y -i input.mp4 output.mp4
ffmpeg -n -i input.mp4 output.mp4
Scripts and batch jobs usually add -y. With -n, FFmpeg prints File 'output.mp4' already exists. Exiting. and exits with code 0, so a script sees success even though nothing was converted.
5. Conversion failed!
Error message
Conversion failed!
FFmpeg 6.1 and later then exit with a negative error code, such as -22 (Linux and macOS show it as 234). FFmpeg 6.0 and earlier exit with 1.
Cause
This is a general “something failed” message. The actual cause is printed in the log just before it.
Diagnostic steps
- Read the lines just above
Conversion failed!: one of them names the problem - Turn on detailed logging: add
-v verboseor-v debug
ffmpeg -v verbose -i input.mp4 output.mp4
- Check the usual causes:
- Does the encoder accept the settings? For example, libx264 with yuv420p rejects an odd width or height (see section 6), and a hardware encoder fails on a machine without that hardware
- Can the output format hold the codec?
Could not find tag for codec …means it can’t - Do the filter values fit the input? For example,
crop=400:300fails on a 320x240 video - Is there enough disk space?
FFmpeg stops before processing starts if the input path is wrong, the output folder is missing, or it doesn’t know an encoder or filter name. Then it prints an error such as Error opening input files: … or Error opening output files: …, not Conversion failed!.
6. height not divisible by 2
Error message
height not divisible by 2 (1920x1081)
or
width not divisible by 2
Cause
With 4:2:0 color (yuv420p, the usual pixel format), H.264 and some other codecs need both the width and the height to be multiples of 2. An odd width or height causes this error.
Solutions
Let the scale filter pick an even size with -2:
ffmpeg -i input.mp4 -vf scale=1280:-2 output.mp4
scale=width:-2— set the width; FFmpeg works out the height from the aspect ratio-2means “keep the aspect ratio, then round to the nearest multiple of 2”
Or round both width and height down with trunc:
ffmpeg -i input.mp4 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" output.mp4
trunc(iw/2)*2— the input width, rounded down to a multiple of 2trunc(ih/2)*2— the input height, rounded down to a multiple of 2- The expression contains
(,)and*, so quote it in the shell
7. Unknown encoder ‘Copy’ / Notes on Codec Specification
Error message
Unknown encoder 'Copy'
or
Unknown encoder 'COPY'
Cause
copy in -c:v copy is case-sensitive, so Copy and COPY don’t work. The wrong kind of quotation marks (for example, full-width quotes) can also cause problems.
Solution
Type it in lowercase ASCII.
# Wrong (uppercase)
ffmpeg -i input.mp4 -c:v Copy output.mp4
# Correct (lowercase ASCII)
ffmpeg -i input.mp4 -c:v copy output.mp4
The same goes for every codec name. Codec names are lowercase ASCII and can include - and _, as in libx264, aac, libvpx-vp9, pcm_s16le.
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