Video Repair Guide – Corrupted MP4 / AVI / H264 File Fix

Dear fellow reader, please subscribe to our YouTube channel and never miss great future videos! <3


Article Updated: 11 Apr 2018

Sometimes, your phone’s recording app may become unresponsive and crash or your phone’s/camera’s/drone’s battery can become dead and abruptly interrupt recording process. In those cases, recordings will NOT be finalized and they’ll refuse to play in any app (phone or desktop) with example messages: “unsupported video format”, “unrecognized file format”, “file with 0 length”, “cannot render file” etc.

HOW TO REPAIR UNPLAYABLE VIDEO FILES RECORDED WITH YOUR PHONE, DRONE OR DIGITAL CAMERA?

MPC HC Broken Video Icon

There are many different APPs and DESKTOP TOOLS on the market but they are usually NOT FREE! To name just a few most popular:

  • Stellar Phoenix Video Repair ($69.99 SOHO Edition)
  • Video Repair Tool by Grau GmbH (99 EUR unlimited)
  • MP4Fix APP for Android ($3.99)
  • Web-Based services (price varies)

Sometimes, even those commercial apps CANNOT fix your videos!


Watch our quick video tutorial:

 

IMPORTANT NOTE

Remember: the less modifications you do on your storage media that holds damaged video file(s), the higher the chance for recovery! For instance, if you accidentally deleted your videos on a file system level (e.g. with File Manager or Media Player) and then used Recuva / Get Data Back / File Recovery / Various Undelete apps to restore the files and then you find out they are not playable, there is a very low chance this procedure will actually help you in that case!

Because, despite “successful” file recovery reported by the undelete/restore apps, videos may still miss important headers which hold crucial recovery information and also could be already overwritten by other files in the middle of the stream, which will make the recovery procedure with video recovery tools virtually impossible!

In those cases, where files are unrecoverable by recovery tools, the only chance is to hire some digital forensics expert and try to salvage individual frames (if any), and do frame-by-frame video reconstruction. There are no publicly available tools (that I’m aware of) that can do this for (arbitrary) video codec/format.

Also, read user comments below about specialized file recovery tools, that also take fragmentation into account and possibility of potential recovery in this case.

STEP BY STEP TUTORIAL

First, you will need another GOOD video, that will serve as a reference for repair procedure. This reference video should be recorded with the same framerate / bitrate (quality) and codec on the same device as the broken video that you’re trying to fix. If you don’t have it, make one, usually couple of seconds is all that you need. If your device is broken or lost, you can use a video from your archive (assuming that you have saved them). If you don’t have a reference video, this guide cannot help you in that unfortunate case :(

Then follow below steps to repair it:

STEP 1

Visit recover_mp4 Video Repair Tool home page or use direct download links of recover_mp4.zip tool:

link #1: http://slydiman.me/download/recover_mp4.zip
link #2: http://slydiman.narod.ru/download/recover_mp4.zip

STEP 2

Download ffmpeg Tool:
https://ffmpeg.org/download.html

(use version that is appropriate for you Operating System, we use Windows 10 64-bit edition)

STEP 3

(For Windows)
Extract ffmpeg.zip, then extract recover_mp4.zip inside /ffmpeg/bin/ directory so that all the .exe files are in the same folder! Also, for simplicity, rename ffmpeg’s directory to a shorter name (useful for next steps).

STEP 4

Copy your “good.mp4” reference file into SAME directory with .exe files as described in STEP 3
Copy your “bad.mp4” damaged file to be repaired into SAME directory with .exe files as described in STEP 3

STEP 5 

(Windows 10)
Search > type CMD > then right click on COMMAND PROMPT to RUN AS ADMINISTRATOR and confirm with YES

STEP 6

Change your working directory inside COMMAND PROMPT to where your ffmpeg.exe and recover_mp4.exe and .mp4 video files are (see step 3)

STEP 7

Execute following command inside COMMAND PROMPT + press ENTER

recover_mp4.exe good.mp4 --analyze

COMMAND EXPLAINED / BREAK-DOWN
recover_mp4.exe | means that we are executing/calling our recovery program/app
good.mp4 | we pass as a parameter name/path of the good reference video file (since it is in the same directory as recover_mp4.exe tool then we simply just type the filename+extension)
–analyze | we instruct recovery tool to analyze damaged video file and try to figure it out with it’s magic! :)

STEP 8

After analysis is completed, run 1st command you received from recover_mp4, for example:

recover_mp4.exe bad.mp4 recovered.h264 recovered.aac

COMMAND EXPLAINED / BREAK-DOWN
recover_mp4.exe | means that we are executing/calling our recovery program/app
bad.mp4 | we pass as a parameter name/path of the damaged video file (since it is in the same directory as recover_mp4.exe tool then we simply just type the filename+extension)
recovered.h264 | we specify the output filename+extension of RAW video portion of recovered file
recovered.aac | we specify the output filename+extension of audio portion of recovered file

NOTE: above are only example commands, they will be different for each video format – follow instructions you receive from recover_mp4 tool!

STEP 9

Then run 2nd command:

