I have many MPEG-4 files transcoded from various digital camera formats for which the file system modified date is correct. I'd like to set the "Media Created" tag to match. This can be done manually in Windows Explorer via the Details tab of the Properties window. Setting Media Created is useful because Windows Live Photo Gallery keys off this field for its Date Taken property. Unfortunately, the number of files makes setting all their dates by hand impractical.
A couple avenues for automation have potential. TagLib# seems to support all the MP4 tags, but the API to get at more than basic tags is unclear. Another angle is the Windows shell. Presumably, Windows Explorer is using it to write the tags. There is an example for reading via the shell, but there doesn't appear to be an API for writing.
I have had success with exiftool
. Here are the commands to list all tags in a media file and update selected tags (batch processing of files is also possible):
C:\>exiftool.exe -short -groupNames test.mp4
[ExifTool] ExifToolVersion : 10.61
[File] FileName : test.mp4
[File] Directory : .
[File] FileSize : 91 MB
[File] FileModifyDate : 2018:06:30 19:25:34+05:00
[File] FileAccessDate : 2018:07:15 14:12:50+05:00
[File] FileCreateDate : 2018:07:15 14:12:50+05:00
[File] FilePermissions : rw-rw-rw-
[File] FileType : MP4
[File] FileTypeExtension : mp4
[File] MIMEType : video/mp4
[QuickTime] MajorBrand : MP4 v2 [ISO 14496-14]
[QuickTime] MinorVersion : 0.0.0
[QuickTime] CompatibleBrands : isom, mp42
[QuickTime] MovieDataSize : 95484206
[QuickTime] MovieDataOffset : 32
[QuickTime] MovieHeaderVersion : 0
[QuickTime] CreateDate : 2018:06:30 14:25:34
[QuickTime] ModifyDate : 2018:06:30 14:25:34
[QuickTime] TimeScale : 1000
[QuickTime] Duration : 0:01:02
-- snip --
[QuickTime] TrackCreateDate : 2018:06:30 14:25:34
[QuickTime] TrackModifyDate : 2018:06:30 14:25:34
-- snip --
[QuickTime] MediaCreateDate : 2018:06:30 14:25:34
[QuickTime] MediaModifyDate : 2018:06:30 14:25:34
-- snip --
C:\>exiftool.exe ^
-QuickTime:CreateDate="2018:07:15 13:15:00" ^
-QuickTime:ModifyDate="2018:07:15 13:15:00" ^
-QuickTime:TrackCreateDate="2018:07:15 13:15:00" ^
-QuickTime:TrackModifyDate="2018:07:15 13:15:00" ^
-QuickTime:MediaCreateDate="2018:07:15 13:15:00" ^
-QuickTime:MediaModifyDate="2018:07:15 13:15:00" ^
test.mp4
C:\>exiftool.exe -short -groupNames test.mp4
-- snip --
[File] FileModifyDate : 2018:07:15 14:19:52+05:00
[File] FileAccessDate : 2018:07:15 14:19:51+05:00
[File] FileCreateDate : 2018:07:15 14:19:39+05:00
-- snip --
[QuickTime] CreateDate : 2018:07:15 13:15:00
[QuickTime] ModifyDate : 2018:07:15 13:15:00
-- snip --
[QuickTime] TrackCreateDate : 2018:07:15 13:15:00
[QuickTime] TrackModifyDate : 2018:07:15 13:15:00
-- snip --
[QuickTime] MediaCreateDate : 2018:07:15 13:15:00
[QuickTime] MediaModifyDate : 2018:07:15 13:15:00
-- snip --