Yet another Google Photo Date Format query

Started by andyval, January 17, 2022, 12:20:54 PM

Previous topic - Next topic

andyval

Having decided to download all my Google Photos in order to upload to a NAS, I've discovered the delights of uploading json data into the exif files which all now have the date of the "Takeout" from Google, some 57 2gb files!

Seemingly the "photoTakenTimeTimestamped" parses correctly for some of the tested jpgs I have processed however I've come across the issue regarding negative epoch times. As a consequence I'm having to use the Formatted date structure. The error I'm getting relates to the hour being used as a month as follows;

The date in the file:
Photo Taken Time Formatted      : 30 Jul 1939, 19:22:00 UTC
Photo Taken Time Timestamp      : -960093480


The command and it's output:

exiftool -r -tagsfromfile "%d%F.json" -d "%d %b %Y, %I:%M:%S UTC" "-datetimeoriginal<photoTakentimeformatted" M*jpg
Warning: Error opening file - MumDad 1939 - Copy.jpg.json
Warning: Month '19' out of range 1..12 in ExifIFD:DateTimeOriginal (PrintConvInv) - MumDad 1939.jpg.json
Warning: No writable tags set from MumDad 1939.jpg.json
    0 image files updated
    2 image files unchanged

Any help would be appreciated


Phil Harvey

I ran some tests, and the POSIX date conversion libraries don't seem to work with %I.  You should use %H instead.  Also, typically they have problems with years before 1970.

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

StarGeek

You should also take note that Google does not remove any metadata from the files you downloaded.  Unless you made changes on the Google website, you do not need to re-embed the metadata.  It will be unchanged from when you uploaded 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).

andyval

Thanks for the quick response.

The %H worked perfectly - thank you. I'd stupidly simply copied from another post and changed the position of the arguments rather than check all the possible arguments. However the warning that it was a month out of range stopped me checking further.

I appreciate that Google doesn't change anything(after many searches on this forum) however I changed numerous photos over the last couple of years including thousands of negatives which I've generated from my family archives.


andyval

I think that this is more for info than coding action.

All seemed to be going well using the formatted date which I decided to use for all photos rather than time stamped option until I got to September dated jsons.

I suspect the problem relates to the 4 characters that Google has decided to use for the month of September - "Sept", rather the 3 characters used for all the other months.

I'm not sure how you can cater for this because I assume that this is a standard library call?

This is the contents of a failed conversion:
Photo Last Modified Time Formatted: 22 Dec 2021, 08:43:02 UTC
[JSON]          Photo Last Modified Time Timestamp: 1640162582
[JSON]          Photo Taken Time Formatted      : 1 Sept 2021, 21:11:41 UTC
[JSON]          Photo Taken Time Timestamp      : 1630530701


And the error message
Warning: Month '21' out of range 1..12 in ExifIFD:DateTimeOriginal (PrintConvInv) - IMG-20210901-WA0001.jpg.json
Warning: No writable tags set from IMG-20210901-WA0001.jpg.json
    0 image files updated
    1 image files unchanged


This is the contents of the apparent successful conversion
Photo Last Modified Time Formatted: 11 Dec 2021, 03:02:17 UTC
[JSON]          Photo Last Modified Time Timestamp: 1639191737
[JSON]          Photo Taken Time Formatted      : 19 Sept 2021, 10:14:02 UTC
[JSON]          Photo Taken Time Timestamp      : 1632046442

And the results in the new jpg
Date/Time Original              : 2021:10:14 02:00:00
Create Date                     : 2021:10:14 02:00:00