Copying dates from MTS files to MP4

Started by StoicWalnut, February 13, 2022, 02:10:49 PM

Previous topic - Next topic

StoicWalnut

I have a folder of MTS files that I've converted to MP4, but the original file dates were not carried over. I'm trying to copy DateTimeOriginal:

exiftool -a -G1 -s -time:all /MTS/00001.MTS
[System]        FileModifyDate                  : 2013:06:13 17:34:40-04:00
[System]        FileAccessDate                  : 2022:02:13 08:39:22-05:00
[System]        FileInodeChangeDate             : 2022:02:13 07:58:03-05:00
[H264]          DateTimeOriginal                : 2013:06:13 17:34:13-04:00


Trying this, I'm able to write the date but the values are null so I assume the date isn't being read from the MTS files:

exiftool -DateTimeOriginal /MTS/ -TrackCreateDate= /MP4/

Ignored superfluous tag name or invalid option: -DateTimeOriginal
    2 directories scanned
    5 image files updated


And here is the result:

exiftool -a -G1 -s -time:all /MP4/00001.mp4
[System]        FileModifyDate                  : 2022:02:13 10:37:34-05:00
[System]        FileAccessDate                  : 2022:02:13 10:37:34-05:00
[System]        FileInodeChangeDate             : 2022:02:13 10:37:34-05:00
[QuickTime]     CreateDate                      : 2022:02:12 14:28:00
[QuickTime]     ModifyDate                      : 2022:02:12 14:28:00
[Track1]        TrackCreateDate                 : 0000:00:00 00:00:00
[Track1]        TrackModifyDate                 : 2022:02:12 14:28:00
[Track1]        MediaCreateDate                 : 2022:02:12 14:28:00
[Track1]        MediaModifyDate                 : 2022:02:12 14:28:00
[Track2]        TrackCreateDate                 : 0000:00:00 00:00:00
[Track2]        TrackModifyDate                 : 2022:02:12 14:28:00
[Track2]        MediaCreateDate                 : 2022:02:12 14:28:00
[Track2]        MediaModifyDate                 : 2022:02:12 14:28:00


Trying another method, the dates are being read, but not written:

exiftool -DateTimeOriginal /MTS/ -ee1= /MP4/

Warning: Tag 'ee1' is not defined
======== /MTS/00001.MTS
Date/Time Original              : 2013:06:13 17:34:13-04:00
======== /MTS/00003.MTS
Date/Time Original              : 2013:06:13 17:36:32-04:00
======== /MTS/00002.MTS
Date/Time Original              : 2013:06:13 17:35:21-04:00
======== /MTS/00005.MTS
Date/Time Original              : 2013:06:13 17:41:47-04:00
======== /MTS/00004.MTS
Date/Time Original              : 2013:06:13 17:38:53-04:00
======== /MP4/00004.mp4
======== /MP4/00005.mp4
======== /MP4/00001.mp4
======== /MP4/00002.mp4
======== /MP4/00003.mp4
    2 directories scanned
   10 image files read


Here is the output:

exiftool -a -G1 -s -time:all /MP4/00001.mp4
[System]        FileModifyDate                  : 2022:02:12 09:28:00-05:00
[System]        FileAccessDate                  : 2022:02:13 10:32:52-05:00
[System]        FileInodeChangeDate             : 2022:02:13 10:39:01-05:00
[QuickTime]     CreateDate                      : 2022:02:12 14:28:00
[QuickTime]     ModifyDate                      : 2022:02:12 14:28:00
[Track1]        TrackCreateDate                 : 2022:02:12 14:28:00
[Track1]        TrackModifyDate                 : 2022:02:12 14:28:00
[Track1]        MediaCreateDate                 : 2022:02:12 14:28:00
[Track1]        MediaModifyDate                 : 2022:02:12 14:28:00
[Track2]        TrackCreateDate                 : 2022:02:12 14:28:00
[Track2]        TrackModifyDate                 : 2022:02:12 14:28:00
[Track2]        MediaCreateDate                 : 2022:02:12 14:28:00
[Track2]        MediaModifyDate                 : 2022:02:12 14:28:00


Any help would be appreciated. I've been reading the forums and looking at other examples, but I seem to be missing something with my syntax.

wywh

#1
This command should copy that DateTimeOriginal to QuickTime:CreateDate as well as other less important metadata dates to all movies in that folder. It does not add any new tags (it does modify Keys:CreationDate if it already exists in iOS movies, for example). Edit it if you want to modify also file dates. Use a newish exiftool version.

exiftool -wm w -api QuickTimeUTC=1 '-AllDates<H264:DateTimeOriginal' '-Track*Date<H264:DateTimeOriginal' '-Media*Date<H264:DateTimeOriginal' '-Keys:CreationDate<H264:DateTimeOriginal' .

StoicWalnut

Hmm, getting another error now:

exiftool -DateTimeOriginal /MTS/ -wm w -api QuickTimeUTC=1 '-AllDates<H264:DateTimeOriginal' '-Track*Date<H264:DateTimeOriginal' '-Media*Date<H264:DateTimeOriginal' '-Keys:CreationDate<H264:DateTimeOriginal' /MP4/
Ignored superfluous tag name or invalid option: -DateTimeOriginal
Warning: No writable tags set from /MP4/00004.mp4
Warning: No writable tags set from /MP4/00005.mp4
Warning: No writable tags set from /MP4/00001.mp4
Warning: No writable tags set from /MP4/00002.mp4
Warning: No writable tags set from /MP4/00003.mp4
    2 directories scanned
    0 image files updated
    5 image files unchanged

wywh

#3
oops, I now notice that you might need to add -TagsFromFile to the command so it copies H264:DateTimeOriginal from the .mts files to -AllDates in the corresponding .mp4 files.

[edit: thanks to StarGeek for chiming in a detailed answer just when I was preparing to dig out my TagsFromFile memo]

StarGeek

Yes, the -TagsFromFile option is needed to copy from one file to another.  And since it's apparent that you're working with multiple files, you'll need to add a Format string so exiftool knows what the source files are.

Assuming that MTS and MP4 directories are below the current directory, i.e. /MTS/00001.mts and /MP4/00001.mp4 as examples,
exiftool -wm w -api QuickTimeUTC -TagsFromFile /MTS/%f.mts -DateTimeOriginal '-AllDates<H264:DateTimeOriginal' '-Track*Date<H264:DateTimeOriginal' '-Media*Date<H264:DateTimeOriginal' '-Keys:CreationDate<H264:DateTimeOriginal' /MP4/

The copying examples section of the docs would be worth reading.

This command creates backup files.  Add -Overwrite_Original to suppress the creation of backup files.

Also, you should read the fourth paragraph on the Quicktime tags page to understand the details of time stamps in video files, which are supposed to be in UTC.  The above command assumes that the DateTimeOriginal in the MTS file is set to the local time in the same time zone as the computer is in.  If the original time stamps are already in UTC, then remove the -api QuickTimeUTC option.  If the time zone is different, ignoring Summer time differences, then a time zone will need to be appended to all of the copying options.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StoicWalnut

Thanks for your help, that did the trick!