Patched incorrect time zero for QuickTime date/time tag

Started by jaybee, November 08, 2016, 09:10:48 AM

Previous topic - Next topic

Phil Harvey

OK.  Well that was the only idea that I had.  I must admit that I don't know what is going on here.  I can't imagine why PM doesn't seem to be consistent in the time base that it uses.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ferenc009

Several years later, I have also zero Quicktime problem.
I'm importing photos/video to my MAC's Photos app, and some of my old mp4 videos from my Samsung Galaxy Ace mobile are shown as 1945 instead of 2011.
These are the times printed by Exiftool:
exiftool -time:all -api quicktimeutc video-2011-10-16-13-29-34.mp4
File Modification Date/Time     : 2011:10:16 13:30:28+02:00
File Access Date/Time           : 2018:08:01 00:22:39+02:00
File Inode Change Date/Time     : 2020:07:08 17:46:31+02:00
Create Date                     : 1945:10:15 13:30:29+02:00
Modify Date                     : 1945:10:15 13:30:29+02:00
Track Create Date               : 1945:10:15 13:30:29+02:00
Track Modify Date               : 1945:10:15 13:30:29+02:00
Media Create Date               : 1945:10:15 13:30:29+02:00
Media Modify Date               : 1945:10:15 13:30:29+02:00


exiftool -time:all video-2011-10-16-13-29-34.mp4
File Modification Date/Time     : 2011:10:16 13:30:28+02:00
File Access Date/Time           : 2018:08:01 00:22:39+02:00
File Inode Change Date/Time     : 2020:07:08 17:46:31+02:00
Create Date                     : 2011:10:16 11:30:29
Modify Date                     : 2011:10:16 11:30:29
Track Create Date               : 2011:10:16 11:30:29
Track Modify Date               : 2011:10:16 11:30:29
Media Create Date               : 2011:10:16 11:30:29
Media Modify Date               : 2011:10:16 11:30:29


I tried to shift dates by 66 years but then I receive the "Warning: Value above int32u maximum for CreateDate". I assume because my files are 32 bits.  I don't know how these files are formatted but interestingly just a month earlier video doesn't have this problem:

exiftool -time:all -api quicktimeutc video-2011-09-19-18-55-26.mp4
File Modification Date/Time     : 2011:09:19 18:55:54+02:00
File Access Date/Time           : 2018:08:05 16:24:25+02:00
File Inode Change Date/Time     : 2020:07:08 17:52:59+02:00
Create Date                     : 2011:09:19 18:55:26+02:00
Modify Date                     : 2011:09:19 18:55:26+02:00
Year                            : 0
Track Create Date               : 2011:09:19 18:55:26+02:00
Track Modify Date               : 2011:09:19 18:55:26+02:00
Media Create Date               : 2011:09:19 18:55:26+02:00
Media Modify Date               : 2011:09:19 18:55:26+02:00


exiftool -time:all -api quicktimeutc -s video-2011-09-19-18-55-26.mp4
FileModifyDate                  : 2011:09:19 18:55:54+02:00
FileAccessDate                  : 2018:08:05 16:24:25+02:00
FileInodeChangeDate             : 2020:07:08 17:52:59+02:00
CreateDate                      : 2011:09:19 18:55:26+02:00
ModifyDate                      : 2011:09:19 18:55:26+02:00
Year                            : 0
TrackCreateDate                 : 2011:09:19 18:55:26+02:00
TrackModifyDate                 : 2011:09:19 18:55:26+02:00
MediaCreateDate                 : 2011:09:19 18:55:26+02:00
MediaModifyDate                 : 2011:09:19 18:55:26+02:00


My question is: can those date's be changed to 64 bit uints or does the "Year: 0" field makes the point?
Any idea to correct? Thank you very much in advance.

wywh

Quote from: ferenc009 on July 08, 2020, 12:22:37 PM
I'm importing photos/video to my MAC's Photos app, and some of my old mp4 videos from my Samsung Galaxy Ace mobile are shown as 1945 instead of 2011.

