The video files get corrupted when recovered with photorec (same thing with testdisk) so they won't play even tho the video stream is there. I had the same issue with accidentally deleted videos from a Canon EOS camera. Spent some time trying to concatenate files around, then spent ages compiling untrunc but didn't get anything playable with either method.
Then I found a perl script, mp4fixer that fixes corrupt video files.
And it worked!
Here's how:
Like untrunc, mp4fixer works by comparing files so you'll need a working video file, from the same camera, with all the same settings and everything else as close as you can get to the corrupt video file.
Put both video files in a folder, open that folder in a terminal and type the following commands:
wget https://github.com/bookkojot/mp4fixer/archive/master.zip
unzip master.zip
mp4fixer-master/fixer.pl good-video.mov bad-video.mov fixed
In the last line, replace good-video
and bad-video
by the names of your files and the last argument (here fixed
) can be any word of your choice and will be used as a prefix for the generated files.
After the script has done its thing, your folder will be swamped by prefixed files. Look for the one ending with *-out-video.h264
.
You can already play that file using VLC but in my case the framerate was all over the place so I converted it to MP4 using HandBrake and that's it, my videos are now playing just fine!
note: only realising now, it didn't need audio in my case so overlooked the fact that mp4fixer restores the audio as a separate .raw file. There's more info about sound on the readme page. Also the raw audio did play in Audacity (File > Import > Raw Data
) but at the wrong speed.