Repair Corrupted Video (MP4) from an Android phone (and other cameras, camcoders, iPhone and Nokia phones, Samsung Galaxy)

Background

I was on a trip and recorded random clips with a HTC HD2 running Android Gingerbread. Sometimes when recording longer clips the Android Video Recorder crashed, leaving the video files broken, unreadable. The reason for this is probably bad drivers, etc, since it's not a real Android device.

But reading through I noticed this is quite a common issue with devices recording MP4 video - and a lot of useless information on the web. No regular video player, VLC, Windows Media Player, QuickTime, etc. can play the broken files directly.

Anyhow so once I got home I decided to look up on why the video files were corrupted and whether I could fix them. The files were large, so the data was there. I did a few searches and it looks like the issue is with the recorder not closing the files properly, leaving the MP4 header corrupted.

Now.. How do I fix it? First I tried fixing using a hex editor. I got some results, but it was just too much work. For more info on fixing the broken files via hex editing, read through the Repair a corrupt MP4 file -thread at LFS Forums. Also there were some Chinese sweatshops offering fixes such as this done manually.

Hex Friend editing corrupted MP4 video

After going through lots and lots of useless sites I ended up downloading the HD Video Repair Utility from Grau GbR:

"We googled 2 days to find a solution to repair some broken .MP4 movie files - we couldn't find one, so we started to build our own."

This worked for me. The free version only rescues half of the video, but since the clips were essentially worthless - I'll not bother. If you need your clips, buy the license. Don't bother with cracking it.

A step-by-step guide to fixing corrupted MP4 video

Before you start, make sure you've got the following items:

This was done on OS X Snow Leopard, but it should work just as fine on Windows.

1. Acquiring the files

Copy the files to a location on your disk and name the files in a sensible way. The broken file will not display a preview.

Finder showing the broken files

2. Repair procedure, selecting files

Launch HD Video Repair Utility (guiscript from the package) and select your broken file as your Input Movie and your working file as Reference Movie. See image below (red is broken, green is working).

HD Video Repair Utility GUI

3. Scanning and repairing

Click scan and wait. If the fix is successful your clip will be in the box "Repaired movie clips (blank if movie was not repairable)". If your fix is not successful, double check that you selected the right files for the right inputs. For additional support, contact Grau GbR.

HD Video Repair Utility GUI - success

4. Profit

You're done. The fixed file should be in a subdirectory labelled "repaired". Note that the video will only contain half of the full length from the beginning when using the free version.

Finder displaying fixed video preview

Applicable devices

This method should be universal to all devices that record standard MP4 video.

Digital cameras and camcoders manufactured by:

Mobile phones and multimedia devices manufactured by: