Using ExifTool to make .mp4 video file dates match contents

I had a bunch of .mp4 and .3gpp video files whose file "create" and "last modified" filesystem dates did not match the meta data inside of the file, and this was causing problems because many apps use the filesystem dates when sorting video files (rather than using the metadata inside the video files).

I found ExifTool could fix this.  Using the ExifToolGUI I could fix them one at a time.  By using the ExifTool cmd-line tool I was able to change them all at once.   The biggest challenge was that most of the documentation was on how to modify the internal meta data, but I wanted to "copy" from the meta data to the filesystem timestamps.

The first trick is to figure out what the "tags" are for the internal metadata and the file system.   I found the ExifTool FAQ #24 which shows how to query for the times:

> exiftool -time:all -a -G0:1 -s MyVideo.mp4

[File:System]   FileModifyDate   : 2014:09:07 19:35:32-06:00
[File:System]   FileAccessDate   : 2015:10:24 22:55:22-06:00
[File:System]   FileCreateDate   : 2015:10:24 22:55:22-06:00
[QuickTime]     CreateDate       : 2013:09:14 00:52:38
[QuickTime]     ModifyDate       : 2013:09:14 00:52:38

From the above the CreateDate & ModifyDate are the internal meta data, and the FileModifyDate etc are the filesystem.

So to update the filesystem date to match the metadata CreateDate I used this command:

> exiftool "-CreateDate>FileModifyDate" MyVideo.mp4

To modify multiple files I used wild-cards on the filename, like *.mp4 to update all mp4 files in the current directory.

=========================

Related, to update the file system time for image files to match the meta data:

> exiftool "-DateTimeOriginal>FileModifyDate" MyPicture.jpg

Note that most apps know how to look into image metadata, so setting the filesystem dates is not as important as for video files.

7 Replies to “Using ExifTool to make .mp4 video file dates match contents”

  1. Thank you for this!!
    You saved my day. Using this combined with Total Commander makes changing Date attributes very easy.

  2. Many thanks! I am dealing with a set of videos taken on iphones in HEVC. Had to convert them to H264 so that Lightroom could understand them (as of 2018_07_13 it only understands HEIC stills, not video).

    Naturally, the conversion left the new files with Lightroom unable to read inside to get the correct creation dates. I was searching around in the exiftool documentation, but your article cut straight to the chase! Excellent!
    Keith

  3. Man, you really saved me with this post. GoPro had a bug in their software that messed up the creation date on the import of video files. I had years worth of video files all with the same date. Running this command fixed them all in about 5 seconds. I've very grateful for the time you spent figuring this out and the time you took to post this information and share.

  4. Thank you so much for this post. My husbands exports all videos from his iphone and iphoto just puts the export date in as the "file created date". So if I sort by date all mp4 files are sorted in on the day he did the export.

    Fortunately the QuickTimeCreateDate still contains the correct date.

    With your post and ExifToolGui I was able to fix this problem and copy the QuickTimeCreateDate to the FileCreateDate and FileModifyDate. Now all videos sort correctly.

Leave a Reply

Your email address will not be published. Required fields are marked *