Showing posts with label gopro. Show all posts
Showing posts with label gopro. Show all posts

Friday, 30 March 2012

Recovering GOPRO video (on Linux)

Quick solution:  Go here. If the SD card is corrupt use Testdisk to recover the files.

Long solution:

The day before yesterday I travelled up to the China/Tibet border and stayed a night. On the way back I set my gopro to record the awesome valley road (and an unintentional jump over a ramp in the road) and I didn't stop to take a lot of pictures along the way because I had the video recording...

Now when I got to the guesthouse I started going through my photos and video, copied off all my videos from the SD card and then as per usual I deleted the videos and put the SD card back in the GoPro. It was after that I realised I was missing two of the videos. Not sure why they didn't copy, perhaps I ran out of space (using an SSD, it's likely) or I ejected before it finished copying or some stupid thing. Anyway, it was my fault they were gone.

Now the rest of this is technical mumbojumbo, hopefully it will help someone else with the same problem though.

I quickly got the SD card out and got to work trying to restore the videos. This is what I've spent the last 18 hours doing (aside from sleeping, although, I did wake up in the middle of the night and started another copy).

This guide is very helpful:
https://help.ubuntu.com/community/DataRecovery

I used a few of the tools on that page: Sleuthkit, Foremost, Scalpel, Testdisk/photorec. Foremost wouldn't find the MP4 file, and Scalpel didn't have the MP4 header/footer configured anyway, so those tools were out. Photorec managed to recover random unplayable <1MB mp4 files, and a gpg file for some reason. So that didn't work either.

Testdisk however let me navigate through the file structure and copy the deleted MP4 files out... But they were unplayable! Figuring something was wrong with the tool I tried with Sleuthkit. But after a more complicated recovery the same file came out when compared to the Testdisk output  (verified by diff).

So still thinking it's a problem with the tools I went through several hours of trying different switches, other smaller apps, etc to try and get this video.

However it wasn't until I loaded some mp4 tools (MP4v2) that I figured out that I was actually dealing with a corrupt mp4 file, the undelete had worked successfully, it was just bad data it was recovering!

After lots of reading forums and various sites going nowhere I stumbled on this site:
http://goprohacks.blogspot.com/p/how-to-restore-gopro-mp4-corrupted-or.html

It seems the corrupt mp4 files from the GoPro are fairly common, I haven't had one before though.

I downloaded the perl script from that site and in the first go it extracted the video from the deleted file I had acquired from testdisk! Actual Success! The audio isn't extracted but that's ok, I might be able to modify the perl script to get that out too if I really want it. I'm just glad I finally have the video of riding through that awesome valley!

Now I can finally get to processing the photos from the storm in the valley, riding through the valley, being followed by someone at the Nepal/China/Tibet boarder, the video of the valley and my first motorbike jump, and also the storm last night and the first view of the Himalayas!