Hello,
I have extracted all files from Flickr, updated file names to have same name jpg and same json.
I want to get picture taken date specified in json.
Using this:
exiftool -r -d %s -tagsfromfile '%d/%f.json' '-DateTimeOriginal<date_taken' '-FileModifyDate<date_taken' -ext jpg -overwrite_original -progress dir
Json data: "date_taken": "2017-10-10 11:35:28",
======== b/24635562447.jpg [1/1]
Warning: garbage at end of string in strptime: -10-10 11:35:28 in ExifIFD:DateTimeOriginal (PrintConvInv) - b/24635562447.json
Warning: No writable tags set from b/24635562447.json
Nothing changed in b/24635562447.jpg
1 directories scanned
0 image files updated
1 image files unchanged
Please help
First thing to do is to check to see if you actually have to do this. In my experience, Flickr does not remove the original EXIF data from the files. At least, it doesn't if you just download the album. I'm still waiting for my data set to be zipped up.
So unless you made changes on the website, you don't need to copy the json data into the files.
Run this on one of the jpegs to see the time stamps in the file, so you can check to see if you actually need to do this.
exiftool -time:all -g1 -a -s File.jpg
Thanks a lot for respond :)
Yes I have to do this, because some photos are from 1998, some are from phones, where Exif data was deleted and so on.
I have downloaded more than 10000 my pictures from Flickr. I spend a lot of time to make my photos by dates taken in Flickr :(
And when I have downloaded them I saw, that all files are without picture taken dates (all same day - date of download).
Most of files are with exif data, and I use:
exiftool '-FileModifyDate<DateTimeOriginal' dir - it works well
But some files have wrong Exif data (old ones) and some have not exif data.
As example with your command:
exiftool -time:all -g1 -a -s File.jpg
exiftool -time:all -g1 -a -s 24635562447.jpg
---- System ----
FileModifyDate : 2020:10:22 19:41:23+03:00
FileAccessDate : 2020:10:22 19:41:43+03:00
FileInodeChangeDate : 2020:10:22 19:41:42+03:00
I can batch change of json files, changing date from "2017-10-10 11:35:28" format to "2017:10:10 11:35:28", but it also do not work. In json file are more information, but I wrote only this required string, other data I do not need.
Macos 10.15.7
exiftool 12.06
Thanks
Yep, those would need the data added.
What version of exiftool are you using?
exiftool -ver
And what is the result of this command (edit any personal info out)
exiftool -g1 -a -s 24635562447.json
exiftool 12.06
exiftool -g1 -a -s 24635562447.json
MSs-MacBook-Pro:b ms$ exiftool -g1 -a -s 24635562447.json
---- ExifTool ----
ExifToolVersion : 12.06
---- System ----
FileName : 24635562447.json
Directory : .
FileSize : 920 bytes
FileModifyDate : 2020:10:22 20:09:12+03:00
FileAccessDate : 2020:10:22 20:09:39+03:00
FileInodeChangeDate : 2020:10:22 20:13:33+03:00
FilePermissions : rw-rw-r--
---- File ----
FileType : JSON
FileTypeExtension : json
MIMEType : application/json
---- JSON ----
AlbumsId : 72157673303738962
AlbumsTitle : Belekas
AlbumsUrl : https://www.flickr.com/photos/143904381@N02/sets/72157673303738962/
Comment_permissions : any flickr member
Count_comments : 0
Count_faves : 0
Count_notes : 0
Count_tags : 0
Count_views : 5
Date_imported : 2018-01-04 11:35:28
Date_taken : 2017-10-10 11:35:28
Description :
GeoAccuracy : 16
GeoLatitude : 55734680
GeoLongitude : 21086419
Id : 24635562447
License : All Rights Reserved
Name : IMG_1923
Original : https://live.staticflickr.com/4727/24635562447_3f2aafa26a_o.jpg
Photopage : https://www.flickr.com/photos/143904381@N02/24635562447/
Privacy : public
Rotation : 0
Safety : safe
Tagging_permissions : people you follow
Hmmm... Now I'm really puzzled
I copy/pasted your example line ("date_taken": "2017-10-10 11:35:28",) into a json file (still waiting on Flickr to get my own data to test with) and this command worked fine.
exiftool -P -overwrite_original -TagsFromFile temp.json "-DateTimeOriginal<Date_taken" y:\!temp\Test4.jpg
I didn't have to edit the json from dashes to colons.
What's the output of this command
exiftool -ver -v
Digging into the archives suggest that maybe Time::Piece will show up in the above command.
Try your original command but add this
-d '%Y-%m-%d %H:%M:%S'
StarGeek thank you so much, it works :)
exiftool -r -d %s -tagsfromfile '%d/%f.json' '-DateTimeOriginal<date_taken' '-FileModifyDate<date_taken' -ext jpg -overwrite_original -progress -d '%Y-%m-%d %H:%M:%S' dir
======== b/24635562447.jpg [1/1]
1 directories scanned
1 image files updated
:) :) :) :)
Out of curiosity, what is the output of
exiftool -ver -v
exiftool -ver -v
ExifTool version 12.06
Perl version 5.018004 (-C0)
Platform: darwin
Optional libraries:
Archive::Zip 1.37
Compress::Zlib 2.06
Digest::MD5 2.52
Digest::SHA 5.84_02
IO::Compress::Bzip2 2.060
Time::Piece 1.20_01
Unicode::LineBreak (not installed)
IO::Compress::RawDeflate 2.060
IO::Uncompress::RawInflate 2.060
I was basing my guess off of this thread (https://exiftool.org/forum/index.php?topic=8022.0) where Phil's command used POSIX::strptime but the user had Time::Piece. But then, on my Windows computer, it says it's also using Time::Piece (though it's ver 1.31) and it worked fine here.
There have been some obscure differences between Windows and Mac regarding strptime, though.
Going back to your original command:
Quote from: Minske on October 22, 2020, 01:16:49 PM
exiftool -r -d %s -tagsfromfile '%d/%f.json' '-DateTimeOriginal<date_taken' '-FileModifyDate<date_taken' -ext jpg -overwrite_original -progress dir
I think it should work if you drop the
-d %s option. (Why are you using this anyway?)
- Phil
Ah, yes. I should have noticed that. It's needed for Google Takeout, but not for Flickr.
Thanks a lot for help, :) You are right Phill it works well without it :)
I found somewhere in examples -d %s, that it is used for exporting from json. And when I get an error, I started analyse the error, reading about strptime and others, and finally I decided to ask professionals :)
It is great tool!!!!
Quote from: Minske on October 23, 2020, 10:23:41 AM
I found somewhere in examples -d %s, that it is used for exporting from json.
The
-d %s formats the timestamp to be "number of seconds since the Epoch, UTC" (see Common Date Format Codes (https://exiftool.org/filename.html#codes)) which is necessary for Google takeout because it only gives these two formats in jason:
"photoTakenTime": {
"timestamp": "1294607966",
"formatted": "Jan 9, 2011, 9:19:26 PM UTC"As you can see, neither of these match the YYYY MM DD HH mm ss format that exiftool can easily deal with. But Flickr does give the timestamp in the easily usable format, so the
-d option isn't needed.