Corrupted CR2 files repairable?

Started by jkientop, May 24, 2015, 12:27:27 PM

Previous topic - Next topic

jkientop

Hi,

Wondering if anyone can help. I have recovered some files from a Kingston CF card which seem to be corrupted.  When plugged into a card reader or camera, no images appear although there are over 900 files.  I have recovered the files with various file recovery software and most return the same files.  Provided is a link to one of those files as it's too large to attach.  I have tried various commands with ExifTool and all come back with "Bad format (64511) for GPS entry 0". Reading from the FAQs, ExifTool will not modify a file with errors.  Is there anyway I can fix these files?

http://www.makphotoz.com/downloads/File0002.CR2

Thanks,

Jay

Phil Harvey

Hi Jay,

This is a situation that I haven't seen before.  Your image contains large blocks of zero bytes, which have wiped out most of the file structure and metadata in this CR2.  As well, some of the existing data is corrupt.  I thought that maybe the RAW image data could still be intact, but it doesn't seem to have either the header or footer that it should.  Also, the preview images are either corrupted or missing.  So I don't think there is anything that can be done for this file.  Sorry.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jkientop

Thanks Phil for taking the time to analyze my file.  I did a little more digging and was able to extract the preview jpeg from some of the later cr2 files.  I have uploaded the cr2 and extracted preview here:

http://www.makphotoz.com/downloads/File0034.CR2

http://www.makphotoz.com/downloads/File0034_preview.jpg

I noticed the later files recovered, I was able to extract the preview whereas the 1st 10 or so Exiftool wasn't able to do an extraction.  With the extracted preview I've tried the Stellar JPEG repair utility and had no luck in trying to repair it.  Came back with an error in regards to "Bad marker" position?

Jay

Phil Harvey

Hi Jay,

I have a script that does a brute-force scan for a JPEG image inside a file, and it doesn't find any complete JPEG's in the two files you posted.  There are the beginnings of one in the second file, but it seems to turn into random data at some point.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jkientop

Much appreciated Phil for your efforts.  I think I'm gonna throw in the towel on this one. 

Jay

stormchaser

I think I might be having a very similiar issue.  I have tried a number of exiftool commands, but receive an error with a bad gps warning each time.  I have about 500 corrupted CR2 files and very little experience in this matter  :-\.  Could you tell me if anything can be done for these?  Here is an example:
http://www.brianbarnesphoto.com/8525.CR2

Phil Harvey

Hi Stormchaser,

Sorry for the delay in responding.

I've taken a look at your file, and it is too far gone to be repaired.  Only the very start of the file is valid.  I can't even extract a JPEG preview image from the rest of the data.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lkhmst

Hey Phil. Its great what you're doing here to help out the whole lot of us struggling with CR2 corruption.

The photographer at my wedding turned up with a whole batch of corrupted CR2s when we were taking group shots. I've tried playing around with exiftool and file juicer but i'm no expert. We have about 100 of these photos but I'd just like to see if anything can be recovered.

The link is: https://drive.google.com/open?id=0B3awRSxN6hJwQmZFb2J5dkhGVEk

If anything can be done, and if you're willing, I'd be happy to arrange for a service fee for your kind assistance. :)

Thank you!

MOL

Quote from: lkhmst on August 30, 2015, 11:25:02 PM
We have about 100 of these photos but I'd just like to see if anything can be recovered.

Check your hardware like SD card, card reader, cables and HDD.  Image corruption is almost always due to damaged equipment.

-Uwe

lkhmst

Quote from: MOL on August 31, 2015, 11:14:44 AM
Quote from: lkhmst on August 30, 2015, 11:25:02 PM
We have about 100 of these photos but I'd just like to see if anything can be recovered.

Check your hardware like SD card, card reader, cables and HDD.  Image corruption is almost always due to damaged equipment.


Unfortunately my photographer is sitting in another country and hasn't been of much help. Also he's formatted the CF card... several times.

Its just sad really but right now all I can think of is to repair the image. Any help?

Phil Harvey

I tried to look at your files but it would only allow me to request access to this google drive.  This was a few days ago, and I don't think I have been granted access yet.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lkhmst

Hi Phil, sorry for that. Please try the following link: http://we.tl/3wCsY49Vsa

Phil Harvey

I took a look at your files.  The metadata in the files is mostly intact, and the data at the end of the files seems OK.  It is just some of the data in the middle that is corrupted.  This is very unusual.  It may be possible to recover the original images, but I don't have any automatic utilities that would help here so it would probably be a lot of work.

The large preview images are likewise corrupted, but much of the image data is OK.  Unfortunately just a bit of bad data will scramble the entire image, but again it would be a lot of work to try to recover the remaining parts.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

norbi

#13
Out of curiosity ???, I have experimented with files from the original poster (File0002.CR2 and File0034.CR2).
Here is what is really wrong with those files. Every second byte (that is, 2nd, 4th, 6th, 8th, ...) has its third bit from the right set to 0.
For example, if there was somewhere originally FF FF 05 05 04 01, now there is FF FB 05 01 04 01. This is done consistently throughout both files, from top to bottom, without a single exception. The rest of the data is correct.

Kind of hard trying to fix THAT  :-\.
Much of metadata can be fixed rather easily, but time consumingly, by going through the file and fixing where necessary (for starters, offsets to most IFDs are wrong). There are 3 JPGs in each of those files. One is a small preview, another is the fullsize image (baseline jpeg) and the last one is somewhat smaller than full size lossless jpeg. Quantization and Huffman tables seem to be same for all images from this camera (I checked against another random valid CR2), so they can be just copied from elsewhehre. The real problem are the actual image data, there is not much entropy there. But the decoded outputs for the two large images should be (probably, not really sure) very similar, so maybe with enough time and effort, some sort of algorithm could be written to bruteforce those missing bits and check for decoded outputs that are similar. But I'm not even sure this is theoretically possible, I'm no expert.

Phil Harvey

Wow.  Very impressive tracking this down.  And a very interesting conclusion.  Also, as you mention, very hard to repair.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).