News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Command line to insert a specific lens into a .NEF (Nikon RAW file)

Started by traianmechenescu, June 09, 2021, 05:50:05 AM

Previous topic - Next topic

traianmechenescu

I'll be honest. I just found out about this tool today and I feel overwhelmed by its complexity. I know how to operate a command line program and I have the exiftool on my PC. Can somebody just give me a specific command line syntax to insert into a batch of .NEF files a Sigma 150-600 SPORTS lens? (in all instances where it may apply). I'm confused with all the EXIF parameters Lens, Lens ID, Nikon Maker Notes, etc. Thanks.


EDIT: To clarify a bit more: I have around 85 .NEF files that I have messed around with, in another piece of exif altering software, that ARE actually shot with a Sigma 150-600 Sports (Nikon version), but that data got deleted. I also don't have the actual lens nor any other files shot with it to determine what the LensID that I should enter and I'm not sure what the other related EXIF fields where that information should go are). The actual parameters used seem to have been preserved (things like aperture value used, focal distance,etc). What's missing as far as I am aware is the actual lens info and the actual lens's parameters (things like minimum,maximum aperture, etc).

Phil Harvey

This is a very difficult thing to answer.  The lens affects a LOT of metadata in NEF files.  It would be very hard to change all of it.  Honestly, I don't see how the lens information could be removed from an NEF without making the file unusable.  The thing to do would be to try to copy the relevant information from a good NEF shot with the same lens.  Maybe something like this:

exiftool -tagsfromfile GOODFILE "-all:*lens*" BADFILE

But I don't even know if this stands a chance of fixing your problem.

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

traianmechenescu

Thnaks for your reply. Could you perhaps tell me the Lens ID value of the Sigma 150-600 Sports (Nikon version)   ?


Quote from: Phil Harvey on June 09, 2021, 09:04:32 PM
This is a very difficult thing to answer.  The lens affects a LOT of metadata in NEF files.  It would be very hard to change all of it.  Honestly, I don't see how the lens information could be removed from an NEF without making the file unusable.  The thing to do would be to try to copy the relevant information from a good NEF shot with the same lens.  Maybe something like this:

exiftool -tagsfromfile GOODFILE "-all:*lens*" BADFILE

But I don't even know if this stands a chance of fixing your problem.

- Phil

Phil Harvey

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

StarGeek

Quote from: traianmechenescu on June 09, 2021, 05:50:05 AM
EDIT: To clarify a bit more: I have around 85 .NEF files that I have messed around with, in another piece of exif altering software, that ARE actually shot with a Sigma 150-600 Sports (Nikon version), but that data got deleted.

That might mean that the Nikon MakerNotes were deleted, which would be a bit of a problem, as MakerNotes cannot be added or deleted individually.  Try running this command to make sure the MakerNotes still exist
exiftool -MakerNotes:all file.nef

QuoteI also don't have the actual lens nor any other files shot with it to determine what the LensID that I should enter and I'm not sure what the other related EXIF fields where that information should go are).

You might try searching Flickr for a file that contains the right info that you can download.  In Google you could use site:flickr.com Sigma 150-600 Sports lens to try and narrow it down.  If you find a file you can download, run exiftool on it.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).