TimeZone on DateTimeOriginal e CreateDate tags

Started by dclobato, January 10, 2023, 12:35:06 AM

Previous topic - Next topic

dclobato

I'm a little bit confused on how my cellphones are storing DateTimeOriginal e CreateDate tags for photos and videos...

Both media were recorded around 17:30 local time (I'm at UTC-3).  On videos, all times are UTC time (3 hours ahead of my localtime). On photos, all times are at my local time.

$ exiftool -alldates -time:all -a -s -G1 20230104_173225.mp4
[QuickTime]     CreateDate                      : 2023:01:04 20:32:50
[QuickTime]     ModifyDate                      : 2023:01:04 20:32:50
[System]        FileModifyDate                  : 2023:01:10 02:09:35-03:00
[System]        FileAccessDate                  : 2023:01:10 02:10:22-03:00
[System]        FileInodeChangeDate             : 2023:01:10 02:09:35-03:00
[QuickTime]     CreateDate                      : 2023:01:04 20:32:50
[QuickTime]     ModifyDate                      : 2023:01:04 20:32:50
[Track1]        TrackCreateDate                 : 2023:01:04 20:32:50
[Track1]        TrackModifyDate                 : 2023:01:04 20:32:50
[Track1]        MediaCreateDate                 : 2023:01:04 20:32:50
[Track1]        MediaModifyDate                 : 2023:01:04 20:32:50
[Track2]        TrackCreateDate                 : 2023:01:04 20:32:50
[Track2]        TrackModifyDate                 : 2023:01:04 20:32:50
[Track2]        MediaCreateDate                 : 2023:01:04 20:32:50
[Track2]        MediaModifyDate                 : 2023:01:04 20:32:50

$ exiftool -alldates -time:all -a -s -G1 20230104_173642.heic
[ExifIFD]       DateTimeOriginal                : 2023:01:04 17:36:42
[ExifIFD]       CreateDate                      : 2023:01:04 17:36:42
[IFD0]          ModifyDate                      : 2023:01:04 17:36:42
[System]        FileModifyDate                  : 2023:01:10 02:07:03-03:00
[System]        FileAccessDate                  : 2023:01:10 02:07:06-03:00
[System]        FileInodeChangeDate             : 2023:01:10 02:07:03-03:00
[IFD0]          ModifyDate                      : 2023:01:04 17:36:42
[ExifIFD]       DateTimeOriginal                : 2023:01:04 17:36:42
[ExifIFD]       CreateDate                      : 2023:01:04 17:36:42
[ExifIFD]       OffsetTime                      : -03:00
[ExifIFD]       OffsetTimeOriginal              : -03:00
[ExifIFD]       SubSecTime                      : 0677
[ExifIFD]       SubSecTimeOriginal              : 0677
[ExifIFD]       SubSecTimeDigitized             : 0677
[Composite]     SubSecCreateDate                : 2023:01:04 17:36:42.0677
[Composite]     SubSecDateTimeOriginal          : 2023:01:04 17:36:42.0677-03:00
[Composite]     SubSecModifyDate                : 2023:01:04 17:36:42.0677-03:00

When I rename the files considering the CreateDate tag (e.g., exiftool '-fileName<${CreateDate}_${make}-${model}.%le' -d '%Y-%m-%dT%H%M%S%%-2c' -ext heic -ext mp4 .), they get out of order, because all videos are 3 hours ahead of the actual time...

$ exiftool '-testname<${CreateDate}_${make}-${model}.%le' -d '%Y-%m-%dT%H%M%S%%-2c' -ext heic -ext mp4 .
'./20230104_173225.mp4' --> './2023-01-04T203250_samsung-SM-S908E.mp4'
'./20230104_173642.heic' --> './2023-01-04T173642_samsung-SM-S908E.heic'
    1 directories scanned
    0 image files updated
    2 image files unchanged

My question is: how can I "force" -CreateDate to return always local time or UTC time, and not a mix of both?.

wywh

Add '-api QuickTimeUTC=1' to the commands (it is needed in movies but does no harm in images so I always use it when checking time or editing movie times).

exiftool -a -G1 -s -api QuickTimeUTC=1 -Time:All .
Some movie tags are Local time (G1, G0, no -s)...

ExifIFD:DateTimeOriginal
ExifIFD:CreateDate
IFD0:ModifyDate
Keys:CreationDate [Apple devices prefer this but usually QuickTime:CreateDate is the same]
UserData:DateTimeOriginal

And some in UTC...

QuickTime:CreateDate
QuickTime:ModifyDate

-api QuickTimeUTC=1 -- 'QuickTime' movie time stamps are stored as UTC and programs should adjust them to the local time. If you add the '-api QuickTimeUTC=1' option to exiftool, it will convert to/from UTC based upon the current time zone of the computer with DST adjustment.

- Matti

dclobato

Quote from: wywh on January 10, 2023, 04:22:33 AMexiftool -a -G1 -s -api QuickTimeUTC=1 -Time:All .

Nailed it!

Now I have all times as local time, and using %z on the -d argument, I can get the time zone.

Thanks