You may need different commands for different types of files. Certainly this is true if you have any video files. I think you need to break this down into smaller units and tackle them one problem at a time.
- Phil
A little late, but here are my suggestions
Quote from: Stijns on June 10, 2021, 07:24:09 PM
Took the Takeout route (because during the years I edited/corrected descriptions, dates, etc. of pictures in Google Photos).
Side Rant: I tend not to help with the Google takeout anymore because I've spent the last year arguing with people about how Google does not strip any metadata. I've been told before that I have a huge amount of patience, but I've reached my end on this subject.
However, since you've spend a long time adding/correcting data through the website, you have the exact case that this was made for. So hopefully, I can help here.
Quoteexiftool -r -d %s -tagsfromfile "%d/%F.json" "-GPSAltitude<GeoDataAltitude" "- GPSLatitude<GeoDataLatitude" "-GPSLatitudeRef<GeoDataLatitude" "- GPSLongitude<GeoDataLongitude" "-GPSLongitudeRef<GeoDataLongitude" "-Keywords<Tags" "- Subject<Tags" "-Caption-Abstract<Description" "-ImageDescription<Description" "- DateTimeOriginal<PhotoTakenTimeTimestamp" -ext "*" -overwrite_original -progress --ext json <DirToProcess>
You seem to have it covered, but here's a couple of suggestions. For the GPS coordinates, you can use a wildcard to shorten the command. Replace all your GPS options with this
'-GPSAltitude*<GeoDataAltitude' '-GPSLatitude*<GeoDataLatitude' '-GPSLongitude*<GeoDataLongitude'Both the main tag and the Ref tag will be written with this. Also, since you're on a Mac, I changed the double quotes into single quotes. It doesn't matter for this command but if the command includes a dollar sign
$ then you'll get unexpected results as the Terminal will interpret that as a shell variable instead of part of the exiftool command.
Also, you might want to write
AllDates instead of just
DateTimeOriginal.
AllDates includes
CreateDate and
ModifyDate as well as
DateTimeOriginal. You should also be aware that the timestamp in the json file is in UTC so the time written might be off by the timezone of where the image was shot.
Quote- "Error: Not a valid HEIC (looks more like a JPEG)" > no idea why this happened
You have some jpegs that have a HEIC extension rather than jpg. Exiftool won't write these because it might corrupt the image if it tries to write these as jpegs and they actually are HEIC. If you fix this, then the files should be processed properly by your original command. Try this command to rename them. This assumes you're using ver 12.22 or higher. If not, the command will need changing
exiftool -ext heic '-Filename<$BaseName.FileTypeExtension' /path/to/filesThis is also an example of needing to use single quotes instead of double quotes for Mac.
Quote- "Warning: Error opening file" > this happened to files with filenames ending with (1), (2),...
This is because when there are two files with the same name, Google adds a copy number. The trouble is that it puts the copy number before the extension and so you end up with a json filename that has the original base name of the image where the image name is now different. For example, if you have a file
Test4(1).jpg, the json name is
Test4.jpg(1).json. And exiftool tries to look for a file named
Test4(1).jpg.json which is incorrect.
I'd suggest renaming all the problem json files with this command.
exiftool -ext json -r -if '$Filename=~/(\.[^.]+)(\(\d+\)).json$$/i' '-Filename<${Filename;s/(\.[^.]+)(\(\d+\)).json$/$2$1.json/}' /path/to/Takeout/This will look for all json files with the format of Extension.(Number).json and correct the filename.
Quote- "Warning: (minor) Maker notes could not be parsed" > this happened to files with long filenames such as "IMG_20190418_212211.jpg "
This can be ignored. For whatever reason, exiftool can't recognize the camera proprietary MakerNotes data. This can often happen when a program that is aware of MakerNotes incorrectly edits the file. Or it can be just something that exiftool doesn't know about.
Quote- Videos never had their metadata updated (missing gps location and description/title)
Videos data is different. Tags such as
Caption-Abstract and
ImageDescription don't exists in videos. You don't mention what program you are using to view the data. If you check with exiftool (see FAQ #3 (https://exiftool.org/faq.html#Q3)) to see where exif, the data is probably there, just not in a location where your program can find it.
Also, with my test Google Takeout, some of the videos did not have a matching json file, so that might be a possibility.
For the GPS coordinates for a video, you'll use the
GPSCoordinates tag, which contains all the data in one tag with no need for ref tags.
'-GPSCoordinates<$GeoDataLatitude, $GeoDataLongitude, GeoDataAltitude'You can add this to your main command as it will do nothing for image tags, since the
GPSCoordinates tag doesn't exist in images except maybe (probably?) the HEIC files.
Quote- Sometimes 'title' and 'description' was updated (with the same data), sometimes only 'description'
So this is dependent on whatever program you're using to view the data, since the command you list doesn't include the a
Title tag. Use FAQ 3 for this.
Quote- Timezones were never taken into account when updating the metadata
Yes, this probably has to be done in a separate command and is more of a problem if you shot images in different timezones (not counting Daylight Savings). For video files, it should be fine as video files are supposed to be set to UTC (see forth paragraph on the Quicktime tags page (https://exiftool.org/TagNames/QuickTime.html)).
Quote- Time taken (corrected in Google Photos) not updated
Since there's no such thing as a "Time Taken" tag, you need to figure out what tag the program you're using reads to update this value.