By Lucas, founder of FixMyVideos · Updated

Repair a Corrupted MP4 File

An MP4 that refuses to open can still hold every picture and every second of sound you recorded. It can also hold nothing at all while keeping the right name and the right size. Both produce the same error message, so the first job is working out which one you have. The checks further down take a few minutes, and each kind of damage below comes with the numbers from a real file we repaired.

What is physically inside an MP4

An MP4 is a chain of boxes. Every box opens with its length and four letters giving its type, which is how a reader hops from one box to the next. Three of them matter when a file breaks:

ftyp   a few dozen bytes declaring the file type
mdat   the compressed video and audio, almost the whole file
moov   the index: codec settings, timing, and the offset and size of every frame

While you record, frames stream into mdat. Many cameras write the moov last, at the end of the file, once you press stop; some reserve space for it at the start and fill it in then. A player reads moov before anything else. Without it, mdat is gigabytes of bytes with no frame boundaries and no clock, so the player stops at "moov atom not found" or a vaguer "cannot play this file". The .3gp videos of older phones are this same format with older codecs inside, and repairing a 3GP has its own page.

Not every MP4 follows that layout. A fragmented MP4, the kind written by many screen recorders, live-stream captures and ffmpeg -movflags frag_keyframe, carries a moov whose sample table is empty on purpose. The real tables sit in hundreds of small moof boxes, one per fragment.

Checks to run before you upload anything

  1. Open it in VLC. If VLC plays it all the way through, the container is readable, and the problem is more likely the player or a missing codec. VLC is forgiving, though: it can play over missing frames without a word, so a clean playback does not prove nothing was lost. Our pages on error 0xc00d36c4 and VLC refusing an MP4 cover those.
  2. Copy it again from the source. Card, phone, cloud drive, download: fetch it once more, ideally through a different card reader or cable. At least two of the cases below were damaged during the copy, not in the camera.
  3. Ask ffprobe. With FFmpeg installed, ffprobe yourfile.mp4 names the problem. "moov atom not found" means the index is missing (our page on that error). "Invalid data found when processing input" means the reader could not recognise the container at all (the invalid data page).
  4. Look at both ends of the file. On a Mac or Linux, xxd yourfile.mp4 | head -3 should show ftyp within the first line. tail -c 1048576 yourfile.mp4 | xxd | tail -20 prints the last megabyte. If that is all zeros, or the same line over and over, the end of your file is filler, not video. On Windows the free hex editor HxD shows the same thing.
  5. Try untrunc if you have a twin clip. untrunc rebuilds the index by borrowing the structure of a healthy clip shot on the same camera with the same settings. Without that second clip it has nothing to copy.

How MP4 files break, with a real case for each

The recording stopped before the index was written

The battery dies or the card fills up mid-take. mdat holds everything up to that moment and moov was never written. The engine reads the frames out of mdat directly. H.264 and HEVC store each piece of a picture behind its own length field, so a walk that reads a length, jumps, and checks that a valid header sits where it landed can find every frame boundary without an index. Codec settings come from the stream when the stream carries them, timing from the frame order and the interleaved audio, and a new moov is written around the original compressed frames.

We check this method on an intact original. A healthy 4K DJI Osmo Pocket 3 clip, cut at 250 MB, ends up the way a battery pull leaves a file, with no moov. After repair, all 722 frames match the original byte for byte and the audio lines up to 0.0 ms. An earlier version of the walk silently skipped 216 of those 722 frames, because DJI puts a variable-length block of audio and metadata between pictures, and ffmpeg papered over the gaps without logging an error. The picture still drifted in colour, the sound went out of sync, and a Mac refused to play the file. Since then we test the engine against healthy clips we damage on purpose, and count every original frame that comes back.

The start of the file was destroyed and the index survived

When the opening bytes are overwritten, or a recovery tool starts the file slightly too late, ftyp and the mdat header go with them. A reader that starts at byte 0 finds nothing it recognises and declares the file headerless, even though the moov at the far end is intact. Our own analyzer made that mistake until August 2026.

The file that exposed it was a 352x288 MPEG-4 recording of 138 seconds with mono AAC sound, missing its first 512 bytes. The engine now finds the moov by its signature, works out how far every offset in the index has shifted, writes a new header and puts each surviving byte back at its original position. All 2009 frames decode, and a byte-by-byte comparison found 0 misplaced bytes. The one audio frame and one macroblock of the first picture that lived in those 512 bytes are gone for good.

Losing the head can also take every codec setting with it. One 12.8 MB x264 clip had lost its first 39 KB, and no parameter sets remained anywhere in the file. The engine rebuilt them from the slice headers, testing candidate values against the decoder, and delivered 413 pictures at 1920x1080 and 60 fps with 44.1 kHz audio, every one of them decoding. The 41 pictures that sat before the first keyframe could not be recovered. When that reconstruction fails, the analysis asks for a short clip from the same camera instead of guessing.

A fragmented MP4 that was never damaged