If all your videos use a (correct?) date as a filename like in your examples (video-YYYY-MM-DD-hh-mm-ss.*) then you could try the following command which I recently used to fix the dates in my movies (I use YYYY-MMDD-hhmm-ss.* but exiftool seems to accept also your date format just fine). Now my imported movies and images sort correctly in Catalina's Photos.app 5.0 (if also images' EXIF dates are correct).

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

StarGeek

Posted a whole long thing, then noticed you had posted some answers to my questions.  This is definitely weird.

Quote from: ferenc009 on July 08, 2020, 12:22:37 PM
I tried to shift dates by 66 years but then I receive the "Warning: Value above int32u maximum for CreateDate". I assume because my files are 32 bits.

It's because the video timestamps are saved as a unsigned 32 bit integer.  Shifting by that much probably overflows the value.

QuoteMy question is: can those date's be changed to 64 bit uints or does the "Year: 0" field makes the point?
Any idea to correct? Thank you very much in advance.

The spec requires that it's saved as a 32 bit uint.  You can't change that.

None of my vids have the Year tag and don't have that problem so that's not it.

Try something simple like copying the tag back onto the tag to see if that fixes it.  For example
exiftool '-CreateDate<CreateDate' '-ModifyDate<ModifyDate' video-2011-10-16-13-29-34.mp4
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

ferenc009

Thank you both the quick answers!
StarGeek's approach didn't work for me but wywh's answer worked for me:

Quote from: wywh on July 08, 2020, 01:06:39 PM
If all your videos use a (correct?) date as a filename like in your examples (video-YYYY-MM-DD-hh-mm-ss.*) then you could try the following command which I recently used to fix the dates in my movies (I use YYYY-MMDD-hhmm-ss.* but exiftool seems to accept also your date format just fine). Now my imported movies and images sort correctly in Catalina's Photos.app 5.0 (if also images' EXIF dates are correct).

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

issam9973

Hi all,

Wanted to share my recent experience with this issue and how i solved it. Source Phone was a Google Nexus S. This thread helped, thanks all :)

Quick Answer: This worked great: -'QuickTime:CreateDate<QuickTime:CreateDate'

The QuickTime date tags on some files fit my current system time zone (-04), but others have a different time zone (-05). Solution to this was different and not optimal, detailed below.

Detail:

