Author Topic: When is DateTimeOriginal_2 emitted?  (Read 1190 times)

Mac2

  • Sr. Member
  • ****
  • Posts: 206
When is DateTimeOriginal_2 emitted?
« on: December 20, 2012, 11:58:32 AM »
For some NEF RAW files in my collection, ExifTool emits the following XMP output:

...
 <MWG:DateTimeOriginal>
  <rdf:Description et:id='DateTimeOriginal_2' et:table='Composite'>
   <et:desc>Date/Time Original</et:desc>
   <et:prt>2010:02:16 20:10:11+11:00</et:prt>
  </rdf:Description>
 </MWG:DateTimeOriginal>
...

Why is "DateTimeOriginal_2" used in this case? There is no "DateTimeOriginal" in the composite group/table for these files.

My application allows users to use shortcodes to address tags, and one of the short codes is mapped to "Composite:DateTimeOriginal", which fails for these files because this tag does not exist.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 13735
    • ExifTool Home Page
Re: When is DateTimeOriginal_2 emitted?
« Reply #1 on: December 20, 2012, 05:48:04 PM »
First, to clear things up, this is the XML (-X) output format, which is not the same as XMP.

The "_2" on the tag ID is a bit unfortunate, and reveals more of the ExifTool internals than I had intended.  This will happen with Composite tags if two different Composite tags have the same ID.  In this case, the 2nd one will have "_2" appended to the ID.  This is necessary to prevent two active tags from having the same ID in the same table. The unfortunate part is that since the Composite tags are loaded dynamically, the ID for these tags actually depends on which modules were loaded previously.  Looking at the Composite tags documentation, you can see there are 3 possible versions of the Composite:DateTimeOriginal tag.

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

Mac2

  • Sr. Member
  • ****
  • Posts: 206
Re: When is DateTimeOriginal_2 emitted?
« Reply #2 on: December 21, 2012, 09:28:44 AM »
Hi, Phil

Yes. XML. Sorry. I wrote XMP so often over the past few days, it just slips out...

I understand the _2 now, thanks for explaining things. This apparently affects only a few Nikon NEF files so far, where ExifTool maps the date/time data to the _2 variant of the composite tag. SubSecDateTimeOriginal looks OK, though. I can just tell the users to use that instead, or use the original values in the EXIF record instead of using the smarter and more comfortable composite tags in these cases.