How to fix "Invalid data found when processing input"
"Invalid data found when processing input" is FFmpeg's (and ffprobe's) generic message for "I could not recognise or parse this file". For MP4 and MOV files it usually appears together with "moov atom not found", meaning the recording was cut off before its index was written; the frames are still in the file and the index can be rebuilt with a reference recorded on the same device. Other causes are a file that is not actually MP4 (a wrong extension), a 0-byte or zero-filled file, an incomplete download, or a format FFmpeg was built without. You can test the MP4/MOV case for free in the FixMP4 repair tool.
Read the lines above the error
FFmpeg usually prints a more specific message just before the generic one:
| Message before the error | Meaning | Next step |
|---|---|---|
| [mov,mp4,m4a,3gp,3g2,mj2] moov atom not found | MP4/MOV index missing | Rebuild the index |
| [mov,mp4,...] stream 1, offset 0x...: partial file | File truncated; index present but points past the end | Rebuild the index or get a complete copy |
| No other message, file is 0 bytes | Empty file | See MP4 is 0 bytes |
| Unknown format / could not find codec parameters | Not an MP4, or an exotic format | Identify the real format |
| Invalid NAL unit size / error while decoding | Data damage inside the stream | Partial recovery possible |
| EBML header parsing failed | Not a valid MKV/WebM | Wrong extension or damage |
Running ffprobe with -v debug on the file shows which demuxer FFmpeg tried and where it gave up.
Check what the file really is
- Size: 0 bytes or a few KB means there is nothing to recover.
- First bytes: an MP4/MOV usually has "ftyp" at byte 4, or sometimes "mdat", "wide" or "free". A hex viewer, or the Linux/Mac command "xxd file.mp4 | head", shows it. Seeing "ftyp" followed by a large "mdat" and no "moov" is the classic cut-off recording.
- Real format: the Unix "file" command or MediaInfo may report MPEG-TS, Matroska or a vendor stream despite the .mp4 extension. Rename and process it with the right demuxer.
- All zeros: if the content is only 00 bytes, the data never reached the disk.
Fixing a missing moov atom
The frames are present but FFmpeg cannot interpret them without the codec parameters and sample table stored in the moov atom. FFmpeg itself cannot rebuild a missing moov atom; options such as -err_detect ignore_err or -fflags +genpts do not help, because the demuxer needs the index before it can read anything.
To rebuild it:
- Record or find a reference from the same device with the same resolution, frame rate, codec and colour profile.
- Open the repair tool, add the broken file and the reference, and press Repair.
- Check the free preview, then export with a subscription.
- Run ffprobe on the repaired file: it should now list the video and audio streams with a correct duration.
More background: fix "moov atom not found" and what the moov atom is.
Fixing a "partial file"
If ffprobe can read the header but complains about a partial file, the index exists but references data beyond the end of the file, typically after an interrupted copy. Copying the complete original again is the best fix. If the original is gone, rebuilding the index from the frames that are present produces a playable file of the data you have.
Other cases
- Wrong extension: an MPEG-TS dashcam file named .mp4 plays fine once FFmpeg is told the format (-f mpegts) or the file is renamed to .ts.
- Missing codec in your FFmpeg build: minimal builds may lack decoders; check with ffmpeg -codecs.
- Network URL or pipe: the error appears when a stream is empty or interrupted; download the file first.
- Damaged data mid-stream: FFmpeg prints decode errors but continues; re-muxing with -c copy into a new MP4 keeps the readable frames.
For developers and automation
If you process uploads with FFmpeg and see this error for user files from phones or cameras, most are cut-off recordings. Detect them by checking for an ftyp box followed by mdat without moov, and tell the user the file was not finalised rather than reporting a generic failure. FixMP4 performs the rebuild client-side, so it can be recommended without accepting the file on your servers.
How FixMP4 rebuilds the file
It parses the box structure, scans the mdat payload for H.264 or HEVC NAL units and AAC frames, takes the decoder configuration from the reference, computes timestamps and B-frame composition offsets, marks keyframes, and writes a standard MP4 that FFmpeg reads without errors. The media data is copied untouched, and the whole process runs locally in the browser.
After the repair
Once the index is rebuilt, the usual FFmpeg workflows work again: trimming with -c copy, transcoding for the web, extracting audio or generating thumbnails. Because the repaired file is a standard MP4, you can also move its index to the front with -movflags +faststart for streaming.
Common mistakes
- Trying flag after flag on FFmpeg when the moov atom is missing; no flag can replace it.
- Trusting the extension instead of checking the first bytes.
- Working on the only copy; keep the original safe.
Related error guides
FixMP4 compared with other options
| Feature | FixMP4 | Desktop repair suites | untrunc (CLI) | VLC |
|---|---|---|---|---|
| Runs where | Browser, on your device | Desktop app | Command line | Desktop player |
| Keeps your file on your device | ✓ | ✓ | ✓ | ✓ |
| Nothing to install | ✓ | ✕ | ✕ | ✕ |
| Rebuilds a missing MP4/MOV index | ✓ | ✓ | ✓ | ✕ |
| Preview of your own repaired file before paying | ✓ | Trial (varies) | Free tool | n/a |
| Voice Memos / AAC without a reference | Usually | Varies | ✕ | ✕ |
| Formats beyond MP4/MOV/M4A | ✕ | ✓ | Many (FFmpeg) | Plays many |
Frequently asked questions
What does "Invalid data found when processing input" mean?
FFmpeg could not recognise or parse the file. For MP4 and MOV it usually comes with "moov atom not found", meaning the index is missing after a cut-off recording.
Can FFmpeg fix a missing moov atom?
No. FFmpeg needs the moov atom to read the file. The index has to be rebuilt from the frames using a reference file, which FixMP4 does.
How do I check whether my file is really an MP4?
Look at the first bytes with a hex viewer (an MP4 usually has "ftyp" at byte 4) or use MediaInfo or the file command.
What if the file is 0 bytes?
Then it contains no data. Try data recovery on the original card instead.