Extracting timestamp metadata from JSON and adding it to corresponding JPG's

Started by Kalinox, January 17, 2021, 08:19:28 PM

Previous topic - Next topic

Kalinox

Background: I am somewhat of a novice and only recently discovered the ExifTool and JSON format. I have a MacBook Pro that runs MacOS Big Sur Version 11.0.1. I have installed the ExifTool.

So, this is my situation:

  • I recently downloaded an archive/copy of all my photos and videos from Facebook (JSON format).
  • This archive is now in a folder on my desktop called "photos_and_videos" that contains subfolders named after my various Facebook albums. Every image has been stripped of its metadata, and the "date created" is the same as the date I downloaded the Facebook archive (which is obviously inaccurate).
  • There is a single .json file per photo album, and each .json file contains the metadata of ALL the images in a particular album. Namely, "uri" , "creation_timestamp" , "title", and "description" (see screenshot attached).

I would like to use the ExifTool via the Terminal to batch/bulk extract the "creation_timestamp" from the .json file for every photo and use it to overwrite the timestamp of the corresponding photos. (Note: the "creation_timestamp" in the .json file seems to be in UNIX format — 10 digits — and may need converting???).

Thank you for any help that you may be able to offer. For your reference, I am attaching:

  • A screenshot of the .json file for a photo album "AdmirablePeople_ousmgdJMjg" that includes just 3 photos.
  • A screenshot of the "AdmirablePeople_ousmgdJMjg" album within the "photos_and_videos" folder. (Includes 3 .jpg files and 1 .json file).

Please let me know if there's anything that you need me to elaborate on or clarify. Thanks again!

StarGeek

That json file is significantly different from the formats that Google Photos and Flickr use.  I think there would be some editing of the json file required before it could be used with exiftool.

I'm assuming that the images listed are from March 2009?  That would be the date if the "creation_timestamp" entry is epoch time.

What is the output of this command when you run it on the json file. 
exiftool -G1 -a -s file.json
Copy/paste the output instead of a screenshot.  Don't need the whole thing if there's a lot of files, just enough to see the details.
* 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).

Kalinox

Thanks for your reply, StarGeek.

Yes, the files are from March 2009.

Here is the output I got:

kalinoxs-mbp:~ kalinox$ exiftool -G1 -a -s /Users/kalinox/Desktop/photos_and_videos/AdmirablePeople_ousmgdJMjg/0.json
[ExifTool]      ExifToolVersion                 : 12.14
[System]        FileName                        : 0.json
[System]        Directory                       : /Users/kalinox/Desktop/photos_and_videos/AdmirablePeople_ousmgdJMjg
[System]        FileSize                        : 1316 bytes
[System]        FileModifyDate                  : 2021:01:15 10:14:38-05:00
[System]        FileAccessDate                  : 2021:01:15 10:14:38-05:00
[System]        FileInodeChangeDate             : 2021:01:17 20:00:49-05:00
[System]        FilePermissions                 : rw-rw-rw-
[File]          FileType                        : JSON
[File]          FileTypeExtension               : json
[File]          MIMEType                        : application/json
[JSON]          Cover_photoCreation_timestamp   : 1236610912
[JSON]          Cover_photoDescription          : Nelson Mandela.
[JSON]          Cover_photoTitle                : -☆- Admirable People -☆-
[JSON]          Cover_photoUri                  : photos_and_videos/AdmirablePeople_ousmgdJMjg/1929078_55985188870_4345868_n_55985188870.jpg
[JSON]          Description                     : Album of people that I believe make this world a better place.
[JSON]          Last_modified_timestamp         : 1236612914
[JSON]          Name                            : -☆- Admirable People -☆-
[JSON]          PhotosCreation_timestamp        : 1236610912, 1236611787, 1236612764
[JSON]          PhotosDescription               : Nelson Mandela., Steve Jobs., Steve Irwin.
[JSON]          PhotosTitle                     : -☆- Admirable People -☆-, -☆- Admirable People -☆-, -☆- Admirable People -☆-
[JSON]          PhotosUri                       : photos_and_videos/AdmirablePeople_ousmgdJMjg/1929078_55985188870_4345868_n_55985188870.jpg, photos_and_videos/AdmirablePeople_ousmgdJMjg/1929078_55988278870_7827430_n_55988278870.jpg, photos_and_videos/AdmirablePeople_ousmgdJMjg/1929078_55991583870_2891056_n_55991583870.jpg