Trying to fix timestamp in Google .json file

Started by Kublo, August 28, 2023, 06:53:23 PM

Previous topic - Next topic

Kublo

Hello everyone,

I've read numerous posts discussing issues related to Google Takeout, and unfortunately, I haven't been able to find a solution to my specific problem. That's why I'm writing this post. So I downloaded my photos from Google Takeout and discovered that some of them lack the "photoTakenTime" in their metadata, which is a common problem.

To fix this, I used exiftool and I've succeeded. However, a new problem showed up. The timezone wasn't accurate because these photos were taken in CET/CEST, while the time was indicated in UTC. To fix this, I wrote a Java code that adjusted the time appropriately. But the thing is, my code only managed to modify the formatted date and I couldn't update the actual timestamp, which is the only change I need to make.

Have any of you encountered a solution to this issue? Is it possible to fix this using only exiftool? My main concern is simply adding one or two hours to the date, depending on whether it's regular time or daylight saving time. I'd really appreciate you help. Thank you!

wywh

Try this (here -5 hours):

exiftool -overwrite_original -api QuickTimeUTC=1 -TagsFromFile @ -Time:All -FileCreateDate -FileModifyDate -globalTimeShift -5 .
- Matti

Kublo

Thank you, do you have an idea how to make the amount of hours depend on the month? Because sometimes I need to shift it by one hour and sometimes by two hours.

StarGeek

Assuming the +1/+2 is based upon Summer/Daylight time, you probably have to run two separate commands and research the start/end times of the +2 shift

First, use
-globalTimeShift +1
because all the files are going to be shifted by at least +1

Then run a command to only affect files files within a time range.  For example, according to Google, Summer time in 2022 started March 27, 2022 and ended October 30, 2022. So to add one more hour, you command would be
exiftool -if "$FileModifyDate gt '2022:03:27' and $FileModifyDate lt '2022:10:31'" -api QuickTimeUTC=1 -TagsFromFile @ -Time:All -FileCreateDate -FileModifyDate -globalTimeShift +1 .

Swap the single/double quotes if you are using Mac/Linux
* 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

Quote from: StarGeek on August 31, 2023, 12:16:34 PMSummer/Daylight time, you probably have to run two separate commands and research the start/end times

'-api QuickTimeUTC=1' seems to very well to automatically take care of the DST start/end times for movies (at least as far as the the user's computer's timezone is concerned).

Can that feature used in this scenario?

- Matti

StarGeek

For videos, yes, that probably would work but Kublo only mentions photos.  It won't work for images, as that option only affects videos.
* 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).