Re-creating capture date & time off correct GPS time

Started by phototrek, April 14, 2024, 04:44:15 PM

Previous topic - Next topic

phototrek

Long time user, first time poster. I think I did a lot of research, but after hours of trial and error I still don't know how to solve my problem...

I just came back from Easter Island, where I used my two R5 with the Canon GPS receiver attached. As such, every photo has automatically embedded GPS location and Zulu timestamp. However, for some reason I had the time zone on the camera set to Wellington, not Denver. Simple enough, right? Yes, normally this would be a simple -AllDates-=18 and call it a day. However, one of the cameras was also randomly switching the time to a timezone that doesn't make sense in the middle of the day, without me changing anything. I have two adjacent files (Dropbox) that jump dramatically within a couple of minutes of almost identical Zulu time. The timezone is the same (incorrect) Wellington in both files. GPS time is two minutes apart, EXIF time is hours apart. Who knows what happened.

GPS Date/Time : 2024:04:07 21:42:21.991Z

With both the filesystem timestamps as well as the embedded EXIF metadata timestamps all over the place (and in the wrong timezone regardless), what I'd like to do is a simple "take the GPS time, subtract 6h, and put it into every single other time field."  I have thrown search and ChatGPT at it, for no avail, but I'm sure there's a way, right? This on a macOS14 machine.

Thank you!

StarGeek

It's important to include the -G (-groupNames) option and the -a (-duplicates) option when looking at the output of a CR3 file.  That is because CR3 files are based upon the MP4 format and will have multiple tags with the same name.  Additionally, some of those tags are in UTC and exiftool will adjust them to the current time zone of the computer when listing them.  That might be the source of the strange time zone change, as it would be adjusted to the local time zone of your computer.

The Canon tag page gives a list of cities that you can change Canon:TimeZoneCity to. So to change it to Denver, you would use
-TimeZoneCity=Denver

Fixing the time zone tags (the asterisk requires quoting on Mac/Linux)
-TimeZone=-06:00 '-OffsetTime*=-06:00'

Fixing the Quicktime time stamps
-api QuickTimeUTC '-Quicktime:CreateDate<GPSDateTime' '-Quicktime:ModifyDate<GPSDateTime' '-Quicktime:Track*Date<GPSDateTime' '-Quicktime:Media*Date<GPSDateTime'

It's probably best to fix the EXIF time stamps as you mentioned above, but changed to only edit the EXIF ones, not the Quicktime ones with the same name
-EXIF:AllDates-=18

This is because converting UTC time to local time is hard to do in an automatic way, especially if the local time is in a different time zone than the computer.

The TimeStamp tag isn't editable, so that will be stuck with the current value.

So altogether
exiftool -TimeZoneCity=Denver -TimeZone=-06:00 '-OffsetTime*=-06:00' -api QuickTimeUTC '-Quicktime:CreateDate<GPSDateTime' '-Quicktime:ModifyDate<GPSDateTime' '-Quicktime:Track*Date<GPSDateTime' '-Quicktime:Media*Date<GPSDateTime' -EXIF:AllDates-=18 /path/to/files/
* 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).

wywh

Does this work for you? I imitated Denver time zone so you can leave '-api TimeZone=America/Denver' off if your computer is set to that time zone.

First copy the correct GPSDateTime (UTC) to those incorrect EXIF and QuickTime tags and also correct the TimeZoneCity and OffsetTime:

exiftool -m -overwrite_original -wm w -api QuickTimeUTC=1 -api TimeZone=America/Denver '-AllDates<GPSDateTime' -TimeZoneCity=Denver -TimeZone=-06:00 '-OffsetTime*=-06:00' '-Track*Date<GPSDateTime' '-Media*Date<GPSDateTime' .
Then shift EXIF times to the Eastern Island local time which had just Apr 6 switched to southern hemisphere winter time (DST off UTC -6, QuickTime tags are already correctly in UTC):

