Time offset in exif data

Started by daniello, January 14, 2020, 06:41:51 AM

Previous topic - Next topic

daniello

To be prepared for a good gps time stamp I tried to attach the gps stamp to the filename (just because I had the command line) ..
exiftool -if "$GPSDateTime" "-Testname<%%f ${GPSDateTime;}.%%e" *.jpg

I noticed that the format comes like this (inkl. Windows filename validation patch .. otherwise it wouldn't work because of the ":"):

20200104 123453.826Z

Is there a standard command for rewriting into this format
2020-01-04 20.04.52

I would then probably use it with this again .. because the workflow is clear to me from that point:
exiftool "-alldates<filename" "j:\foldername\"

StarGeek

Quote from: daniello on January 18, 2020, 02:56:14 AM
Is there a standard command for rewriting into this format
2020-01-04 20.04.52

Multiple links here.  The -d (dateFormat) option is used to reformat the date as you would like.  You'll find multiple examples under Renaming Examples.  The percent codes can be found under Common Date Format Codes.  So to get the filename in that format would be a variation of the 6th example.  I've used only single % here as an example to any one who comes across this later, leaving it up to you to double them if you're using a batch file.

exiftool -if "$GPSDateTime" -d "%Y-%m-%d %H.%M.%S "-Testname<%f ${GPSDateTime}.%e" *.jpg

Now, as I said, the GPS time stamp is in UTC time.  If you want, exiftool can convert it to your local time.  This can be done with the -api QuickTimeUTC option.  Just add that to the above command.

Now, since the you have a GPS time and it includes the subseconds, making it appear to be the most accurate, here's how I would proceed.

First, I'd correct the GPS time stamps by the hour and half with this command.  Since the GPS time stamp is in two parts, you have to copy to both.
exiftool -globaltimeshift -1:30:0 "-GPSTimeStamp<GPSDateTime" "-GPSDateStamp<GPSDateTime" /path/to/files/

Since the GPS time is now accurate, you can copy that to the other time stamps.  Additionally, you can fill in a few others, like SubSecTimeOriginal (Subseconds when the picture was taken) and OffsetTimeOriginal (time zone the picture was taken).  It's a bit longer command than just using AllDates but it would fill in more data.  I've also added in the ModifyDate tag that's in the wrong place and the Sony specific tag.  You can drop those if you desire.

exiftool -api QuickTimeUTC "-SubSecDateTimeOriginal<GPSDateTime" "-SubSecModifyDate<GPSDateTime" "-SubSecCreateDate<GPSDateTime" "-IFD1:ModifyDate<GPSDateTime" "-Sony:SonyDateTime<GPSDateTime" /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).

daniello

Thanks .. amazing how versatile Exiftool is! It must have taken ages to be so proficient in using it.

I understand now that GPS-Time won't prevent me from having to edit time stamps. But ultmately it should be simple to see where the pictures are taken and so the needed correction is clear.

I will try your suggested workflow asap :-)

daniello

My findings:

1. not all images have gps data. there probably wasn't a lock in every situation - even though most are taken outside
2. Sri Lanka is 5.5 hours ahead of UTC so I expected -5:30 to be the value to correct GPS Time by. But instead I had to enter +5:30.

Other than that all went well. All files that had a gps time are now renamed accordingly :-)

Edit: On our cell phone pictures .. there is even a (small) deviation between GPS-time and DateTime (cell provider network time) - I wonder which would be more precise.

StarGeek

Quote from: daniello on January 19, 2020, 05:10:21 AM
2. Sri Lanka is 5.5 hours ahead of UTC so I expected -5:30 to be the value to correct GPS Time by. But instead I had to enter +5:30.

Yes, time zone is the amount you have to add to UTC to get local time, not the reverse.  So Sri Lanka's time zone is +05:30.  My west coast USA time zone is -08:00 so I have to subtract 8 hours from UTC to get local time.  And do the reverse to get UTC time from local time.

QuoteEdit: On our cell phone pictures .. there is even a (small) deviation between GPS-time and DateTime (cell provider network time) - I wonder which would be more precise.

I believe that does happen sometimes.  It probably depends upon the device and the location.  You'd have to do some testing to see which is more accurate.  If you feel the difference is significant enough to try and fix.
* 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).