Copying from a makernote tag to a exif tag possible within the same file?

Started by Beholder3, March 09, 2011, 02:15:35 AM

Previous topic - Next topic

Beholder3

Hi,
is it possible to copy data within one file?
My problem is that some of my files have correct information (Focus Length) in some tag in the makernotes but under some circumstances (very low focuslength <10mm) the camera doesnt fill in the corresponding exif tag correctly.
So myplan would be to copy data from one tag to another for a couple of files.

Phil Harvey

Yes, this is easy:

exiftool "-exif:focallength<makernotes:focallength" <files and/or directories>

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

Beholder3

Thanks Phil! I thought this only covered cppying between different source files.  :)

Do you know how I can differentiate between the different "FocalLength" tags in Pentax-Makernotes?
Can I use technicalnames also in the syntax? How?

In my use case only one of the two is filled correctly while the other one is not, so I need to pick the right one.
I only know of their existence thhrough seeing them via Bogdan's GUI and there both fields have the exact same name.
From your online doc I have the impression one tag is the Pentax "LensData tag index 9" and the other is Pentax Tag with tag ID "0x001d".

Phil Harvey

Quote from: Beholder3 on March 09, 2011, 10:28:12 AM
Thanks Phil! I thought this only covered cppying between different source files.  :)

As far as exiftool is concerned, copying between files is the same as copying within a file.  The mechanism is identical.  The only difference is that exiftool makes it a bit easier for you and assumes -tagsfromfile @ if you don't specify another source file when copying.

Quote
Do you know how I can differentiate between the different "FocalLength" tags in Pentax-Makernotes?

Right.  This is a bit trickier.  Use -G4 -a to show the instance numbers, then specify the one you want: Copy1:FocalLength or Copy2:FocalLength.

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

Beholder3

QuoteUse -G4 -a to show the instance numbers, then specify the one you want: Copy1:FocalLength or Copy2:FocalLength.

Ok. I did that. The required data is in "copy3".

So I assume now I can do exiftool "-exif:focallength<copy3:focallength" or how do I do that? I am somewhat unsure because the first of four instances is "" and I don't know how to adress the target tag correctly.

Is there any more documentation on this "instances" concept? I think I do understand the groups but how things are organized into instances escapes me.

Phil Harvey

Quote from: Beholder3 on March 09, 2011, 11:29:53 PM
So I assume now I can do exiftool "-exif:focallength<copy3:focallength" or how do I do that? I am somewhat unsure because the first of four instances is "" and I don't know how to adress the target tag correctly.

That is correct.  The copy number can not be used as a target when writing.

Quote
Is there any more documentation on this "instances" concept? I think I do understand the groups but how things are organized into instances escapes me.

The best documentation for the group names is found in the API GetGroup() documentation.

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

Beholder3

Ok, how could I extract data from the "" instance group then if I had to use that (not in my case but theoretically), if the source tag was in the same family 1 as another one of the same name?

Phil Harvey

Without the -a option, you get the tag from the family 4 "" group without specifying a group name.  If you must use the -a option and want information from the "" group, you can do this with 4:TAG (but I think you would be the first to try this because it hasn't ever come up before).

This works because exiftool allows you to prefix the group name with the family number to allow ambiguous group names to be resolved.  Complicated, yes, but this is a feature that almost never gets used.  This is all documented, but of course nobody ever reads it.

- Phil

Edit: I just tried the 4:TAG syntax, and it works for extracting tags, but not for copying.  I will fix this, however it is totally unnecessary to use this for copying since the "" group is the one that will be copied when no group is specified (the -a option has no effect when copying tags).
...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 ($).

Beholder3

Thanks for the explanation. The concept of mulitple instances is still hard for me to get into my head. I am fixed on fields/tags having unique names.
I find exif:tagname intuitive and thought the underlying naming was different in the case of focallength. Iwould have expected a linear hierarchical naming convention like makernote:1:focallength (meaning group:instance:tag) but now I understand that families 1 and 4 are not in addition but different ways "to cut the pie". One of the instances having no name ("") makes it even harder.
Your software is fine. Just my brain being the bottleneck.
Thanks again for all the time invested supporting us. :)

Phil Harvey

I see.  I do like the idea of a hierarchical grouping system as you mentioned, but haven't come up with anything workable yet (partly due to this duplicate-tag problem).  The as-yet-undocumented family 5 groups are my current version of this hierarchical system.

Truth be told there is much more duplicate information remaining in some maker notes that I have not yet bothered to decode.

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