ExifTool Forum

ExifTool => Newbies => Topic started by: metalhead on October 28, 2019, 09:13:04 PM

Title: Setting 'date modified' = 'media created', and 'media created' = 'date modified'
Post by: metalhead on October 28, 2019, 09:13:04 PM
I have many MP4 files (created by my GoPro) where the 'date modified' timestamp is earlier than the 'media created' timestamp.  For these files I would like to set the 'date modified' timestamp to match the 'media created' timestamp.  BTW, I do mean 'media created' and not 'date created'.

I also have many MP4 files where the 'media created' timestamp is wrong, however, the correct timestamp appears to be the 'date modified' timestamp.  For these files I would like to set the 'media created' timestamp to match the 'date modified' timestamp.

Please can someone explain how to achieve this using ExifTool?
Title: Re: Setting 'date modified' = 'media created', and 'media created' = 'date modified'
Post by: Phil Harvey on October 29, 2019, 07:07:38 AM
First, see FAQ 2 (https://exiftool.org/faq.html#Q2) to determine the names of the tags you are interested in.  Then, you can use a command like this to copy from one to another:

exiftool "-TO_TAG<FROM_TAG" DIR

To compare tags and copy only if one comes before the other, do this:

exiftool -if "$TO_TAG lt $FROM_TAG" "-TO_TAG<FROM_TAG" DIR

- Phil
Title: Re: Setting 'date modified' = 'media created', and 'media created' = 'date modified'
Post by: StarGeek on October 29, 2019, 11:10:46 AM
To expand a bit further.  We don't know what program you're using to get the "date modified", "media created", and "date created" values.  Additionally, we don't know where that program is grabbing the information from, as there can be multiple places it can read to get the data.  Just about every program interprets the metadata in slightly different ways and often gives it names different from what exiftool does.

Take the example of "date modified".  That value could be taken from the OS system timestamp (FileModifyDate), the XMP modify timestamp (XMP:ModifyDate) , the modify date in the Quicktime header (Quicktime:ModifyDate), or from the MediaModifyDate or TrackModifyDate from one of the video/audio/other streams in the file, of which every track in the file has.  So in the last case, if the file has a video stream, an English audio stream, a German audio steam, an English subtitle steam, and a German subtitle stream, you have Track1 through Track5, each with the  MediaModifyDate/TrackModifyDate data.

Since you're looking for just time stamp data, I'd suggest further refining the command from FAQ 2 to this:
exiftool -G1 -a -s -time:all FILE.MP4
That will list all time metadata in the file.  Then you can get the names you want to copy to and from and use the commands that Phil listed above.
Title: Re: Setting 'date modified' = 'media created', and 'media created' = 'date modified'
Post by: metalhead on October 30, 2019, 02:46:31 PM
Thanks Phil Harvey and StarGeek for the replies.

BTW, StarGeek, the program I was using to view the date/time was File Explorer in Windows 10.

Using those commands, I can now see what's happening (in most cases).  File Explorer shows 'Media created' as '17/05/2015 13:50' and 'Date modified' as '17/05/2015 13:04', which confused me.  This 14 minute video started recording at 12:50 and finished at 13:04 local time.  Going by the date of this video, I can tell it was British Summer Time (+01:00).

FWIW, if I change my PC's clock back to BST (as per when the video was recorded), File Explorer shows 'Media created' as '17/05/2015 12:50' and 'Date modified' as '17/05/2015 12:04'.

Is this File Explorer issue due to the lack of a timezone on MediaCreateDate, as shown in the exiftool output below?

======== ./2015-05-17_125015.mp4
[System]        FileModifyDate                  : 2015:05:17 13:04:24+01:00
[System]        FileAccessDate                  : 2019:10:30 15:49:25+00:00
[System]        FileCreateDate                  : 2019:10:30 15:48:19+00:00
[QuickTime]     CreateDate                      : 2015:05:17 12:50:15
[QuickTime]     ModifyDate                      : 2015:05:17 12:50:15
[Track1]        TrackCreateDate                 : 2015:05:17 12:50:15
[Track1]        TrackModifyDate                 : 2015:05:17 12:50:15
[Track1]        MediaCreateDate                 : 2015:05:17 12:50:15
[Track1]        MediaModifyDate                 : 2015:05:17 12:50:15
[Track2]        TrackCreateDate                 : 2015:05:17 12:50:15
[Track2]        TrackModifyDate                 : 2015:05:17 12:50:15
[Track2]        MediaCreateDate                 : 2015:05:17 12:50:15
[Track2]        MediaModifyDate                 : 2015:05:17 12:50:15
Title: Re: Setting 'date modified' = 'media created', and 'media created' = 'date modified'
Post by: StarGeek on October 30, 2019, 02:58:34 PM
For a video, according to the spec, the timestamps are supposed to be in UTC.  But a lot of cameras that aren't aware of the time zone will record the time as the local time.  Windows, for once, understand the spec and correctly adjusts the time in the file to your local time.  So in this case, it appears that the time stamp wasn't properly recorded and needs adjustment.

I believe you can adjust the video timestamps back by an hour with this command
exiftool -quicktime:time:all-=1 FILE.mp4
Title: Re: Setting 'date modified' = 'media created', and 'media created' = 'date modified'
Post by: metalhead on October 31, 2019, 11:03:40 PM
Thank you... I'm slowly getting there!