ffmpeg.exe -r 30 -i recovered.h264 -i recovered.aac -bsf:a aac_adtstoasc -c:v copy -c:a copy recovered.mp4

NOTE: above are only example commands, they will be different for each video format – follow instructions you receive from recover_mp4 tool!

DONE!

Your video should be fully recovered and playable in ANY video player :)

FREQUENTLY ASKED QUESTIONS (FAQ) / TROUBLESHOOTING TIPS

The following section contains various help tips, Q&As adapted from YouTube comments, to additionally explain certain steps or clarify why this method sometimes doesn’t work.

Question: I am totally stuck with Command Prompt part, how do I change my “working directory”? My bin folder address is this “C:\Users\xx\Downloads\ffp\bin”.

Answer: First, the reason why you should use root D:\ or some other letter drive (if possible, that is — if you have more than 1 disk or virtual partition on your PC) as shown in our video is because Windows might prevent you to read/write data on C:\ drive (but, if you run Command Prompt tool as Administrator, this should not be a problem). Anyway, another benefit of working in the root of the drive is because the paths will be much shorter, and tutorial simpler to follow.

When you run Windows’s Command Prompt tool for the very first time, your path will be set to:

C:\WINDOWS\system32>

You need to go back to the “root” simply by typing this (yes, it is not a mistake — you need to repeat command 2 times!):

cd.. [ENTER]
cd.. [ENTER]

literally: type letter C, then type letter D, then type 2 dots (all glued, no space!) and press [ENTER] key on your keyboard. “cd” command is a short for “change directory” in Command Prompt.

Alternatively, you can do it directly with a single command:

cd C:\ [ENTER]

This will directly bring you to your root path of C drive.

Next, you need to change your location to the one you have mentioned in your comment. Again, we will use “cd” command:

cd C:\Users\xx\Downloads\ffp\bin [ENTER]

NOTE: replace “xx” above with your actual PC user name!
So, after you execute the above command, the path in Command Prompt will look like this:

C:\Users\xx\Downloads\ffp\bin>

Now, you can use command:

dir [ENTER]

The above dir command will list your files and directories, along file sizes in bytes, and you should see all of them in the list (e.g. ffmpeg.exe, recover_mp4.exe, your good.mp4 and bad.mp4 files and so on). From there, you should follow up tutorial exactly as in the video.

If you are keeping your videos in a different drive/partition (like in our video tutorial), in order to change to another drive/partition, you don’t type “cd” in front of it, just the drive letter plus semicolon “:” symbol, like this:

D: [ENTER]
E: [ENTER]
F: [ENTER]

Question: Is it possible to use this method for repairing a video of a recorded game / screen capture from my computer or phone? Is it possible to use this method for repairing a video from some obscure/rare/unknown codec/hardware/format?

Answer: Thing is, it might work, but most probably it won’t.

It is probably possible to repair your custom video, but an expert in audio/video formats and codecs needs to analyze it manually first, to examine the inner structure of the bits/frames/etc. In case of screen recordings — because of so many variants in codecs and lack of industry standard — this may not be optimal nor easy to do. In this case, it just might be (often is) easier to re-record everything again, to save you from the repair trouble.

On the other hand, if you recorded a live-action video with hardware camera (e.g. your holiday shenanigans), which are non-repeatable in nature, it is often worth the trouble of restoration procedure. Be aware/keep in mind that custom video repairs may cost you a lot of $$$!

Question: Is it possible to repair a video without a reference?

Answer: No, you must provide a good reference file for this repair method.

Question: Can I send you my broken video to you for repair?

Answer: No. We are not a professional video repair service! We wrote this article in good will, with the best of hope that it will help someone out there in the similar situation. We neither create/develop video repair software tools, nor provide repair service for free or otherwise.

Question: In ffmpeg step I receive an error about recovered.h264 or recovered.aac – what can I do?

Answer: Can you play the recovered.h264 and/or recovered.aac file(s) in some video (audio) player from recovery step (command)? At this stage, the results must be already playable, at least on desktop/laptop computer with some universal media/stream player like VLC or MPC-HC. If they are playable, then you can try to combine them together in some video editor like Adobe Premiere, Sony Vegas etc. If not, then the recovery tool probably didn’t do the recovery task properly, messed something up and ffmpeg cannot mux (combine) them properly. Newer version of recovery tool, which is not publicly available (read further below), could help in that case, but it may also indicate that the format is not supported for recovery.

Question: I received an error / warning during 2nd command (ffmpeg mux stage) about .h264 (video) and .aac (audio) parts:

[h264 @ 0000xxxx] Stream #0: not enough frames to estimate rate; consider increasing probesize | Duration: N/A | Bitrate: N/A

[aac @ 0000xxxx] Number of scalefactor bands in group (50) exceeds limit (49)

Answer: If you watched video tutorial till the end at 4:50, I received exactly the same notice regarding framerate, but the result (fixed file) was perfectly playable! In fact, result.h264 was playable already, too, as shown in the video. Ignore that error / warning and go through the end. Later, you may use MediaInfo tool to check meta data. If it refuses to play in hardware-based players (stand-alone equipment), you may need to re-encode again with some video editor.