I want to have my library file name reflect the local time of the media file. The file below reflects a video taken at 6h40pm (it's day time in the video!) while it is being recognized as 10h40pm (maybe from previous scripts i run on the file). My main custom DateTime tag is called "MyDateTime" (in .ExifTool_config) is not able to recognize the date when using -api QuickTimeUTC

exiftool -*Date* -s -G -api QuickTimeUTC ./


======== ./20130509_224049_000000.MP4
[File]          FileModifyDate                  : 2013:05:09 22:40:49-04:00
[File]          FileAccessDate                  : 2013:05:09 22:40:49-04:00
[File]          FileInodeChangeDate             : 2021:10:25 19:23:59-04:00
[QuickTime]     CreateDate                      : 1947:05:09 18:40:49-04:00
[QuickTime]     ModifyDate                      : 1947:05:09 18:40:49-04:00
[QuickTime]     TrackCreateDate                 : 1947:05:09 18:40:49-04:00
[QuickTime]     TrackModifyDate                 : 1947:05:09 18:40:49-04:00
[QuickTime]     MediaCreateDate                 : 1947:05:09 18:40:49-04:00
[QuickTime]     MediaModifyDate                 : 1947:05:09 18:40:49-04:00
[Composite]     MyDateTime                      :
[Composite]     MyDateTimeFromFileName          : 2013:05:09 22:40:49
[Composite]     MyFileNameDateTimeSubsecFull    : 20130509_224049_000000.MP4


Output when not using -api QuickTimeUTC:

exiftool -*Date* -s -G ./


======== ./20130509_224049_000000.MP4
[File]          FileModifyDate                  : 2013:05:09 22:40:49-04:00
[File]          FileAccessDate                  : 2013:05:09 22:40:49-04:00
[File]          FileInodeChangeDate             : 2021:10:25 19:23:59-04:00
[QuickTime]     CreateDate                      : 2013:05:09 22:40:49
[QuickTime]     ModifyDate                      : 2013:05:09 22:40:49
[QuickTime]     TrackCreateDate                 : 2013:05:09 22:40:49
[QuickTime]     TrackModifyDate                 : 2013:05:09 22:40:49
[QuickTime]     MediaCreateDate                 : 2013:05:09 22:40:49
[QuickTime]     MediaModifyDate                 : 2013:05:09 22:40:49
[Composite]     MyDateTime                      : 2013:05:09 22:40:49
[Composite]     MyFileNameDateTimeSubsecFull    : 20130509_224049_000000.MP4



Running this command solved it:


exiftool  \
-'QuickTime:CreateDate<QuickTime:CreateDate' \
-'QuickTime:ModifyDate<QuickTime:ModifyDate' \
-'QuickTime:TrackCreateDate<QuickTime:TrackCreateDate' \
-'QuickTime:TrackModifyDate<QuickTime:TrackModifyDate' \
-'QuickTime:MediaCreateDate<QuickTime:MediaCreateDate' \
-'QuickTime:MediaModifyDate<QuickTime:MediaModifyDate' \
-overwrite_original \
-r -P \
./



Warning: [minor] Patched incorrect time zero for QuickTime date/time tag - ./20130509_224049_000000.MP4


After that it seems fixed:

exiftool -*Date* -s -G -api QuickTimeUTC ./


======== ./20130509_224049_0000.MP4
[File]          FileModifyDate                  : 2013:05:09 22:40:49-04:00
[File]          FileAccessDate                  : 2013:05:09 22:40:49-04:00
[File]          FileInodeChangeDate             : 2021:10:25 19:47:23-04:00
[QuickTime]     CreateDate                      : 2013:05:09 18:40:49-04:00
[QuickTime]     ModifyDate                      : 2013:05:09 18:40:49-04:00
[QuickTime]     TrackCreateDate                 : 2013:05:09 18:40:49-04:00
[QuickTime]     TrackModifyDate                 : 2013:05:09 18:40:49-04:00
[QuickTime]     MediaCreateDate                 : 2013:05:09 18:40:49-04:00
[QuickTime]     MediaModifyDate                 : 2013:05:09 18:40:49-04:00
[Composite]     MyDateTime                      : 2013:05:09 18:40:49
[Composite]     MyDateTimeFromFileName          : 2013:05:09 22:40:49
[Composite]     MyFileNameDateTimeSubsecFull    : 20130509_184049_000000.MP4


Only remained to update FileModifyDate to complete cleanup. Note that using -api QuickTimeUTC was necessary.


exiftool  -'FileModifyDate<QuickTime:CreateDate' -overwrite_original -api QuickTimeUTC ./
exiftool -*Date* -s -G ./



======== ./20130509_224049_000000.MP4
[File]          FileModifyDate                  : 2013:05:09 18:40:49-04:00
[File]          FileAccessDate                  : 2013:05:09 18:40:49-04:00
[File]          FileInodeChangeDate             : 2021:10:25 19:57:01-04:00
[QuickTime]     CreateDate                      : 2013:05:09 18:40:49-04:00
[QuickTime]     ModifyDate                      : 2013:05:09 18:40:49-04:00
[QuickTime]     TrackCreateDate                 : 2013:05:09 18:40:49-04:00
[QuickTime]     TrackModifyDate                 : 2013:05:09 18:40:49-04:00
[QuickTime]     MediaCreateDate                 : 2013:05:09 18:40:49-04:00
[QuickTime]     MediaModifyDate                 : 2013:05:09 18:40:49-04:00
[Composite]     MyDateTime                      : 2013:05:09 18:40:49
[Composite]     MyDateTimeFromFileName          : 2013:05:09 22:40:49
[Composite]     MyFileNameDateTimeSubsecFull    : 20130509_184049_000000.MP4


Files with different QuickTime time zone

exiftool -*Date* -s -G -api QuickTimeUTC  ./


======== ./20130425_022243_000000.MP4
[File]          FileModifyDate                  : 2013:04:25 02:22:43-04:00
[File]          FileAccessDate                  : 2021:10:26 14:04:36-04:00
[File]          FileInodeChangeDate             : 2021:10:26 14:04:52-04:00
[QuickTime]     CreateDate                      : 1947:04:24 21:22:43-05:00
[QuickTime]     ModifyDate                      : 1947:04:24 21:22:43-05:00
[QuickTime]     TrackCreateDate                 : 1947:04:24 21:22:43-05:00
[QuickTime]     TrackModifyDate                 : 1947:04:24 21:22:43-05:00
[QuickTime]     MediaCreateDate                 : 1947:04:24 21:22:43-05:00
[QuickTime]     MediaModifyDate                 : 1947:04:24 21:22:43-05:00
[Composite]     MyDateTime                      :
[Composite]     MyDateTimeFromFileName          : 2013:04:25 02:22:43
[Composite]     MyFileNameDateTimeSubsecFull    : 20130425_022243_000000.MP4


assigning quicktime date tags to themselves seems to solve it, however changes quicktime timezone to system time zone.
-'QuickTime:CreateDate<QuickTime:CreateDate'


Warning: [minor] Patched incorrect time zero for QuickTime date/time tag - ./20130425_022243_0000_AIB_ISSAM_720X480_ISSAM_AIB.MP4



[QuickTime]     CreateDate                      : 2013:04:24 22:22:43-04:00
...


What i did was to change the system time zone to -05 (Central Time):


[File]          FileModifyDate                  : 2013:04:25 01:22:43-05:00
...
[QuickTime]     CreateDate                      : 2013:04:24 21:22:43-05:00
...


Then assign


exiftool  -'FileModifyDate<QuickTime:CreateDate' -overwrite_original -api QuickTimeUTC ./
exiftool -*Date* -s -G ./


This corrects the dates the way i want them to appear:

exiftool -*Date* -s -G -api QuickTimeUTC  ./
======== ./20130425_022243_000000.MP4
[File]          FileModifyDate                  : 2013:04:24 21:22:43-05:00
...
[QuickTime]     CreateDate                      : 2013:04:24 21:22:43-05:00
...
[Composite]     MyDateTime                      : 2013:04:24 21:22:43
[Composite]     MyFileNameDateTimeSubsecFull    : 20130424_212243_000000.MP4


However, after i switched the time zone back to the current one (-04), the local time is one hour off.

I had to manually shift the time by one hour: not sure if there is a cleaner solution as this one corrects the local time but corrupts the UTC information!


-'QuickTime:CreateDate-="1:0:0"' \
-'QuickTime:ModifyDate-="1:0:0"' \
-'QuickTime:TrackCreateDate-="1:0:0"' \
-'QuickTime:TrackModifyDate-="1:0:0"' \
-'QuickTime:MediaCreateDate-="1:0:0"' \
-'QuickTime:MediaModifyDate-="1:0:0"' \



======== ./20130425_022243_000000.MP4
[File]          FileModifyDate                  : 2013:04:24 21:22:43-04:00
[File]          FileAccessDate                  : 2013:04:24 21:22:43-04:00
[File]          FileInodeChangeDate             : 2021:10:26 18:26:45-04:00
[QuickTime]     CreateDate                      : 2013:04:25 01:22:43
[QuickTime]     ModifyDate                      : 2013:04:25 01:22:43
[QuickTime]     TrackCreateDate                 : 2013:04:25 01:22:43
[QuickTime]     TrackModifyDate                 : 2013:04:25 01:22:43
[QuickTime]     MediaCreateDate                 : 2013:04:25 01:22:43
[QuickTime]     MediaModifyDate                 : 2013:04:25 01:22:43
[Composite]     MyDateTime                      : 2013:04:25 01:22:43
[Composite]     MyFileNameDateTimeSubsecFull    : 20130424_212243_000000.MP4

- Issam