exiftool -m -overwrite_original '-EXIF:AllDates-=0:0:0 06:00:00' .
Check the result (QuickTimeUTC is needed when writing, but it seems QuickTimeUTC option is automatically enabled when reading .cr3 files so the output is the same without it):

exiftool -a -G1 -s -api QuickTimeUTC=1 -api TimeZone=America/Denver -Time:All .
======== ./SJ6A9539.CR3
[IFD0]          ModifyDate                      : 2024:04:07 15:42:21
[ExifIFD]       DateTimeOriginal                : 2024:04:07 15:42:21
[ExifIFD]       CreateDate                      : 2024:04:07 15:42:21
[ExifIFD]       OffsetTime                      : -06:00
[ExifIFD]       OffsetTimeOriginal              : -06:00
[ExifIFD]       OffsetTimeDigitized             : -06:00
[ExifIFD]       SubSecTime                      : 27
[ExifIFD]       SubSecTimeOriginal              : 27
[ExifIFD]       SubSecTimeDigitized             : 27
[Canon]         TimeZone                        : -06:00
[Canon]         TimeZoneCity                    : Denver
[Canon]         DaylightSavings                 : Off
[GPS]           GPSTimeStamp                    : 21:42:21.991
[GPS]           GPSDateStamp                    : 2024:04:07
[QuickTime]     CreateDate                      : 2024:04:07 15:42:22-06:00
[QuickTime]     ModifyDate                      : 2024:04:07 15:42:22-06:00
[Track1]        TrackCreateDate                 : 2024:04:07 15:42:22-06:00
[Track1]        TrackModifyDate                 : 2024:04:07 15:42:22-06:00
[Track1]        MediaCreateDate                 : 2024:04:07 15:42:22-06:00
[Track1]        MediaModifyDate                 : 2024:04:07 15:42:22-06:00
[Track2]        TrackCreateDate                 : 2024:04:07 15:42:22-06:00
[Track2]        TrackModifyDate                 : 2024:04:07 15:42:22-06:00
[Track2]        MediaCreateDate                 : 2024:04:07 15:42:22-06:00
[Track2]        MediaModifyDate                 : 2024:04:07 15:42:22-06:00
[Track3]        TrackCreateDate                 : 2024:04:07 15:42:22-06:00
[Track3]        TrackModifyDate                 : 2024:04:07 15:42:22-06:00
[Track3]        MediaCreateDate                 : 2024:04:07 15:42:22-06:00
[Track3]        MediaModifyDate                 : 2024:04:07 15:42:22-06:00
[Track4]        TrackCreateDate                 : 2024:04:07 15:42:22-06:00
[Track4]        TrackModifyDate                 : 2024:04:07 15:42:22-06:00
[Track4]        MediaCreateDate                 : 2024:04:07 15:42:22-06:00
[Track4]        MediaModifyDate                 : 2024:04:07 15:42:22-06:00
[Track4]        TimeStamp                       : 2024:04:08 15:42:54.27
[Composite]     SubSecCreateDate                : 2024:04:07 15:42:21.27-06:00
[Composite]     SubSecDateTimeOriginal          : 2024:04:07 15:42:21.27-06:00
[Composite]     SubSecModifyDate                : 2024:04:07 15:42:21.27-06:00
[Composite]     GPSDateTime                     : 2024:04:07 21:42:21.991Z
======== ./SJ6A9540.CR3
[IFD0]          ModifyDate                      : 2024:04:07 15:44:29
[ExifIFD]       DateTimeOriginal                : 2024:04:07 15:44:29
[ExifIFD]       CreateDate                      : 2024:04:07 15:44:29
[ExifIFD]       OffsetTime                      : -06:00
[ExifIFD]       OffsetTimeOriginal              : -06:00
[ExifIFD]       OffsetTimeDigitized             : -06:00
[ExifIFD]       SubSecTime                      : 75
[ExifIFD]       SubSecTimeOriginal              : 75
[ExifIFD]       SubSecTimeDigitized             : 75
[Canon]         TimeZone                        : -06:00
[Canon]         TimeZoneCity                    : Denver
[Canon]         DaylightSavings                 : Off
[GPS]           GPSTimeStamp                    : 21:44:29
[GPS]           GPSDateStamp                    : 2024:04:07
[QuickTime]     CreateDate                      : 2024:04:07 15:44:29-06:00
[QuickTime]     ModifyDate                      : 2024:04:07 15:44:29-06:00
[Track1]        TrackCreateDate                 : 2024:04:07 15:44:29-06:00
[Track1]        TrackModifyDate                 : 2024:04:07 15:44:29-06:00
[Track1]        MediaCreateDate                 : 2024:04:07 15:44:29-06:00
[Track1]        MediaModifyDate                 : 2024:04:07 15:44:29-06:00
[Track2]        TrackCreateDate                 : 2024:04:07 15:44:29-06:00
[Track2]        TrackModifyDate                 : 2024:04:07 15:44:29-06:00
[Track2]        MediaCreateDate                 : 2024:04:07 15:44:29-06:00
[Track2]        MediaModifyDate                 : 2024:04:07 15:44:29-06:00
[Track3]        TrackCreateDate                 : 2024:04:07 15:44:29-06:00
[Track3]        TrackModifyDate                 : 2024:04:07 15:44:29-06:00
[Track3]        MediaCreateDate                 : 2024:04:07 15:44:29-06:00
[Track3]        MediaModifyDate                 : 2024:04:07 15:44:29-06:00
[Track4]        TrackCreateDate                 : 2024:04:07 15:44:29-06:00
[Track4]        TrackModifyDate                 : 2024:04:07 15:44:29-06:00
[Track4]        MediaCreateDate                 : 2024:04:07 15:44:29-06:00
[Track4]        MediaModifyDate                 : 2024:04:07 15:44:29-06:00
[Track4]        TimeStamp                       : 2024:04:08 09:44:30.75
[Composite]     SubSecCreateDate                : 2024:04:07 15:44:29.75-06:00
[Composite]     SubSecDateTimeOriginal          : 2024:04:07 15:44:29.75-06:00
[Composite]     SubSecModifyDate                : 2024:04:07 15:44:29.75-06:00
[Composite]     GPSDateTime                     : 2024:04:07 21:44:29Z

