QuickTime:CreationDate can be written without timezone

Started by RhetTbull, December 12, 2020, 03:11:28 PM

Previous topic - Next topic

RhetTbull

Not sure if this is a bug in exiftool or if it's in Apple Photos but after spending a lot of hours trying to debug a weird issue with QuickTime dates, I figured out that 1) exiftool allows me to write QuickTime:CreationDate without a timezone and 2) if a video is imported into Photos with such a value written to CreationDate, Photos shows a wildly incorrect date for the video.  I was using exiftool to set QuickTime:CreateDate, QuickTime:ModifyDate, and QuickTime:CreationDate using UTC values for all. 


$ exiftool -ver
12.00


MacOS 10.15.7

Test file: test.mp4

exiftool -time:all -G1 -a -s test.mp4
[System]        FileModifyDate                  : 2020:12:12 08:50:11-08:00
[System]        FileAccessDate                  : 2020:12:12 08:50:33-08:00
[System]        FileInodeChangeDate             : 2020:12:12 08:50:56-08:00
[QuickTime]     CreateDate                      : 2015:01:07 22:40:49
[QuickTime]     ModifyDate                      : 2015:01:07 22:40:49
[Track1]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track1]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track1]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track1]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track2]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track2]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track2]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track2]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track3]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track3]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track3]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track3]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track4]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track4]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track4]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track4]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track5]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track5]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track5]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track5]        MediaModifyDate                 : 2015:01:07 22:40:49


Imported into Photos:


Set QuickTime:CreateDate

$ exiftool -QuickTime:CreateDate="2020:12:12 08:45:00" test2.mp4
    1 image files updated
$ exiftool -time:all -G1 -a -s test2.mp4
[System]        FileModifyDate                  : 2020:12:12 11:49:22-08:00
[System]        FileAccessDate                  : 2020:12:12 11:49:20-08:00
[System]        FileInodeChangeDate             : 2020:12:12 11:49:23-08:00
[QuickTime]     CreateDate                      : 2020:12:12 08:45:00
[QuickTime]     ModifyDate                      : 2015:01:07 22:40:49
[Track1]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track1]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track1]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track1]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track2]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track2]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track2]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track2]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track3]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track3]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track3]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track3]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track4]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track4]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track4]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track4]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track5]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track5]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track5]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track5]        MediaModifyDate                 : 2015:01:07 22:40:49


Imported into Photos shows date correctly:


Set QuickTime:CreationDate (with no timezone as I assumed it was UTC like other QuickTime tags)

$ exiftool -QuickTime:CreationDate="2020:12:12 08:45" test3.mp4
    1 image files updated
$ exiftool -time:all -G1 -a -s test3.mp4
[System]        FileModifyDate                  : 2020:12:12 11:52:14-08:00
[System]        FileAccessDate                  : 2020:12:12 11:52:12-08:00
[System]        FileInodeChangeDate             : 2020:12:12 11:52:15-08:00
[QuickTime]     CreateDate                      : 2015:01:07 22:40:49
[QuickTime]     ModifyDate                      : 2015:01:07 22:40:49
[Track1]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track1]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track1]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track1]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track2]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track2]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track2]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track2]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track3]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track3]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track3]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track3]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track4]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track4]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track4]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track4]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track5]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track5]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track5]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track5]        MediaModifyDate                 : 2015:01:07 22:40:49
[Keys]          CreationDate                    : 2020:12:12 08:45:00


But when imported into Photos, the date shows as a nonsensical 16 Nov 172401


But if I include timezone offset on CreationDate, the date shows correctly when imported into Photos:


$ exiftool -QuickTime:CreationDate="2020:12:12 08:45-00:00" test4.mp4
    1 image files updated
$ exiftool -time:all -G1 -a -s test4.mp4
[System]        FileModifyDate                  : 2020:12:12 11:57:17-08:00
[System]        FileAccessDate                  : 2020:12:12 11:57:24-08:00
[System]        FileInodeChangeDate             : 2020:12:12 11:57:23-08:00
[QuickTime]     CreateDate                      : 2015:01:07 22:40:49
[QuickTime]     ModifyDate                      : 2015:01:07 22:40:49
[Track1]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track1]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track1]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track1]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track2]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track2]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track2]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track2]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track3]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track3]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track3]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track3]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track4]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track4]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track4]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track4]        MediaModifyDate                 : 2015:01:07 22:40:49
[Track5]        TrackCreateDate                 : 2015:01:07 22:40:49
[Track5]        TrackModifyDate                 : 2015:01:07 22:40:49
[Track5]        MediaCreateDate                 : 2015:01:07 22:40:49
[Track5]        MediaModifyDate                 : 2015:01:07 22:40:49
[Keys]          CreationDate                    : 2020:12:12 08:45:00-00:00




I had assumed that all QuickTime times were in UTC as the spec seems to indicate but it appears CreationDate must include timezone offset or Apple Photos interprets it incorrectly.  exiftool appears to show the date correctly and it doesn't complain when setting CreationDate with no timezone offset.  So is this an exiftool bug, a Photos bug, or just an ambiguous spec? 

