Change created and modified date shown in finder to match exif data for videos

Started by imac2, July 26, 2020, 09:18:25 PM

Previous topic - Next topic

imac2

Photos and videos exported from photos for Mac show the date the file was exported in Mac Finder. [Actually the date shown is the date I downloaded from iCloud to Photo. I downloaded to Photo then used the export as original option in Photo to export the images and videos.]
I have used the following command to change the dates shown in Finder to match the date in the exif data.
for f in *; do SetFile -d "$(exiftool -p '$CreateDate' -d '%m/%d/%Y %T' "${f}")" -m "$(exiftool -p '$ModifyDate' -d '%m/%d/%Y %T' "${f}")" "${f}"; done

For JPG and HEIC files it seems to work fine. However for .MOV files I got the following error message: "Warning: [minor] The ExtractEmbedded option may find more tags in the media data - IMG_7264.MOV Warning: [minor] The ExtractEmbedded option may find more tags in the media data - IMG_7264.MOV" The message was repeated twice for each file I tested the above command.

Despite the error it did change the time stamp shown in Finder but the time was off by 4 hours.
I looked at the exif date and notice that under "Creation Date : 2020:07:11 20:24:51-04:00" there is a minus 04:00. Also the time stamp in create and modify were as follows:

Create Date                     : 2020:07:12 00:24:51
Modify Date                     : 2020:07:12 00:26:52

However, in Photos it shows as July 11, 2020, 8:24:51 PM (which is when the video was taken). But the exif data seems to be adding four hours to the time the video was actually taken.

Is there a exiftool command that I can use so that it can adjust for this offset of 4 hours? If so would appreciate if someone could tell me how to adjust the command.
I am running Mac OS 10.13.6.
Thanks.

StarGeek

Quote from: imac2 on July 26, 2020, 09:18:25 PM
for f in *; do SetFile -d "$(exiftool -p '$CreateDate' -d '%m/%d/%Y %T' "${f}")" -m "$(exiftool -p '$ModifyDate' -d '%m/%d/%Y %T' "${f}")" "${f}"; done

You should be able to do this with just exiftool (see Common Mistake #3). I'm just guessing with this command since I don't use a Mac and on't know what tags you are actually editing.
exiftool '-FileCreateDate<CreateDate' '-FileModifyDate<ModifyDate' /path/to/files

QuoteHowever for .MOV files I got the following error message: "Warning: [minor] The ExtractEmbedded option may find more tags in the media data - IMG_7264.MOV

This is normal and can be ignored.  It's simply letting you know that exiftool might not have extracted all the data.  In a MOV file, that might be something like an embedded gps track.  For a PDF, it might be embedded images.  It's a Warning, not an Error.

QuoteDespite the error it did change the time stamp shown in Finder but the time was off by 4 hours.
I looked at the exif date and notice that under "Creation Date : 2020:07:11 20:24:51-04:00" there is a minus 04:00.

According to the spec for video timestamps, they're supposed to be set to UTC.  You appear to be in a -04:00(?) time zone and if you directly set the value as you did, it's going to be off by the time zone.  Try adding the -api QuickTimeUTC option.

* 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).

imac2

Thanks StarGeek.
I am not very familiar with using Terminal in Mac nor exiftool. I was using the command shown in my original post that I found mentioned in a forum. Thus, I would appreciate if someone could post the exact command that I should use to incorporate the QuickTimeUTC option into the command. Or direct me to a post that has it.
I am trying to get Finder in Mac to show the Date Modified and Date Created of video files to match the date and time the video was shot so that I can organized the files in Finder by date.
I am running Mac OS 10.13.6.
Thanks.

StarGeek

Just add
-api QuickTimeUTC
to the very end of your command, separated from the previous part by a space.
* 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).

imac2

Thanks again. I would like to apply this to all the files in the folder. The way I plan to do it is first go to Terminal and change directory to the specific directory that contains all the .MOV files. Then apply the exiftool command so that all the files in that directory get updated accordingly.

How precisely should the command be worded? That is what exactly should appear in "/path/to/files" below?

exiftool '-FileCreateDate<CreateDate' '-FileModifyDate<ModifyDate' /path/to/files -api QuickTimeUTC

Thanks.

StarGeek

If you have CDed to the directory that the files are in, then use a dot . to represent the current directory.
* 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).

imac2

Hi Ii am still having some trouble in changing the Date Created and Date Modified shown in Finder for .MOV and some .JPG files.

First with .MOV I noticed that the time stamp is later for Date Created compared to Date Modified in some cases. In those cases Date Modified seems to have the correct creation time.

For .JPG files I can see the date in Photos app in Mac but exiftool does not find that information so no change is made. When I check the exif information in Preview it does not show create date.

I am using the following command for both jpg and mov files:

[exiftool '-FileCreateDate<CreateDate' '-FileModifyDate<ModifyDate' . -api QuickTimeUTC]

Any suggestions would by much appreciated. Thanks.

StarGeek

I don't use a Mac so I can't offer any more advice except to list all the timestamps in the file with this command and see where the problem might be
exiftool -time:all -g1 -a -s -api QuickTimeUTC /path/to/files/
* 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).

wywh

Quote from: imac2 on February 14, 2021, 04:40:11 PM
Hi Ii am still having some trouble in changing the Date Created and Date Modified shown in Finder for .MOV and some .JPG files.

First with .MOV I noticed that the time stamp is later for Date Created compared to Date Modified in some cases. In those cases Date Modified seems to have the correct creation time.

Finder's filesystem file creation and modification dates are not so important but I prefer to set also them the same. I currently use the following command to set all existing dates from the movie filename like YYYY-MMDD-hhmm-ss.* (exiftool -ver 12.16 or later). In macOS the command asks for Xcode Command Line Tools install which can be ignored but then the FileCreateDate moves only backwards in time (the install is quite small and fast, not the huge Xcode install).

exiftool -api QuickTimeUTC=1 '-AllDates<filename' '-Track*Date<filename' '-Media*Date<filename' '-Keys:CreationDate<filename' -execute '-FileCreateDate<filename' '-FileModifyDate<filename' -common_args -m -P -overwrite_original_in_place -wm w .

Show only the date tags (-time:all), actual tag names (-s), what "family 1 group" they belong to (-G1), duplicate tags (-a) and QuickTime tags with system timezone (-api QuickTimeUTC=1. There are no time zones stored for any QuickTime tags, the system ones aren't part of the file, and they reflect only the computer's system time zone):

exiftool -a -G1 -s -api QuickTimeUTC=1 -time:all .

Show also 'MacOS:FileCreateDate':

exiftool -a -G1 -s -api QuickTimeUTC=1 -time:all -api RequestAll=2 .

Movie dates info:

https://discussions.apple.com/docs/DOC-250002750

I use GraphicConverter to set image dates and GPS but in exiftool you could set AllDates (DateTimeOriginal, CreateDate, and ModifyDate) to Any Arbitrary Timestamp with a command like:

exiftool -m -P -overwrite_original_in_place '-AllDates=2015:01:01 08:00:00' a.jpg

I hope this helps.

- Matti