BTW I had not previously paid attention to the Track4:TimeStamp. It seems to be in UTC with a possible DST adjustment. So it is off ±1 hours if the camera's DST setting is incorrect.

- Matti

StarGeek

Ah yes, -api TimeZone option doesn't work on Windows, so I tend to forget about it.
* 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).

phototrek

Firstly, sorry for the long delay replying (and trying it out), shortly after posting I have fallen seriously ill and it's just today that I'm for the first time at the keyboard again.

Quote from: wywh on April 16, 2024, 05:56:33 AMDoes this work for you?

Matti, what you proposed really worked, in the sense it did exactly what I asked to be done. StarGeek's suggestion (applied on the ~1000 images that I had) didn't work uniformly well, because as the images have a sudden inexplicable jump in the time code, the resulting images did so, too.

The resulting problem is an unexpected one: the GPS time isn't always correct :) The GPS time is the exact same, down to the 1/100s, for many images in a burst, and even across bursts. I suspect this has to do with poor GPS signal or some other reason where the camera uses the last good GPS stamp rather than the current one, which makes good sense. The problem with that is that images are out of order in Lightroom, which is amusing in action bursts and disturbing my general OCD (as you can probably tell from this post in the first place.)

I think the correct solution will be to take the original images, group them in batches of different (incorrect) offsets to GMT, and then adjust them by a few hours here and there, but preserving the relative clock, rather than relying on the GPS time that sometimes stands still. I definitely learned something today, and I'm sure it will come in handy one day again. Thanks for your help!