About header and audio related errors, try to play that result.aac file in some audio player (Winamp, Foobar, MPC-HC, VLC), if you get the audio — great! You can then convert it to WAV (PCM) uncompressed format, and simply mix your audio/video later in some video editor (OpenShot, Sony Vegas, Adobe Premiere etc). If not, then I am really out of ideas, only option is to try with some other video recovery tool/app.

ALL GOOD THINGS…

It is not clear at this moment whether recover_mp4 tool will remain free of charge, or turn into a fully commercial web-based repair service. There are several indicators pointing into that direction:

  • version 1.x of the tool received sparce updates in the past year (versions 1.8.x, 1.9.x)
  • version 2.x of the tool was at first available at individual requests, presumably after making a donation to the author
  • later, author started own web-based repair service powered by version 2.x, claiming greater support for some formats such as GoPro
  • web service was completely automated and free and did not require any registration at first
  • web service is now behind a login/registration wall, so the next logical step will be a fee for repairs

Of course, this is all fine and completely understandable, author was kind enough to provide excellent tool for few years completely free, but at this moment it is still not clear what will happen to the free version of the tool (it is still available for download). Older version still supports many, many hardware devices, despite slower update cycle, but newer ones might not be so lucky, if they use updated codec formats and custom optimizations.

Web-based services have some disadvantages for users, one being privacy concerns, the other being bandwidth and time requirements (it is much slower than working with local files on your PC). On the other hand, running a web-based video repair service is a very costly thing, you need to pay for a bandwidth and fast server with lots of raw CPU power. Remains to be seen…

You have been warned in case this tutorial becomes no longer current :)

Categories
Android Computers iPhone Video

Comments


  1. comments

    14 Comments

    Add Your Comment
  2. 1. Gopalakrishnan

    sir, it throws error message
    “the ffmpeg is not compatible”

    please tell me how to get ffmpeg for windows 7

  3. 2. TehnoBlog

    Hi, you can go to ffmpeg download archive and try some older builds:

    32 bit versions archive
    http://ffmpeg.zeranoe.com/builds/win32/static/

    64 bit versions archive
    http://ffmpeg.zeranoe.com/builds/win64/static/

  4. 3. Gopalakrishnan

    it throws a error message that cannot
    open file good.mp4

  5. 4. TehnoBlog

    Hi, please check my replies in YouTube video comments section, it may help you resolve your issue. But, keep in mind that this repair tool does not support all video codecs (“formats”).

  6. 5. Cfboy

    Sir i cannot have a reference video because i used my laptop to record the video using manycam. I tried your alot of video repair and steps but it doesnt work. But the mp4 file itself has a size of 47mb but it wont play

  7. 6. TehnoBlog

    Hi, I don’t understand why not repeat another recording with ManyCam (using exactly the same recording settings like resolution, frame rate, compression bit rate and codec) ?

    Reference video is required, without it, it’s impossible to repair a video without a lot of guess work, and this tool does not work like that, I’m afraid.

    Also, see my other replies when it comes to recovering a desktop PC recording session, it may be very hard to do with hardware-oriented repair tools, like this one.

  8. 7. Guest

    Wauw Thanks Mate(‘s)

    People like you make computerlife beautifull.

    Thanks again.

  9. 8. TehnoBlog

    You’re welcome :)

  10. 9. Arch

    I’d like to mention that IF files are corrupt after undelete or file recovery, corrupt files may be simply recovered improperly:

    Many MP4 videos are shot on mobile devices like phones, cameras, action cams and dash cams. Files are typically stored on FAT32 or exFAT formatted memory cards.

    Video files on memory cards easily become fragmented. If a file is deleted or the card is formatted all structures on FAT32 and exFAT that store clusters allocated to a file are ‘reset’. This means undelete, file recovery and video recovery software assume files are stored contiguous. They do not take fragmentation into account.

    Thus recovered files will be corrupt simply because they miss data or have data from different files mixed in. Missing data can not be guessed by video repair software.

    So, solution is to use recovery software that does take fragmentation into account and that tries to reconstruct fragmented files correctly using data available on the memory card.

    If you ever find yourself in this situation you may want to give JPEG Recovery LAB a try. Despite it’s name suggesting it only recovers JPEG, it also supports reconstruction of fragmented MP4, MOV, AVI and MPEG-2 video files.

    Can be found here: disktuna.com/jpeg-recovery-lab-digital-photo-recovery/

  11. 10. TehnoBlog

    Hi Arch, yes, this is already mentioned under “IMPORTANT NOTE” section in the article, and thanks for the detailed explanation.

  12. 11. Arch

    WOW! How did I miss that?!? Sorry about that.

  13. 12. TehnoBlog

    No problem, it’s a very long article and your explanation gives further information about fragmentation and potential recovery / fix ;)

  14. 13. Olga Pogozheva

    Hi there – not sure if my message reached you (through a Contact form, that is) – is there a better way to reach you TehnoBlog admin guys?

  15. 14. TehnoBlog

    Sorry, we haven’t received your message because there was a small issue with recent update, and which prevented our contact form to properly send messages. It should be fine now. Thanks!

Post A Comment