How to Recover "Lost" Video Today you're gonna learn how to recover a video from your camera in case that your batteries completely died and the camera didn't shut down...or something somehow cause the camera to not shut down right. What happens is the video data is still on the camera but the end of the file isn't written out so the camera ignores the data, so it's there, but not there...we'll make it there there.
I assume you have a working camera, cable, OPS...all that jazz working.
Quick note: If you recorded a new video after you "lost" whatever video you're trying to recover, it's gone. The camera recorded over it.
You're going to need three "special" programs to do this job:
A Hex editor of some kind, I use Tiny Hex.
You'll also need dd for windows (linux has this, too.)
Also, mencoder for repairing the video. The link there is to CVS Encoder (mencoder + a batch file). It's a handy thing to have around anyway.
1. Download the flash image.
Open OPS, Open Camcorder, Unlock then hit the "Download Flash" button. Select the p0 partition (where the video is). Downloading takes a good amount of time, go get a drink, and Cheez-its.
Save the image some place you can find it.
2. Open flash image.
Open the flash image in the hex editor and look for "RIFF". Search for the last RIFF mentioned, that's likely your video.
3. Trim the image file to an AVI (with dd)
Save a copy of the image file. You'll be trimming away "extra" fat of it to get to the AVI. Go to far and you loose the AVI so make a backup, please.
Extract the dd zip file anywhere and put dd.exe with your image file (just makes it easier).
Open up command prompt (Start>Run>"cmd") and go to the directory where the image file is (cd C:\....).
Use this command to take 100,000k of the front of the file away:
dd.exe if=p0.img of=p0_2.img bs=1024 skip=100000
That will take off some data from p0.img (put in whatever yours is saved as) and save it again as p0_2.img. Open p0_2.img and look for "RIFF" again. If you only find one, you're getting close. If you notice that RIFF isn't too far from the front of the file, just highlight the extra stuff in the hex editor and delete it.
If you cannot find the RIFF after removing some data, delete the output file and retry the command, changing "skip=100000" to a smaller number. I had to do that since the video wasn't far from the beginging of the flash.
Once you get the last "RIFF" header at the begining of the image file, close the hex editor and rename the image file to "video.avi". It can be whatever as long as it ends in AVI. You can now play the file in a program like VLC, but it's a very big file for not a whole lot of video (121MB for 5 seconds of video, in my case).
4. Use mencoder to make the file "smaller"
Here we are basically turnicating the file like before, but taking it off the back end with mencoder.
Extract the .zip file you downloaded and put mencoder.exe in the same place as the AVI file. In command prompt (same one you did dd in) enter this:
mencoder video.avi -oac copy -ovc copy -o clean.avi
This assumes video.avi is the input and clean.avi is the output. This doesn't encode anything, it just copies raw data to a new file. "clean.avi" is now your smaller, recovered video.
With that the file dropped from 121MB to 1.57MB.
This is some good info that for the sake of posterity I'm putting up here, thanks clide!
Thanks for the great how-to bobbarker. I've played around with it some and I have some comments that may help others looking to recover files.
It seems like the videos will always start recording at the first available slot, so if you are recording a video and there are no other videos on the camera then it will be at the very beginning of the video memory. And if you have previously recorded and deleted longer videos before that then those will be the next RIFFs you come to.
If your not very sure where the video you are looking for will be in the memory it's not too bad to go through and look at them. I didn't need the dd program for this method.
The start of a video is marked by "RIFF<3 random characters>.AVI LIST".
So what I did is find the first one of those, select right before the RIFF and then hit shift+ctrl+home to select all the data above and delete it and save the file. Then I could usually just drag and drop the file onto Media Player Classic and see a little bit of the video to see if it was the one I wanted. If it wasn't the one I wanted I could find the next RIFF and delete everything above it again.
Sometimes the video may not play at all, or you can't see enough to tell if it is the one you want. In these cases you will have to go ahead and repair the file to check it out. For this I used DivFix because I found that some files still had some playability problems when using mencoder. Check the "Keep original file" and "Cut out bad parts" and then rebuild the index of your file. That should give you a nice playable file for that section. If it is not the one you want then go back to the original file and cut down to the next RIFF.
I also found it may be possible to recover part of a file that has only partially been recorded over, although it is harder to find because you have to use DivFix each time you cut out a RIFF section and then check towards the end of the video because if you have recorded over the first part of the video then it will just stick it at the end of the video you recorded over it with. This MAY only work if you recorded over it with a video that hasn't been closed properly (lost power while recorded). However I imagine you could find the section of hex that signals the end of a video and delete it to accomplish the same thing.
Also it is no big surprise, but if you are recovering a file that you lost because the camcorder lost power then you may not recover up to the very instant you lost power. I recovered one and I am missing probably 5 or 6 frames before the camcorder actually lost power.
Great community you guys got here. I've been lurking for a while and I love having a cheap little camcorder that I can put in a dangerous location.
zapped- 08-19-2007
Very nicely done bobbarker. This would also look great on the wiki.
nblracer- 03-01-2008
having a hard time downloading the p0 partition
OPS retuen the fallowing:
Bad signature retrieved from partition's boot record
Bad signature retrieved from partition's boot record
Trouble retrieving unsaved.img
when i update the dirctory listing i notice the NO_NAME file is empty, so im guessing that is the problem.
I have -*test*-('") this afew times with diffrent recording time, then unplugging the power.
bobbarker- 03-02-2008
Try downloading the entire flash image of the camera, instead of p0 alone.
nblracer- 03-02-2008
After a few hours playing around i still cant get text example to work.
I go ahead and download the whole 125mb flash.
trim the file down as much as possible with dd,
open with notepad ++ (hex editor) and cut away the more, until the file starts with "RIFF2"
save it as AVI, and then i try to play with VLC, but nothing happens
turns out that the avi is only 4kb. So i guess I'm trimming to much.
So i tryed going to the second from last RIFF, but still nothing
bobbarker- 03-02-2008
I don't know if "RIFF2" shows up in the middle of an AVI file or not (RIFF alone should show up at the beginning), only thing I can think of is you trimmed just a bit too much off with dd.
clide- 07-13-2008
Thanks for the great how-to bobbarker. I've played around with it some and I have some comments that may help others looking to recover files.
It seems like the videos will always start recording at the first available slot, so if you are recording a video and there are no other videos on the camera then it will be at the very beginning of the video memory. And if you have previously recorded and deleted longer videos before that then those will be the next RIFFs you come to.
If your not very sure where the video you are looking for will be in the memory it's not too bad to go through and look at them. I didn't need the dd program for this method.
The start of a video is marked by "RIFF<3 random characters>.AVI LIST".
So what I did is find the first one of those, select right before the RIFF and then hit shift+ctrl+home to select all the data above and delete it and save the file. Then I could usually just drag and drop the file onto Media Player Classic and see a little bit of the video to see if it was the one I wanted. If it wasn't the one I wanted I could find the next RIFF and delete everything above it again.
Sometimes the video may not play at all, or you can't see enough to tell if it is the one you want. In these cases you will have to go ahead and repair the file to check it out. For this I used DivFix because I found that some files still had some playability problems when using mencoder. Check the "Keep original file" and "Cut out bad parts" and then rebuild the index of your file. That should give you a nice playable file for that section. If it is not the one you want then go back to the original file and cut down to the next RIFF.
I also found it may be possible to recover part of a file that has only partially been recorded over, although it is harder to find because you have to use DivFix each time you cut out a RIFF section and then check towards the end of the video because if you have recorded over the first part of the video then it will just stick it at the end of the video you recorded over it with. This MAY only work if you recorded over it with a video that hasn't been closed properly (lost power while recorded). However I imagine you could find the section of hex that signals the end of a video and delete it to accomplish the same thing.
Also it is no big surprise, but if you are recovering a file that you lost because the camcorder lost power then you may not recover up to the very instant you lost power. I recovered one and I am missing probably 5 or 6 frames before the camcorder actually lost power.
Great community you guys got here. I've been lurking for a while and I love having a cheap little camcorder that I can put in a dangerous location.
bobbarker- 07-14-2008
Good tips. I'll add them to the top of the thread (it's not long...) so it's there.
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.