Correct setting of DateTimeOriginal from videos taken in different time zones ?

Started by Jean-Pierre, July 29, 2023, 06:56:06 PM

Previous topic - Next topic

Jean-Pierre

Hi,

as StarGeek has mentioned in
https://exiftool.org/forum/index.php?topic=14475.msg78020#msg78020
the  -api QuickTimeUTC   option works fine for videos being edited in the same time zone as where they were taken. But there are some travels to other time zones, and processing mostly done at home... and sometimes the DST has changed as well in the meantime.

According to
https://exiftool.org/forum/index.php?topic=12877.msg69606#msg69606
I am using

-api
QuickTimeUTC
-AllDates<CreateDate
-FileModifyDate<CreateDate
-FileCreateDate<CreateDate

in an argument file, and this works fine setting the dates in UTC time. But I cannot figure out how to "include the time zone when writing and the QuicktimeUTC will adjust it".

My goal it to get the tag   DateTimeOriginal   in local time where and when the video was recorded and the correct time zone added, let say to +5.5hours versus UTC (India).
I tried to include something like 
-AllDates<$CreateDate+05:30    =>  time zone seems to be set correctly, but local time is still only adjusted by the time difference between my location and UTC (not for now, but for winter time when the video was taken).

By the way, my videos contain GPS coordinates. So it would even be possible to automatically extract the time zone with some service, see here:
      https://www.geoapify.com/get-timezone-from-lat-long-geographical-coordinates
With this information at hand, could it be done automatically ?


As a simpler approach, or to be more flexible for other time zones, I tried to create a little tool to increase or decrease the time zone, for 1h up or -1h down by fixed commands, and hoping that  DateTimeOriginal  would change accordingly assuming fixed GPS time. If necessary, I could adjust the time itself by the same value. But it looks like that the command  OffsetTimeOriginal+=01:00  does not work.
Or do you have a solution ?

Thanks for any suggestions !

wywh

In movies QuickTime:CreateDate is supposed to be UTC and Keys:CreationDate and UserData:DateTimeOriginal local time. There are also XMP-exif:DateTimeOriginal and XMP-xmp:CreateDate but none of my apps support XMP in movies.

Apple's apps (QuickTime Player, Photos.app) currently favor Keys for movie metadata (date, location, description, title, author, keywords) although also UserData and ItemList are somewhat supported. If Keys date is present, it overrides the QuickTime date (MacOS:FileCreateDate is used as a last resort if neither is present). If present, macOS 13 Ventura Photos.app use also the location for sorting (if there is no 'ExifIFD:OffsetTime*' in .jpg or 'Keys:CreationDate with timezone' in a movie, but there is location, then Photos.app sets the timezone from the location, and sorts files based on that).

I did a quick test with an otherwise blank .mp4 which was initially as:

exiftool -a -G1 -s -api QuickTimeUTC=1 -Time:All a.mp4
[QuickTime]     CreateDate                      : 2021:02:16 16:19:29+02:00

This seems to use the computer timezone and its DST:

exiftool -overwrite_original -api QuickTimeUTC=1 '-QuickTime:*Date=2000:06:01 12:00:00' '-Keys:CreationDate=2000:06:01 12:00:00' a.mp4

[QuickTime]     CreateDate                      : 2000:06:01 12:00:00+03:00
[ItemList]      ReleaseDate                     : 2000:06:01 12:00:00
[ItemList]      ContentCreateDate               : 2000:06:01 12:00:00+03:00
[Keys]          CreationDate                    : 2000:06:01 12:00:00+03:00
[Keys]          LocationDate                    : 2000:06:01 12:00:00+03:00

(I dislike creating unnecessary date tags so I usually first create only Keys:CreationDate, and then use -wm w to suppress the creation of other date tags.)

To set a different timezone these work the same (use the reverse of the wanted time zone in the numeric command):

exiftool -overwrite_original -api QuickTimeUTC=1 '-QuickTime:*Date=2000:06:01 12:00:00' '-Keys:CreationDate=2000:06:01 12:00:00' -api TimeZone=+05:00 a.mp4

exiftool -overwrite_original -api QuickTimeUTC=1 '-QuickTime:*Date=2000:06:01 12:00:00' '-Keys:CreationDate=2000:06:01 12:00:00' -api TimeZone=EST a.mp4

[QuickTime]     CreateDate                      : 2000:06:01 20:00:00+03:00
[Keys]          CreationDate                    : 2000:06:01 12:00:00-05:00

Or the same with DST:

exiftool -overwrite_original -api QuickTimeUTC=1 '-QuickTime:*Date=2000:06:01 12:00:00' '-Keys:CreationDate=2000:06:01 12:00:00' -api TimeZone=+05:00DST a.mp4

[QuickTime]     CreateDate                      : 2000:06:01 19:00:00+03:00
[Keys]          CreationDate                    : 2000:06:01 12:00:00-04:00

For some reason these timezone abbreviations do not work as expected:

exiftool -overwrite_original -api QuickTimeUTC=1 '-QuickTime:*Date=2000:06:01 12:00:00' '-Keys:CreationDate=2000:06:01 12:00:00' -api TimeZone=EDT a.mp4

exiftool -overwrite_original -api QuickTimeUTC=1 '-QuickTime:*Date=2000:06:01 12:00:00' '-Keys:CreationDate=2000:06:01 12:00:00' -api TimeZone=PST a.mp4

[QuickTime]     CreateDate                      : 2000:06:01 15:00:00+03:00
[Keys]          CreationDate                    : 2000:06:01 12:00:00+00:00

- Matti

Jean-Pierre

Hi Wywh,

thanks for the investigation for the Apple tool world. That might help many users of iPhones. The Samsung phones which I use regularly (and some other I have checked), do not provide the TimeZone Tags in videos.
Photos (at least new ones) have the time zone accessible with  EXIF:OffsetTimeOriginal , but
videos do not have those EXIF tags, and they seem not to accept writing new EXIF tags with this information. Instead they have Quicktime-tags, but I do not find any timezone information in the documentation.

I think, I'll just assume the local time zone (offset to UTC) is known and must be corrected manually for the adjustments.
Still I have to figure out why the Date/Time shift feature with AllDates does not work for videos ! And if there is another way to correct for wrong time zones.

Phil Harvey

The AllDates tag name is misleading -- it represents the common EXIF date/time tags (see here).  Videos use other tags.

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