ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Exifdude on January 11, 2024, 03:49:34 PM

Title: Incorrectly written QuickTime date/time values
Post by: Exifdude on January 11, 2024, 03:49:34 PM
Some of my videos from 2013/2014 that were taken with a phone that I have uploaded to Apple iCloud Photos are showing up with the 66 year offset mentioned in https://exiftool.org/forum/index.php?topic=4322.0
Is there a way to run exiftool against my entire Pictures folder, including sub directories so that it patches only files with the incorrectly written QuickTime date/time values and leaves the others alone?  Also does exiftool patch them automatically when it reads them and if so then is it as simple as running, "exiftool -r DIR" ? Thanks in advance.
Title: Re: Incorrectly written QuickTime date/time values
Post by: Phil Harvey on January 11, 2024, 03:58:58 PM
Identifying only the videos with incorrect date/times may be tricky if the videos have other problems too.  But something like this may do what you want if this is the only warning:

exiftool -if "$warning=~/^Patched/" -tagsfromfile @ "-all:*date" -ext mp4 -r DIR

- Phil

Edit: I added -ext mp4 to the command to process only MP4 videos, but you can change this to anything you want or add more -ext options to process other types as well.
Title: Re: Incorrectly written QuickTime date/time values
Post by: Phil Harvey on January 11, 2024, 05:17:25 PM
Actually, I was thinking about this a bit more.  The following command will handle the case where there are up to 2 other warnings:

exiftool -if "$warning=~/^Patched/ or $copy1:warning=~/^Patched/ or $copy2:warning=~/^Patched/" -tagsfromfile @ "-all:*date" -ext mp4 -r DIR

- Phil

Edit:  I'm thinking of adding a feature in 12.74 to allow all tags of a given name to be tested together (values will be concatenated according to the current -sep option setting:

exiftool -if "$all:warning=~/Patched incorrect time zero/" ...
Title: Re: Incorrectly written QuickTime date/time values
Post by: Exifdude on January 13, 2024, 07:56:05 PM
Thanks for your quick reply Phil.  I ran that against my files but it did not fix the issue. In File Explorer in Windows under the Column "Date" and "Date acquired" it still shows 9/16/1947 with the 66 year offset for the file.

C:\exiftool -if "$warning=~/^Patched/ or $copy1:warning=~/^Patched/ or $copy2:warning=~/^Patched/" -tagsfromfile @ "-all:*date" -ext mp4 -r C:\20130916_165236000.mp4
    1 files failed condition

C:\exiftool C:\20130916_165236000.mp4
ExifTool Version Number        : 12.60
File Name                      : 20130916_165236000.mp4
Directory                      :
File Size                      : 2.3 MB
File Modification Date/Time    : 2023:07:25 20:51:42-04:00
File Access Date/Time          : 2024:01:13 19:44:09-05:00
File Creation Date/Time        : 2024:01:13 19:44:00-05:00
File Permissions                : -rw-rw-rw-
File Type                      : MP4
File Type Extension            : mp4
MIME Type                      : video/mp4
Major Brand                    : MP4 Base Media v1 [IS0 14496-12:2003]
Minor Version                  : 0.0.0
Compatible Brands              : isom, 3gp4
Movie Header Version            : 0
Warning                        : [minor] Patched incorrect time zero for QuickTime date/time tag
Create Date                    : 2013:09:16 19:52:36
Modify Date                    : 2013:09:16 19:52:36
Time Scale                      : 1000
Duration                        : 2.53 s
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                    : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                  : 3
Track Header Version            : 0
Track Create Date              : 2013:09:16 19:52:36
Track Modify Date              : 2013:09:16 19:52:36
Track ID                        : 1
Track Duration                  : 2.29 s
Track Layer                    : 0
Track Volume                    : 0.00%
Image Width                    : 544
Image Height                    : 960
Graphics Mode                  : srcCopy
Op Color                        : 0 0 0
Compressor ID                  : avc1
Source Image Width              : 544
Source Image Height            : 960
X Resolution                    : 72
Y Resolution                    : 72
Compressor Name                :
Bit Depth                      : 24
Pixel Aspect Ratio              : 65536:65536
Video Frame Rate                : 29.666
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date              : 2013:09:16 19:52:36
Media Modify Date              : 2013:09:16 19:52:36
Media Time Scale                : 48000
Media Duration                  : 2.53 s
Handler Type                    : Audio Track
Handler Description            : SoundHandle
Balance                        : 0
Audio Format                    : mp4a
Audio Channels                  : 1
Audio Bits Per Sample          : 16
Audio Sample Rate              : 48000
Media Data Size                : 1473135
Media Data Offset              : 810040
XMP Toolkit                    : Image::ExifTool 10.63
Date/Time Original              : 2013:09:16 16:52:36-04:00
Image Size                      : 544x960
Megapixels                      : 0.522
Avg Bitrate                    : 4.66 Mbps
Rotation                        : 0
Title: Re: Incorrectly written QuickTime date/time values
Post by: Phil Harvey on January 13, 2024, 09:31:37 PM
OK.  I found a sample with this problem for testing.

You're right, the -if condition isn't working because the word "Patched" isn't at the start of the string (it comes after "[minor]").  Try removing the caret (^) in the -if condition.

- Phil
Title: Re: Incorrectly written QuickTime date/time values
Post by: Exifdude on January 16, 2024, 07:52:47 PM
That did it! Thank you so much.  It is now making a copy of the file and then marking the original as an ".mp4_original".  What would the string look like to stop it from doing that? I used this command,
exiftool -if "$warning=~/Patched/ or $copy1:warning=~/Patched/ or $copy2:warning=~/Patched/" -tagsfromfile @ "-all:*date" -ext mp4 -r

As a side note, this app that you created has helped me clean up so many issues with my photo/video collection that could not have been fixed otherwise.  I just want to tell you how thankful I am that you created this, I really appreciate it.  I just sent you a donation that was long overdue via Paypal, cheers.
Title: Re: Incorrectly written QuickTime date/time values
Post by: Phil Harvey on January 16, 2024, 09:15:21 PM
Add -overwrite_original to the command to prevent it from preserving the original file.

Thanks for the donation.

- Phil
Title: Re: Incorrectly written QuickTime date/time values
Post by: Exifdude on January 16, 2024, 10:52:57 PM
After I ran it through my files, several came out with a discrepancy I'd like to correct.  What would be the command to overwrite Date/Time Original with the Modify Date?  Thanks in advance.
Title: Re: Incorrectly written QuickTime date/time values
Post by: Phil Harvey on January 17, 2024, 07:39:35 AM
In general, DateTimeOriginal is not writable in QuickTime files.  But in the small chance that yours is, the command would be:

exiftool "-datetimeoriginal<modifydate" FILE

- Phil
Title: Re: Incorrectly written QuickTime date/time values
Post by: StarGeek on January 17, 2024, 10:50:39 AM
Quote from: Phil Harvey on January 17, 2024, 07:39:35 AMIn general, DateTimeOriginal is not writable in QuickTime files.

I believe you mean that EXIF:DateTimeOriginal is generally not writable. That command will write to the Quicktime:DateTimeOriginal as well as XMP-exif:DateTimeOriginal.