The only reference I can find to CreationDate in the QuickTime spec is:
com.apple.quicktime.creationdate: A UTF-8 string (value type 1). Can have multiple values with different language and country code designations.

Here's the difference if I use -v2:

$ exiftool -v2 -QuickTime:CreationDate="2020:12:12 08:45:00" test3.mp4
...
  Rewriting ItemList
    - Keys:CreationDate-und = '2020-12-12T08:45:00'
    + Keys:CreationDate-und = '2020-12-12T08:45:00'
    1 image files updated



$ exiftool -v2 -QuickTime:CreationDate="2020:12:12 08:45:00-00:00" test4.mp4
...
  Rewriting ItemList
    - Keys:CreationDate-und = '2020-12-12T08:45:00-0000'
    + Keys:CreationDate-und = '2020-12-12T08:45:00-0000'
    1 image files updated


PH Edit: Fixed img links.

RhetTbull

I tried to include image links to screenshots of what Photos shows but apparently I messed that up--the screenshots are also attached to the OP.

Phil Harvey

I fixed your screenshot links.

We have known for a while that Photos shows crazy value if QuickTime:DateTimeOriginal written without a time zone.  I don't know if we knew about CreationDate, but I guess that makes sense.  I would have to do some research to see if I can find what the specification says about this.  Also, I need to get a complete list of the tags that have this problem.  But given the incompatibility with Photos, I should probably give a warning and add the system time zone to these tags if one isn't specified when writing.  This will take some work.

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

RhetTbull

Thanks for the reply (and for fixing the links...I tried to use the img tag but apparently dorked that up).  For now I can get around this by including the timezone offset for QuickTime:CreationDate.

Phil Harvey

You didn't dork it up.  Imgur apparently doesn't allow their images to be embedded in other web pages.  So instead I linked to your attachments here.

- 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

Quote from: Phil Harvey on December 12, 2020, 05:25:31 PM
Imgur apparently doesn't allow their images to be embedded in other web pages.

Nearly all images I've embedded here are from imgur.  For example.

But you need to make sure you get the image URL and not the post URL.
* 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).

jotzet79

#6
Hello,

Glad I bumped into this thread and having observed that other had similar issues using QuickTime:CreationDate and issues when trying to set it amongst other Tags (like (Media/Track)CreateDate, GPSDateTime).

Especially when I'm using the following command I'm getting weird behaviour

exiftool '-API' 'QuickTimeUTC' '-a' '-u' '-U' '-ee' '-d' '%Y:%m:%d %H:%M:%S%z' '-c' '%+.6f' -v3 -Quicktime:CreationDate="2014:09:28 12:46:56-0000" file
.
.
.
  Creating Meta with mdta Handler and Keys
  Rewriting Meta
  Rewriting Keys
  [adding Keys entry 1 'creationdate']
  Creating ItemList
    + Keys:CreationDate = '2014-09-28T12:46:56+0200'
    1 image files updated


Other tag values seem to be written just OK.

If I leave out the date format, it's written properly. Is it "wrong" to use the -d option when writing?


exiftool '-API' 'QuickTimeUTC' '-a' '-u' '-U' '-ee' '-c' '%+.6f' -v3 -Quicktime:CreationDate="2014:09:28 12:46:56-0000" file
.
.
.
  Creating Meta with mdta Handler and Keys
  Rewriting Meta
  Rewriting Keys
  [adding Keys entry 1 'creationdate']
  Creating ItemList
    + Keys:CreationDate = '2014-09-28T12:46:56-0000'
    1 image files updated


Thank you,
Joachim

Phil Harvey

Hi Joachim,

Note that it is the format that you see, not what is stored in the file.  I'm not sure why you think you need to use -d at all.

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

jotzet79

Hi Phil,

Wow, thanks for the immediate answer!

Hmm, excellent question... :) I'm using ExifTool in stay_open mode and used the -d option in the common args for all read and write operations. Basically I'm trying to geotag my whole archive of pictures and videos and harmonising DateTimeStamps based on the location within the pic / manually tagged. I do this by storing the Metadata in JSON to disk, then process the JSONs and write it back to the media files (to stay fail-safe).

In the example below I just copied the commands from the batch-mode (stay-open) to compare the results properly. I'm now changing my code, and use -d only for reading (and output to JSON), removing the option when writing...

Thank you & kind regards,
Joachim




JohnJackson

Hi to all,

The description in the Apple Quicktime reference guide of the key com.apple.quicktime.creationdate is indeed quite weird. In short, as you quoted, "A UTF-8 string (value type 1)", and as example they give: "4/21/2012". I don't think that will work...
A few pages further they describe the key com.apple.quicktime.location.date: "A date and time, stored using the extended format defined in ISO 8601:2004- Data elements and interchange format." Example: "2012-02-24T17:56Z" for a date of February 24, 2012, time of 17:56, UTC." .
My thought is that this standard should be used for the creationdate as well.

Greetings, John

Phil Harvey

Yes, that is the format that ExifTool uses for storing CreationDate.

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