matchDateTime -- matches date/time info in movie files where ExifTool is unable to.
version 0.015
matchDateTime
updates the date/time info in (movie) files where ExifTool is
unable to.
For "normal" movie files, the maker note DateTimeOriginal, XML LastUpdate, and XML CreationDateValue dates (and any other matching dates) are updated with the date as set in the QuickTime CreateDate tag.
MTS and M2TS movie files are handled differently, in that here we take the file modification date as the new target date and update all occurrences of the DateTimeOriginal with this. All sequential timestamps are updated as well.
Important: No other date/time tags than as described will get updated. So if
you want any other tags to change as well, you will need to additionally use
exiftool
.
By default, the timezone information is left as was recorded by the camera, but you can change this by specifying a different timezone (and, for MTS and M2TS files, a different daylight savings flag).
The tool works by replacing any sequence of bytes that exactly match the original value by the (correctly formatted) QuickTime CreateDate. Note that with this approach it is possible that actual movie data is changed as well. This, however, is extremely unlikely: the chance of this occuring is less than 1/256^20 (1/256^10 for MTS/M2TS files).
matchDateTime [-recurse] [-overwrite] [-modtime] [-utc] [-tz TZ [-dst]] <Files>
The following options are available.
Note: option names can be abbreviated so e.g. -r
or -rec
can be used
instead of the full option name -recurse
.
-
-recurse
Recurse directories. This will have matchDateTime process all files in those directories, so use with care!
-
-overwrite
Overwrites the original file instead of renaming it to
_original
. -
-modtime
Instructs matchDateTime to use the file modification time instead of the QuickTime CreateDate.
Note: This option is always in effect when matching the date times of MTS and M2TS files.
-
-utc
Indicates that QuickTime times are in UTC. This will convert the QuickTime time back to the local time, so any updates to e.g. the maker notes DateTimeOriginal will also be in this time.
With this option, if the file was recorded in a different timezone from your local timezone, you should (temporarily) set the timezone to the timezone at the location of the recording. In Unix or on a Mac, this can be done by setting the TZ variable for the duration of the
matchDateTime
command like so:TZ="America/New_York" matchDateTime -utc FILE
. -
-tz TZ
Use TZ as the new time zone. Specify the time zone in hours. Fractional hours are supported (e.g. specify +09:30 as 9.5).
Note: for MTS/M2TS files, only half our precision is supported.
-
-dst
Indicates the daylight savings flag should be set when writing the new timezone information (only used when the
-tz
option is also specified).Note: only applicaple to MTS and MTS2 files.
matchDateTime requires both Perl and ExifTool to be installed.
No installation is required, the script can be called directly. Optionally you
can put the script in a directory on your path so it can be run from anywhere.
On windows you may need to give the file an extension that is recognized as
perl command (e.g., .PL
).
Hayo Baan info@hayobaan.com
This software is copyright (c) 2016 by Hayo Baan.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.