Where does exiftool get timezone information from for MediaCreationTime?

Started by cowwoc, February 07, 2021, 09:33:58 PM

Previous topic - Next topic

cowwoc

Hi Phil,

Can you please shed some light on https://github.com/drewnoakes/metadata-extractor/issues/529#issuecomment-774707792?

It is my understanding that MediaCreationTime is stored as some sort of number. The metadata-extractor library does not provide timezone information and further clarified that this time is required to be relative to UTC per the specification. When I run exiftool against some files created by an Apple 5 I am getting back a time with a timezone offset. Where is this offset coming from?

Gili

Phil Harvey

Hi Gili,

From here:

According to the specification, integer-format QuickTime date/time tags should be stored as UTC. Unfortunately, digital cameras often store local time values instead (presumably because they don't know the time zone). For this reason, by default ExifTool does not assume a time zone for these values. However, if the QuickTimeUTC API option is set, then ExifTool will assume these values are properly stored as UTC, and will convert them to local time when extracting.

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

cowwoc

Hi Phil,

I am aware of the whole local time vs UTC fiasco but I still don't understand what is going on.

* I never explicitly specify -api quicktimeutc
* I *do* however replace the value of DateTimeOriginal which I suspect causes all subsequent reads to imply -api quicktimeutc (since the written value is guaranteed to be relative to 1904). Is that correct?
* So let's say the value is stored as UTC, how does exiftool know what timezone I used when I wrote the value?

I mean, we know the instant in time and we know my local timezone. But the timezone I am writing and reading back from DateTimeOriginal does not correspond to either UTC or my local timezone. How then does exiftool remember it? It has to get stored somewhere, doesn't it?

Gili

StarGeek

The key point here is "integer-format QuickTime date/time tags should be stored as UTC".  The Quicktime DateTimeOriginal and ContentCreateDate tags are not integer tags, they're string tags.  You can find details on whether a time tag is a string or integer based on the Quicktime page.  If a time zone is listed for a string tag then it's part of the embedded data.

As of version 12.13, exiftool is adding a time zone to the string based tags unless the -n (--printConv) option is used (see this thread), though Phil will have to clarify how this works.
* 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).

cowwoc


Phil Harvey

Quote from: StarGeek on February 10, 2021, 12:19:53 AM
As of version 12.13, exiftool is adding a time zone to the string based tags unless the -n (--printConv) option is used (see this thread), though Phil will have to clarify how this works.

Also from the QuickTime Tags documentation page:

When writing string-based date/time tags, the system time zone is added if the PrintConv option is enabled and no time zone is specified. This is because Apple software may display a crazy values if the time zone is missing for some tags.

Hopefully that clears things up.

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

StarGeek

* 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).