View Single Post
Old April 2, 2017, 08:29   #4
Ironshod Al
Ironshod Al's Avatar
Join Date: Apr 2017
Posts: 48
Ironshod Al is on a distinguished road
Here is a couple of suggestions.

In case you don't like to use commandline tools, you can try to repair the video using VLC.
If VLC will play your video, you can repair it by using the convert... feature. You find it under Media > Convert... (ctrl+R). My VLC is in danish, so I'm guessing a bit about the actual names in the menu. The conversion is done in realtime (streaming), so 2 hours of video will take 2 hours to convert/repair.

In this stackoverflow thread it is suggested to use a combination of FFmpeg and recover_mp4.exe to fix videos. You need a command prompt (I'm assuming you are on Windows) with a path pointing to ffmpeg\bin and recover_mp4.exe in the same folder as (a copy of) the video you want to repair. You also need (a copy of) a working video in the same format as the broken one.
With ffmpeg installed in C:\Applications\Media\ffmpeg and C:\broken_video as your working directory you should be able to do something like this:
> set PATH=C:\Applications\Media\ffmpeg\bin;%PATH%
> cd \broken_video
> recover_mp4 working.mp4 --analyze
The output from recover_mp4 will give you two commands to run. Save them in notepad first, as the first command will flood the screen with 'useless' information. The first command will run recover_mp4 on the broken video and the second command will run ffmpeg on the output from recover_mp4. If all goes well, your video is repaired at this point.

The guy who made recover_mp4 also offers to repair video files for other people, so this could be a valid option as well. I don't know how much he charge for his services.

If you're really lucky, you may be able to repair the video simply by using ffmpeg. It is not very likely, though, but you could try this:
> ffmpeg -r 30 -i broken.mp4 -vcodec copy -acodec copy fixed.mp4

I have tested the solutions in #1 and #2 on a corrupted video on my own computer and they both worked fine. To corrupt a video, I cut the last 2000 bytes from the file using Python. This seemed a decent simulation of a crashed recording session:
> python -c "open('broken.mp4', 'wb').write(open('working.mp4', 'rb').read()[:-2000])"

Last edited by Ironshod Al; April 2, 2017 at 08:56. Reason: Fixed minor bug in the Python example
Ironshod Al is offline   Reply With Quote