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.   ExifTool is a cmd-line tool, so you need to be comfortable with the cmd-line.   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 tmp.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 copy the metadate CreateDate to the FileSystem I used this command:

> exiftool "-CreateDate>FileModifyDate" tmp.mp4

And of course to modify multiple files you can use wild-cards on the filename, like *.mp4

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

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

> exiftool "-DateTimeOriginal>FileModifyDate" tmp.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.

Leave a Reply

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

Please copy the string V9oa2a to the field below: