This is a "Remind my future self how to do this, but hopefully it'll be helpful for the rest of y'all too" post!
To change the timestamps on files exported from the Mac's Photos app to match the dates that the photos and/or videos were actually taken:
1. Install exiftool if it isn't already installed:
brew install exiftool
2. One a a time, run these two commands from the terminal, from the directory where the files are located:
for file in *.jpeg; do touch -t "$(exiftool -p '$CreateDate' -d '%Y%m%d%H%M' "$file")" "$file"; done
for file in *.mov; do touch -t "$(exiftool -p '$CreationDate' -d '%Y%m%d%H%M' "$file")" "$file"; done
When those are done, each file's timestamp should match the actual date that the photo or video was taken.
Any The ExtractEmbedded option may find more tags in the media data
warnings can be ignored.
Background
When copying photos and/or videos from an iPhone to a Mac, the copied photos don't end up as individual files in the Mac's filesystem. Instead, they become part of the "Photos Library" on the Mac, in which all photos and movies are stored in a single "blob" file.
Fortunately -- for the purpose of copying and/or backing up photos elsewhere, on non-Apple computers or cloud storage -- the Mac's Photos app provides a capability to "export" photos and videos from the library as individual files. (This is accessed via File menu > Export.)
Two export options are provided: "Unmodified Originals" (which tend to have large file sizes); or as JPG, TIFF, or PNG files (for photos), and .mov files for videos (which produces smaller file sizes).
Unfortunately, the exported photo and image files have a timestamp (shown as "Date Modified" in Finder) of the time the export was performed -- not the time that each individual photo or video was actually taken.
For me, having the date shown for each file in Finder match the date that the photo/video was originally taken is a lot more useful. Hence, the procedure described earlier in this post to make that change.
"CreateDate" versus "CreationDate"
You may have noticed that in the two terminal commands above, the former uses the EXIF tag "CreateDate", and the latter, "CreationDate".
For some reason -- for photos and videos exported using the Photos app on macOS Ventura 13.4, and originally taken on an iPhone running iOS 16.5 -- exported .jpeg and .mov files, respectively, have inconsistent sets of EXIF tags.
The EXIF tags on a paritcular file can be inspected using exiftool via a terminal command like:
exiftool -s my_photo.jpeg
For my exported .jpeg files, this produces output like (with irrelevant tags excluded):
CreateDate: 2023:07:04 09:51:12
There's no "CreationDate" tag present.
For my exported .mov files, the output is like:
CreateDate: 2023:07:22 14:04:56
CreationDate: 2023:07:04 13:39:20+02:00
So both CreateDate and CreationDate values are present; however, here, "CreateDate" is the timestamp of the Mac Photos app export, and CreationDate is the actual time the video was recorded.
I'm sure there are excellent reasons behind this seemingly-inconsistent state of affairs; I am not aware of what those might be. 😅 In any event, it was easy enough, one I investigated and figured out what was going on, to split the exiftool command into two separate parts, for the EXIF tags that are actually present and correct in the .jpeg and .mov files, respectively.
Credit for the original exiftool command that I adapted here goes to Daniel Schofield on the Ask Different Stack Exchange site.
No comments:
Post a Comment
Non-spammers: Thanks for visiting! Please go ahead and leave a comment; I read them all!
Attention SPAMMERS: I review all comments before they get posted, and I REPORT 100% of spam comments to Google as spam! Why not avoid getting your account banned as quickly -- and save us both a little time -- by skipping this comment form and moving on to the next one on your list? Thanks, and I hope you have a great day!