A 256 MB, 16.5 minute 1080p60 recording came to us in 306 fragments. FFmpeg decoded it end to end without one error. Our engine used to read the empty table in its moov as corruption, carved it, and produced 379 seconds of video with no sound. It now recognises the fragments and stream-copies the file into a regular MP4: 59,397 frames, the full 990 seconds, the AAC track intact. If VLC plays a fragmented file that another tool calls corrupt, ffmpeg -i in.mp4 -c copy -movflags +faststart out.mp4 gives you the same ordinary MP4 on your own machine.

The copy stopped early but kept the full size

Some copies, downloads and cloud-sync placeholders reserve the file at its full size before the data arrives. When the transfer stops, the end stays blank. A 2.84 GB Windows screen recording reached us with real data for its first 1.37 GB and 1.47 GB of zeros after that. The mdat header declared media running to 2.84 GB, with room for an index behind it. That pattern fits a copy that stopped halfway, though a recorder that reserved its file in advance and then failed leaves the same bytes. The engine recovered all 114,759 pictures present, 63 minutes 45 seconds, decoded without a single concealed frame. If the file is a copy, the original may still hold the rest.

Filler is not always zeros. A 1.31 GB 720x480 recording had its last 60 percent made of one 512-byte sector repeated more than 1.5 million times. The engine delivered the 8 minutes 29 seconds that existed. Since that file, the analysis tells you when the tail is filler and what kind. Going back to the original is worth a try, but this file's sizes looked like a recorder that had reserved its space in advance, in which case the original ends in the same place.

A copy that wrote some bytes twice

An iPhone HEVC video (MOV uses the same box structure as MP4) of 99.7 MB looked intact: index present, sizes plausible. A copy tool had written one 1.41 MB stretch a second time, pushing every later frame 1.41 MB past where the index said it was, and had overwritten the first 852 KB with bytes from further into the same file. The engine finds the duplicate by locating where the bytes start repeating, removes it, writes a new header and cuts away the overwritten opening. The delivered file has 1838 frames, all of which decode, with the portrait rotation kept and the original AAC copied over: 61.67 of the 64.67 seconds. The overwritten 852 KB held the first frames and about two and a half seconds of sound, so the repair restarts at the first keyframe where both video and audio are whole, 3 seconds in.

When nothing is left to recover

Some files have nothing to rebuild from, and the free analysis says so instead of offering a repair:

  • All zeros. A 30 MB DJI file, named and sized like a real clip, had every byte set to 0x00. Either the data clusters were never read back or the source was already empty; the bytes cannot tell which.
  • A header and nothing else. A 24-byte upload held one ftyp box. Its name followed the pattern PhotoRec gives a carve, so the recovery run found the start of a recording and none of what followed.
  • One sector repeated. A 20 MB dashcam segment contained 12,288 distinct bytes in total: 24 sectors of 512 bytes, repeated until the file was full. Each read during the copy had handed back the same block. Copying the original again through different hardware is the only move left.

Uploading your file

Upload the MP4, up to 150 GB. The analysis names which of the cases above you are dealing with, and if there are frames to rebuild you get a free 5-second preview cut from your own file, with sound when the sound survived. In the rebuilds described here your compressed frames go into the new file as they are; nothing is re-encoded. You pay only once the preview shows your footage: €6 under 2 GB, €18 from 2 to 20 GB, €35 from 20 to 50 GB and €59 above that, VAT included. Uploads are deleted automatically after 48 hours.

FAQ

A data-recovery program restored my MP4 but it will not play. Can it be repaired? That depends on what the program actually restored. Card recoveries have brought us iPhone HEVC files whose index described a different clip, the previous one on the card, because the phone never got to rewrite it. The engine set those indexes aside and rebuilt from the frames themselves; on the file we could check against ground truth, all 610 pictures came back identical. If the program restored zeros or a few bytes of header, there is nothing to rebuild.

My video plays for a while, then freezes or ends early. Why? Run the tail check from the list above. If the end of the file is zeros or one repeating pattern, the data stops there. When your file is a copy, the original may hold the rest; a recorder that reserved the space and then failed leaves the same pattern, and then there is nothing more to find. If the tail holds real data, upload it: the analysis reports how many frames it found, including those past the point where your player stops.

Do I need a sample clip from the same camera? Not for any of the cases above, where every setting came from the damaged file itself. A few files carry no codec settings at all and resist reconstruction; for those the analysis asks for a short clip shot with the same camera and settings.

My MP4 shows 0 bytes. Is there anything to recover? No. A 0-byte file has no data in it, and nothing can be rebuilt from nothing. Look for another copy on the card, the phone or the cloud.

What happens to my footage after upload? It is used only to analyse and repair your file, and it is deleted automatically after 48 hours. The details are on the privacy page.

Related

Upload your MP4 →

Free preview · No commitment

Ready to recover your video?

Upload your file and get a free 5-second preview in about a minute. Pay only if the preview looks right.

Upload your file →