Nikon D800 NEFs ==> SubIFD Tags corrupted ==> Rewrite possible?

Started by spark, June 29, 2012, 11:09:04 AM

Previous topic - Next topic

spark

Thanks Phil, much appreciated!
You'll deserve them holidays even more. You heading abroad?

If you can't make it, no problem. You've already done so much!

In case I don't read you before, enjoy them holidays!

-Sascha

Phil Harvey

Hi Sascha,

I can identify the compression from the NEFCompression tag in the maker notes, but I'm not currently decoding the bit depth from the maker notes (NEFBitDepth is not available for some reason, and the BitsPerSample from SubIFD1 is deleted by Nikon Transfer 1).  So it will take some work to figure out how to identify the bit depth in order to produce a general fix.  I'll work on this, but it isn't likely I'll be able to figure this out before my vacation.  I'm going to Iceland with my wife and son.

- 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 ($).

spark

I see... sure sounds difficult, especially given the mess Nikon Transfer did!
I'm curious to see, whether or not you'll be able to figure this one out ^^

But please don't make it a priority, and above all, a lovely holiday to you and your family :D

MC Photo

Hello Phil & spark,

I'm new to ExifTool but I too like spark have fallen into the Nikon Transfer 1 trap with the D800. Since I have the RAWs that are unreadable and the memory cards are unrecoverable, I'm stuck. It seems as though you're the only one on the internet to have made progress on this front. Like I said, I'm very new to ExifTool and using Mac's terminal, but I would love to know what steps I need to take to recover these photos. These are valuable photos of a personal nature and would very much appreciate your help. Thanks Phil!

Phil Harvey

The modified version of ExifTool that I posted may be able to fix your corrupted D800 NEF's, depending on the compression settings you used.  To run this version you need Perl installed. See the ExifTool installation instructions for the full Perl distribution.

- 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 ($).

MC Photo

Thanks Phil, I have everything installed and set up according to your previous posts, but being very much an infant when it comes to Terminal and ExifTool, I haven't been able to figure it out and keep getting error messages. I'm sure it's simple and I'm embarrassed to ask, but would you mind giving me specific step by step instructions in layman's terms on what I need to do? Thank you so much in advance

MC Photo

And for your time Phil, I'll be more than happy to send a donation your way. Your help is very appreciated.

Phil Harvey

#37
The technique is:

1) download and install ActivePerl.

2) download and expand the patched version of exiftool.

3) From the Windows Start menu, run "cmd.exe"

4) In the cmd.exe window, change directories to the ExifTool distribution folder by typing "cd" pressing SPACE, then dragging and dropping the expanded exiftool folder onto the cmd.exe window, and finally pressing RETURN.  (You should now be able to type the "pwd" command to see the current directory name.)

5) In the cmd.exe window, type "perl exiftool -@ fix_corrupted_nef.args -o fixed" (without the quotes), then press SPACE, then drag and drop the folder containing the NEF images to be fixed, and press RETURN.

6) exiftool will run, perhaps giving some warning messages.  If things go well, exiftool will create a new folder called "fixed" inside the ExifTool distribution folder.    (And the "dir fixed" command should now give you a list of the NEF files in the "fixed" folder.)  This new folder will contain the fixed NEF images with the same file names.  With any luck, you will now be able to open these new NEF files.

Good luck.


- Phil

2012-09-08 Update: I have created a new "fix_corrupted_nef" utility that fixes any FX-format D800 or D800E NEF.  Versions are available for Windows and Mac/Linux:

Click here for instructions on how to download and run the "fix_corrupted_nef" utility
...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 ($).

Arthur

Hello Phil,
It seems that you can save my life...
I have the same problem with my new D800... I just bought it before leaving for the french Polynesia ( I saved money during 15 years for that) and transferred all my pictures to a hard disk with Nikon Transfer... When I came back, I have seen that the files were corrupted!  :'(
I then tried your technique without success !
I just receive the following message :

"Can't locate Image/ExifTool.pm in @INC (@INC contains: ./lib C:/Perl64/site/lib
C:/Perl64/lib .) at exiftool line 30.
BEGIN failed--compilation aborted at exiftool line 30."

The pictures I took are 14 bit, not compressed. Is it the reason ? You may have an idea ?

I tried with the PC of my son. But it seems I could use my MacBook?

With my MAC, I tried the patched version for uncompressed file, created the files SRCDIR and OUTDIR in the ExifTool-8.97_fix_corrupted_nef folder (in the application folder) placed the corrupted nef file in the SCRDIR file and tried the commend but received the message :

MacBook-Pro-de-Jacques-Blanc:~ jblanc$ exiftool -@ fix_corrupted_nef.args SRCDIR -o OUTDIR ; exit;
-bash: exiftool: command not found
logout

It seems that there are a lot of things I do not understand... Sorry

If you could help me, I would be more than happy to make a donation (if you tell me how) !!!

Thank you very much.

Arthur


Phil Harvey

Hi Arthur,

The "lib" directory must exist in the same directory as "exiftool".  If you moved exiftool somewhere, also move the lib directory to the same location.  If exiftool isn't in your path, then type the full path name instead of just "exiftool" (or just drag and drop it onto the Terminal window and OS X will type the full path name for you).  Your Mac already has Perl installed, so you can do it on the Mac without needing to install Perl.

Also, drag and drop the "fix_corrupted_nef.args" file into the Terminal window instead of typing "fix_corrupted_nef.args" so you get the proper path for this file too.  One last thing: You need to replace SRCDIR and OUTDIR with the actual directory name of your images and the directory where you want the fixed images to be stored.  Again, you can drag and drop these folders onto the Terminal window to save typing.

- 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 ($).

Arthur

Hello Phil,

I asked the son of a friend, student in computer science, to help me. I gave him all your indications and it seems that he is going to succeed...
I will let you know. Anyway, thank you so much for your help. As I told you, I am ready to give you a donation for your time and for your knowhow... I just need to know how to do it. Could you send me an e-mail?

Arthur


Phil Harvey

Hi Arthur,

I hope it works, but since you are using uncompressed NEF's I think it should.

No donation is necessary, but if you really insist there is a Donate button on the ExifTool home page.

- 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 ($).

ph0enixx

Hello Phil,

First of all, Thank You for the great job You've done.

I've got in similiar situation with Nikon transfer 1.5.3, my NEFs was D800 14 bit compressed. I've tried Your solution, and it partially helped, excludes bits of depth because Capture NX crashed while opening that NEFs.
So I found the way how You figuring out what type of depth in the file
    $newVal = ($nefSize == 73111552 ? 14 : 12); in WriteExif.pl
and I changed it to     
    $newVal = 14 ;
May be this not good solution but NEF opened.

- Robert

Phil Harvey

Hi Robert,

Great.  This solution is fine if you always use the 14-bit NEF files.  I don't recall if there were any other tags which may need changing for the compressed image, but if it opens then they can't matter too much anyway.

- 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 ($).

Phil Harvey

I just got a sample corrupted 14-bit compressed NEF and tried this myself.  Worked fine.

- 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 ($).