ExifTool Forum

General => Metadata => Topic started by: ganymede55 on December 30, 2015, 06:10:54 PM

Title: m2ts DateTimeOriginal editing
Post by: ganymede55 on December 30, 2015, 06:10:54 PM
On a recent vacation, one of my Sony cameras was off by 11 hours and 38 min (+11:38:00 adjustment), resulting in pictures and videos grouped by the wrong date.  I can get the pictures cleaned up using ExifTool (and other front ends like GeoSetter) and I can use ExifTool or one of the others to adjust the FileCreateDate and FileModifyDate.  Unfortunately, some of my programs use only the DateTimeOriginal to group files in Windows folders or display them by date.  So it seems that my only choice is to update the DateTimeOriginal.  I read that ExifTool does not support this (and it reminds me when I try).  Are there any plans to support this soon or are there any tools that do allow this to be adjusted?  All I've found is tools that adjust the sidecar or similar files, but never the original.  Or is there some sort of workaround that I'm not thinking of?

I've spent way too much time on this and really have no other leads at this point, so this is it before throwing in the towel.  I think updating only the pictures would be worse than leaving everything alone.
Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on December 31, 2015, 01:35:07 AM
DateTimeOriginal is supported, but not in all file formats (especially video). The problem to get this implemented is that video formats are quite a mess (eve more so than raw image files) so Phil has had no reliable way of updating the tag without potentially breaking the file.

A safe way of updating the tag would be to change its value in-place. Without touching any other bits in the file. This is not the way exiftool works though so it can not get implemented this way there :(
Title: Re: m2ts DateTimeOriginal editing
Post by: ganymede55 on December 31, 2015, 02:41:23 PM
Hayo,
Thanks for the reply, but I'm not totally clear on what you're saying.  I know that DateTimeOriginal is supported as a read and that it exists in my file because I can see it in exiftool output.  I'm pretty sure that it's not supported (likely for the reasons you mentioned below).  I can also set FileCreateDate and FileModifyDate to match it.  I'm not clear if that was in question in your response above.

My main question is what do you mean by "change its value in-place"?  Do you mean with exiftool or some other application?  If so, what?  I can't even see the value in the basic windows properties for example.  Any clarifications are much appreciated.
Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on January 01, 2016, 05:44:48 AM
With in-place, I meant editing the data at the exact spot they are in the file. Exiftool always fully rewrites the file (which cleans it up and optimises the structure optimised as well), but with video files this is too error prone so exiftool can't do it. Perhaps you can change the DateTimeOriginal with e.g., Photoshop, but I'm not sure about this.
Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on January 01, 2016, 10:08:44 AM
Ok, I took the time to write a little brute force script that changes the dateTime info in-place. I only had Nikon camera .mov files to test this on, so it might not fully work for you.

Anyway, first some info: there are many places where datetime info is stored in a .mov, for instance when I search for all datetime fields in a test file, here's what I get (-s to show tag names as used internally by exiftool, -a to show duplicate tags, -G0:1 to get group info):
$ exiftool -s -a -G0:1 -'*Date*' t.mov
[File:System]   FileModifyDate                  : 2016:01:01 15:43:24+01:00
[File:System]   FileAccessDate                  : 2016:01:01 15:35:23+01:00
[File:System]   FileInodeChangeDate             : 2016:01:01 15:43:24+01:00
[QuickTime]     CreateDate                      : 2015:01:16 13:57:39
[QuickTime]     ModifyDate                      : 2015:01:16 13:57:39
[QuickTime:Track1] TrackCreateDate              : 2015:01:16 13:57:39
[QuickTime:Track1] TrackModifyDate              : 2015:01:16 13:57:39
[QuickTime:Track1] MediaCreateDate              : 2015:01:16 13:57:39
[QuickTime:Track1] MediaModifyDate              : 2015:01:16 13:57:39
[QuickTime:Track2] TrackCreateDate              : 2015:01:16 13:57:39
[QuickTime:Track2] TrackModifyDate              : 2015:01:16 13:57:39
[QuickTime:Track2] MediaCreateDate              : 2015:01:16 13:57:39
[QuickTime:Track2] MediaModifyDate              : 2015:01:16 13:57:39
[MakerNotes:Nikon] CreateDate                   : 2015:01:16 13:57:39
[MakerNotes:Nikon] DateTimeOriginal             : 2015:01:16 13:57:39
[MakerNotes:Nikon] DateDisplayFormat            : D/M/Y


Now we want to adjust the dates by 11:38:00, so we'd use the following command to change them:
exiftool -s -CreateDate+="11:38:00" -ModifyDate+="11:38:00" -TrackCreateDate+="11:38:00" -TrackModifyDate+="11:38:00" -MediaCreateDate+="11:38:00" -MediaModifyDate+="11:38:00" -DateTimeOriginal+="11:38:00" t.mov
This results in:
$ exiftool -s -a -G0:1 -'*Date*' t.mov
[File:System]   FileModifyDate                  : 2016:01:01 15:44:58+01:00
[File:System]   FileAccessDate                  : 2016:01:01 15:45:23+01:00
[File:System]   FileInodeChangeDate             : 2016:01:01 15:44:58+01:00
[QuickTime]     CreateDate                      : 2015:01:17 01:35:39
[QuickTime]     ModifyDate                      : 2015:01:17 01:35:39
[QuickTime:Track1] TrackCreateDate              : 2015:01:17 01:35:39
[QuickTime:Track1] TrackModifyDate              : 2015:01:17 01:35:39
[QuickTime:Track1] MediaCreateDate              : 2015:01:17 01:35:39
[QuickTime:Track1] MediaModifyDate              : 2015:01:17 01:35:39
[QuickTime:Track2] TrackCreateDate              : 2015:01:17 01:35:39
[QuickTime:Track2] TrackModifyDate              : 2015:01:17 01:35:39
[QuickTime:Track2] MediaCreateDate              : 2015:01:17 01:35:39
[QuickTime:Track2] MediaModifyDate              : 2015:01:17 01:35:39
[MakerNotes:Nikon] CreateDate                   : 2015:01:16 13:57:39
[MakerNotes:Nikon] DateTimeOriginal             : 2015:01:16 13:57:39
[MakerNotes:Nikon] DateDisplayFormat            : D/M/Y

So it worked quite well indeed, apart from the dates in the makernotes...

For this I wrote a little script that matches the QuickTime CreateDate with the makernote DateTimeOriginal. It basically just changes all strings that match a byte indicating the length (20), followed by the DateTime string, followed by a zero byte. This has the side effect of changing the CreateDate in the makernote as well (which is what you'd want anyway).
$ ./mathDateTime  t.mov
OK: Changed date 2 times in t.mov

Which tells me it found and changed the date two times (which is what we expected).
Verifying with exifTool tells us this indeed worked:
$ exiftool -s -a -G0:1 -'*Date*' t.mov
[File:System]   FileModifyDate                  : 2016:01:01 15:49:17+01:00
[File:System]   FileAccessDate                  : 2016:01:01 15:51:23+01:00
[File:System]   FileInodeChangeDate             : 2016:01:01 15:49:17+01:00
[QuickTime]     CreateDate                      : 2015:01:17 01:35:39
[QuickTime]     ModifyDate                      : 2015:01:17 01:35:39
[QuickTime:Track1] TrackCreateDate              : 2015:01:17 01:35:39
[QuickTime:Track1] TrackModifyDate              : 2015:01:17 01:35:39
[QuickTime:Track1] MediaCreateDate              : 2015:01:17 01:35:39
[QuickTime:Track1] MediaModifyDate              : 2015:01:17 01:35:39
[QuickTime:Track2] TrackCreateDate              : 2015:01:17 01:35:39
[QuickTime:Track2] TrackModifyDate              : 2015:01:17 01:35:39
[QuickTime:Track2] MediaCreateDate              : 2015:01:17 01:35:39
[QuickTime:Track2] MediaModifyDate              : 2015:01:17 01:35:39
[MakerNotes:Nikon] CreateDate                   : 2015:01:17 01:35:39
[MakerNotes:Nikon] DateTimeOriginal             : 2015:01:17 01:35:39
[MakerNotes:Nikon] DateDisplayFormat            : D/M/Y


I've attached the script. Just provide it with a list of files to process on the command-line. The files need to have a correct QuickTime CreateDate (e.g., as done with the exiftool command I showed earlier).

WARNING: the script overwrites the original files so ALWAYS have a complete backup of the file you want to change the dates of!!!
Also, have a close look at the number of changes made, if this differs from the expected, chances are it inadvertently changed movie data instead of metadata (though unlikely, the movie data contained an exact match for the data string).

Anyway, try it out and let me know if it worked for you too :)

Please see later post for most current script!
Title: Re: m2ts DateTimeOriginal editing
Post by: ganymede55 on January 01, 2016, 02:51:04 PM
Hayo,
Thanks again for taking the time to work on this!  Unfortunately, I can't get the basic update to work using the commands, so I haven't yet tried the script.  Here are the details:

I picked a copy of a small .m2ts video file to test on, but I also checked several others.  I modified all of the commands to only use it.  I suppose I should have used a copy of exiftool in a local directory to clean things up, so sorry for that.

Anyway, the first question I have is that these .m2ts file types don't seem to have nearly the Date fields that you have in your .MOV example, including the CreateDate field.  (Note that the command exiftool -s -a -G0:1 -time:all "G:\Public Videos\_Updated\8-8-2015\20150808213521.m2ts" returned exactly the same thing.) Is that going to be a show stopper?
C:\Windows\system32>exiftool -s -a -G0:1 -"*Date*" "G:\Public Videos\_Updated\8-8-2015\20150808213521.m2ts"
[File:System]   FileModifyDate                  : 2015:11:17 22:16:08-06:00
[File:System]   FileAccessDate                  : 2016:01:01 13:39:15-06:00
[File:System]   FileCreateDate                  : 2016:01:01 13:39:15-06:00
[H264]          DateTimeOriginal                : 2015:08:08 21:35:21-05:00


I tried writing to the CreateDate field for example just to see if that field was just hidden and could be updated, but no luck (not supported).
C:\Windows\system32>exiftool "-CreateDate<dateTimeOriginal" "G:\Public Videos\_Updated\8-8-2015\20150808213521.m2ts"
Error: Writing of M2TS files is not yet supported - G:/Public Videos/_Updated/8-8-2015/20150808213521.m2ts
    0 image files updated
    1 files weren't updated due to errors


I tried updating the DateTimeOriginal field with the same results
C:\Windows\system32>exiftool -s -DateTimeOriginal+="11:38:00" "G:\Public Videos\_Updated\8-8-2015\20150808213521.m2ts"
Error: Writing of M2TS files is not yet supported - G:/Public Videos/_Updated/8-8-2015/20150808213521.m2ts
    0 image files updated
    1 files weren't updated due to errors


However, I did have success updating the File System fields using the same commands (or copying from the DateTimeOriginal field).
C:\Windows\system32>exiftool -s -fileCreateDate+="11:38:00" -fileModifyDate+="11:38:00" "G:\Public Videos\_Updated\8-8-2015\20150808213521.m2ts"
    1 image files updated

C:\Windows\system32>exiftool -s -a -G0:1 -"*Date*" "G:\Public Videos\_Updated\8-8-2015\20150808213521.m2ts"
[File:System]   FileModifyDate                  : 2015:11:18 09:54:08-06:00
[File:System]   FileAccessDate                  : 2015:11:18 09:54:08-06:00
[File:System]   FileCreateDate                  : 2016:01:02 01:17:15-06:00
[H264]          DateTimeOriginal                : 2015:08:08 21:35:21-05:00


I didn't try running the batch script mainly because I'm not exactly sure how to do that, but also because I don't think it would work since the manual steps you showed didn't.  If you still think it's worth a try, please give me an example of how to run the script (with file names) and I'll try.  I'd also be happy to send you a video file.  Again, thanks for your help!  Please let me know if I'm missing something.

Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on January 01, 2016, 04:23:22 PM
Ah, I see. These .m2ts files are quite a different beast. However, with your info I should be able to alter the script so it would also work for you, but then instead of using the QuickTime CreateDate, I would use the fileModifyDate. (I'd have thought fileCreateDate would be the better choice here, but that seems way off in your examples.)

Also, I notice the DateTimeOriginal has a timezone here, should the one from the fileCreateDate be used here too?
Note that me being able to tweak this does rely on the DateTimeOriginal being easily and uniquely identifiable, in the makernotes the DateTimeOriginal is recorded as a string which has a nice length and is therefore almost certain to be uniquely identifiable. If it is saved as some integer or something, I'm afraid it won't work (reliably).
If you could send me a sample file or point me to a location where I can download one, I could certainly have a go at this.

P.S. Seeing that you're running on Windows and not on UNIX/Mac, you'd need to install perl to be able to use my script too. Are you up to that?
Title: Re: m2ts DateTimeOriginal editing
Post by: ganymede55 on January 02, 2016, 12:21:34 AM
Hayo,
Thanks again.  I uploaded a sample video.  It's a throwaway 5 sec clip that I'm glad I kept for this.  I don't want to add confusion, but the video I have referred to so far shot with a Sony that really only needed to be time-shifted-04:04:00 hours (basically time zone adjustment). I just happened to start editing that one and was planning to :deal with that later" if necessary.  Both cameras were shooting .m2ts videos this past summer in Hawaii (UTC-10 vs the UTC-6 time zone I'm in and computer is set to during downloads.  Hawaii doesn't use daylight savings, but I think it shows as -9 time zone since my camera was set to daylight savings).  Thus, I'd prefer to set to UTC-10, but if I get close (even UTC-5/6), I can deal with it.  For clarity, I'll just focus on the file I have attached which is representative of those from the camera to be adjusted +11:38:00.  All the captures below reference it.

Fresh after copying the file to my test folder, I get the (re)download date of November and today's date as the create date.  Hopefully that explains the "way off" dates you mentioned.
C:\Windows\system32>exiftool -s -a -G0:1 -"*Date*" "G:\Public Videos\_Updated\8-8-2015\20150809234216.m2ts"
[File:System]   FileModifyDate                  : 2015:11:15 15:48:10-06:00
[File:System]   FileAccessDate                  : 2016:01:01 22:26:09-06:00
[File:System]   FileCreateDate                  : 2016:01:01 22:26:09-06:00
[H264]          DateTimeOriginal                : 2015:08:09 23:42:15-09:00


I set the file create and modify dates to match DateTime original using exiftool and it succeeds but time shifts it for UTC-9 vs UTC-5 where I am now.  I think this eliminates the "way off" part you mentioned.
C:\Windows\system32>exiftool "-fileModifyDate<dateTimeOriginal" "-fileCreateDate<dateTimeOriginal" "G:\Public Videos\_Updated\8-8-2015\20150809234216.m2ts"
    1 image files updated

C:\Windows\system32>exiftool -s -a -G0:1 -"*Date*" "G:\Public Videos\_Updated\8-8-2015\20150809234216.m2ts"
[File:System]   FileModifyDate                  : 2015:08:10 03:42:15-05:00
[File:System]   FileAccessDate                  : 2015:08:10 03:42:15-05:00
[File:System]   FileCreateDate                  : 2015:08:10 03:42:15-05:00
[H264]          DateTimeOriginal                : 2015:08:09 23:42:15-09:00


I changed my computer to Hawaii time zone and did it again.  This time it gets adjusted to UTC-10 with -1 hr adjustment this time.  Alaska is UTC-9 so that's an option as well.
C:\Windows\system32>exiftool "-fileModifyDate<dateTimeOriginal" "-fileCreateDate<dateTimeOriginal" "G:\Public Videos\_Updated\8-8-2015\20150809234216.m2ts"
    1 image files updated

C:\Windows\system32>exiftool -s -a -G0:1 -"*Date*" "G:\Public Videos\_Updated\8-8-2015\20150809234216.m2ts"
[File:System]   FileModifyDate                  : 2015:08:09 22:42:15-10:00
[File:System]   FileAccessDate                  : 2015:08:09 22:42:15-10:00
[File:System]   FileCreateDate                  : 2015:08:09 22:42:15-10:00
[H264]          DateTimeOriginal                : 2015:08:09 23:42:15-09:00


If you think it will work after all of this, I'm up to installing perl, but it looks like there are a fair number of choices for Windows, so recommendations would be appreciated.  I confess I've never looked at perl, but I used to be decent at vbscript almost a decade ago if that helps. 

Thanks again. 
Title: Re: m2ts DateTimeOriginal editing
Post by: ganymede55 on January 02, 2016, 12:24:21 AM
The attachment would not load so I sent you an email asking if I could email you directly with it.
Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on January 02, 2016, 04:00:06 AM
Yes, please mail it to me directly.

Looking at what you need, I guess I have to enhance my script a little for you so the timezone info gets entered correctly too (for my own cameras the timezone info is not part of the DateTimeOriginal, but is placed in another tag). This isn't straightforward I'm afraid as you and the image are not in the same timezone and can use different daylight savings too... Anyway, I'll see what I can do, but first I have to get it to uniquely identify the DateTimeOriginal. That is the most important.

As for what perl to use, there are two distributions that are suggested on the perl (https://www.perl.org/get.html) website. Both are good and I have personally used ActiveState's version on Windows and remember how easy it was to install and use.
Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on January 02, 2016, 10:27:50 AM
Hi Chris,

I was impatient and downloaded a sample .mts file from the internet  so I could have a look at the file structure already ;)

The bad news is that apart from dateTimeOriginal being stored in binary (I have already worked around that), about each half second of recording (?) there is a time recording, which is sequential... This means we can't just change it as it will likely break the video :( This probably also explains why Phil has such trouble supporting video (and then this is just one of the many formats)...

Sorry :(

(Perhaps the .m2ts is different in this respect, so please still send me one so I can investigate)

Title: Re: m2ts DateTimeOriginal editing
Post by: Phil Harvey on January 02, 2016, 11:06:40 AM
The M2TS container format unfortunately has no metadata support, so the date/time information is extracted from the H264 video stream of these files.  As Hayo has said, editing this information is tricky, and not supported by ExifTool.

- Phil
Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on January 02, 2016, 11:12:08 AM
Hi Chris,

I got the .m2ts sample file and it has the same problem as the .mts I inspected earlier: there's a timestamp recorded twice every second :(

Quote from: Phil Harvey on January 02, 2016, 11:06:40 AM
The M2TS container format unfortunately has no metadata support, so the date/time information is extracted from the H264 video stream of these files.  As Hayo has said, editing this information is tricky, and not supported by ExifTool.

This actually got me thinking, if .m2ts is just a container perhaps you can use video editing software to wrap it in a different/another container that does support adding metadata?

Cheers,
Hayo
Title: Re: m2ts DateTimeOriginal editing
Post by: Phil Harvey on January 02, 2016, 11:52:32 AM
Quote from: Hayo Baan on January 02, 2016, 11:12:08 AM
This actually got me thinking, if .m2ts is just a container perhaps you can use video editing software to wrap it in a different/another container that does support adding metadata?

Good idea.  The M2TS container is terrible.  I highly recommend converting to MP4 if you can find conversion software that will copy the video stream intact without recoding.

- Phil
Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on January 03, 2016, 12:52:46 PM
Ok, I couldn't resist and spend some time at my matchDateTime script to be able to solve Chris' problem :D

I now have a version that will alter all timestamps in the sequence so should be safe to use. It also doesn't overwrite the original file (unless asked) and, for mts/m2ts files has the ability to alter the timezone and daylightsavings flag of the recording as well! (note though that exiftool currently doesn't show the daylightsavings flag, even though it is present).

Documentation:
NAME
       matchDateTime -- matches date/time info in movie files.

VERSION
       version 0.002

DESCRIPTION
       "matchDateTime" updates the date/time info in (movie) files.

       For "normal" movie files the maker note DateTimeOriginal dates (and any
       other matching dates) are updated with the date as set in the QuickTime
       CreateDate. It does this by simply replacing any string that exactly
       matches the DateTimeOriginal in the MakerNotes with the QuickTime
       CreateDate string. As extra precaution against false matches, the match
       is prefixed with the binary length marker and postfixed with the zero
       byte marker.

       MTS and M2TS files are handled specially, in that here we take the file
       modify date as the new target date and update all occurrences of the
       DateTimeOriginal with this. All sequential timestamps are updated as
       well. By default, the timezone information is left as was recorded by
       the camera, but you can change this by specifying a different timzezone
       (and optional daylight savings flag).

SYNOPSIS
         matchDateTime [-overwrite] [-tz TZ [-dst]] <Files>

OPTIONS
       -overwrite
           Overwrites the original (video) file instead of creating a new file
           with "_matchDateTime" added to the name.

       -tz TZ
           Use TZ as the new time zone. Specify the time zone in hours.

       -dst
           Indicates the daylight savings flag should be set when writing the
           new timezone information (only used when the "-tz" option is also
           specified).

AUTHOR
       Hayo Baan <info@hayobaan.com>

COPYRIGHT AND LICENSE
       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.


The perl script is attached to this post, please let me know if it works for you!

Please see later post for most current script!
Title: Re: m2ts DateTimeOriginal editing
Post by: Phil Harvey on January 04, 2016, 09:10:56 AM
Very cool.  I tried the script and it seems to work very well!

- Phil
Title: Re: m2ts DateTimeOriginal editing
Post by: ganymede55 on January 06, 2016, 12:35:37 AM
Thanks for the effort guys!  I got tied up with the back to work backlog the last 2 days, but I will try to install perl and run the script tomorrow. 
Title: Re: m2ts DateTimeOriginal editing
Post by: ganymede55 on January 10, 2016, 12:15:43 AM
Hayo,
Thanks again for the effort.  Unfortunately, it still doesn't appear to be working for me.  When I run the script, it seems to loop an varying number of times (another file had 26) and then not update anything (another file had a fileModifyDate several months newer than DateTimeOriginal and nothing changed, so it's not timezone offset). 

C:\Perl64\bin>exiftool -s -a -G0:1 -"*Date*" 20150809234216.m2ts
[File:System]   FileModifyDate                  : 2015:08:10 03:42:15-05:00
[File:System]   FileAccessDate                  : 2016:01:09 22:48:46-06:00
[File:System]   FileCreateDate                  : 2016:01:09 22:48:46-06:00
[H264]          DateTimeOriginal                : 2015:08:09 23:42:15-09:00

C:\Perl64\bin>perl matchDateTime 20150809234216.m2ts
Updated 2015:08:09 23:42:15 -09:00 DST => 2015:08:10 03:42:15 -09:00 DST in 20150809234216.m2ts (2 times)

Updated 2015:08:09 23:42:16 -09:00 DST => 2015:08:10 03:42:16 -09:00 DST in 20150809234216.m2ts (2 times)

Updated 2015:08:09 23:42:17 -09:00 DST => 2015:08:10 03:42:17 -09:00 DST in 20150809234216.m2ts (2 times)

Updated 2015:08:09 23:42:18 -09:00 DST => 2015:08:10 03:42:18 -09:00 DST in 20150809234216.m2ts (2 times)

Updated 2015:08:09 23:42:19 -09:00 DST => 2015:08:10 03:42:19 -09:00 DST in 20150809234216.m2ts (2 times)

Updated 2015:08:09 23:42:20 -09:00 DST => 2015:08:10 03:42:20 -09:00 DST in 20150809234216.m2ts (2 times)

OK: Changed date 12 times in 20150809234216.m2ts

C:\Perl64\bin>exiftool -s -a -G0:1 -"*Date*" 20150809234216.m2ts
[File:System]   FileModifyDate                  : 2015:08:10 03:42:15-05:00
[File:System]   FileAccessDate                  : 2016:01:09 22:48:46-06:00
[File:System]   FileCreateDate                  : 2016:01:09 22:48:46-06:00
[H264]          DateTimeOriginal                : 2015:08:09 23:42:15-09:00


It's possible that I'm not running something correctly.  I simply copied the files to the Perl64 .exe directory and ran the command as shown from the command prompt.  If not, is there anything else that you can think of?
Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on January 10, 2016, 03:40:11 AM
It leaves the original file intact, unless you specify -overwrite. Look in the directory you will see files with matchdatetime in their name :)
Title: Re: m2ts DateTimeOriginal editing
Post by: ganymede55 on January 11, 2016, 03:57:17 PM
Doh! :-[  That's what I get for working after midnight.  I spent a little more time on this and it's working really well!  I do have a few questions though.
Title: Re: m2ts DateTimeOriginal editing
Post by: Phil Harvey on January 11, 2016, 04:05:41 PM
It is easy for me to add a " DST" to the time if the DST flag is set.  I'll do this in the next release (ExifTool 10.10) so you'll have an indication if the time is DST when reading H264:DateTimeOriginal.

- Phil
Title: Re: m2ts DateTimeOriginal editing
Post by: ganymede55 on January 11, 2016, 05:11:58 PM
Thanks Phil!
Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on January 12, 2016, 02:43:00 AM
Hi Chris,

I made some adjustments to the script :)

When you now provide a directory, all files in that directory are processed and a recurse option (-r) can now be specified as well, Furthermore, the script now restores the original file modification time (so repeated calls will not have the unwanted effect of changing the time again and again).

Note: directory recursion is indiscriminate and will process all files in the specified directories!

The behaviour you see with the datetime is expected: when you update the file modification datetime with the datetimeoriginal, its timezone is taken into account, but when you use the script to set the datetimeoriginal to that of the file, the timezone is explicitly ignored. So yes, you should only once set the file modification time to what you want the datatime original to be, than match it with the script and be done. The problem here is that file modification is local time and datetime original isn't...
As the script now restores the file modification time this might be less of a problem.

If you set the timezone with -tz, the daylight savings setting will be off unless you specify -dst
(but this was hard to check as exiftool currently does not tell you what it was set to ;))

The new script is attached.
Title: Re: m2ts DateTimeOriginal editing
Post by: ganymede55 on January 13, 2016, 08:52:29 PM
Hayo, Thanks again.  This is great!  I created a little batch file to copy the files to a folder and then modify the files (the modification part output is shown below). 
C:\Windows\system32>exiftool -r -s -a -G0:1 -"*Date*" "G:\Public Videos\_Updated\8-8-2015" -ext mts -ext m2ts
======== G:/Public Videos/_Updated/8-8-2015/20150808213521.m2ts
[File:System]   FileModifyDate                  : 2015:11:17 22:16:08-06:00
[File:System]   FileAccessDate                  : 2015:08:09 10:13:21-05:00
[File:System]   FileCreateDate                  : 2015:08:09 10:13:21-05:00
[H264]          DateTimeOriginal                : 2015:08:08 21:35:21-05:00
======== G:/Public Videos/_Updated/8-8-2015/20150808213804.m2ts
[File:System]   FileModifyDate                  : 2015:11:17 22:16:12-06:00
[File:System]   FileAccessDate                  : 2015:08:09 10:16:04-05:00
[File:System]   FileCreateDate                  : 2015:08:09 10:16:04-05:00
[H264]          DateTimeOriginal                : 2015:08:08 21:38:04-05:00
======== G:/Public Videos/_Updated/8-8-2015/20150808215232.m2ts
[File:System]   FileModifyDate                  : 2015:11:17 22:16:16-06:00
[File:System]   FileAccessDate                  : 2015:08:09 10:30:32-05:00
[File:System]   FileCreateDate                  : 2015:08:09 10:30:32-05:00
[H264]          DateTimeOriginal                : 2015:08:08 21:52:32-05:00
======== G:/Public Videos/_Updated/8-8-2015/20150809224855.m2ts
[File:System]   FileModifyDate                  : 2015:11:15 15:47:43-06:00
[File:System]   FileAccessDate                  : 2015:08:10 15:26:55-05:00
[File:System]   FileCreateDate                  : 2015:08:10 15:26:55-05:00
[H264]          DateTimeOriginal                : 2015:08:09 22:48:55-09:00
======== G:/Public Videos/_Updated/8-8-2015/20150809225048.m2ts
[File:System]   FileModifyDate                  : 2015:11:15 15:47:44-06:00
[File:System]   FileAccessDate                  : 2015:08:10 15:28:48-05:00
[File:System]   FileCreateDate                  : 2015:08:10 15:28:48-05:00
[H264]          DateTimeOriginal                : 2015:08:09 22:50:48-09:00
======== G:/Public Videos/_Updated/8-8-2015/20150809234216.m2ts
[File:System]   FileModifyDate                  : 2015:11:15 15:48:10-06:00
[File:System]   FileAccessDate                  : 2015:08:10 16:20:15-05:00
[File:System]   FileCreateDate                  : 2015:08:10 16:20:15-05:00
[H264]          DateTimeOriginal                : 2015:08:09 23:42:15-09:00
    1 directories scanned
    6 image files read

C:\Windows\system32>exiftool -r "-fileModifyDate<dateTimeOriginal" "-fileCreateDate<dateTimeOriginal" "G:\Public Videos\_Updated\8-8-2015" -ext mts -e
xt m2ts
    1 directories scanned
    6 image files updated

C:\Windows\system32>exiftool -r -s -fileCreateDate+="7:38:00" -fileModifyDate+="7:38:00" "G:\Public Videos\_Updated\8-8-2015" -ext mts -ext m2ts
    1 directories scanned
    6 image files updated

C:\Windows\system32>perl matchDateTime -r -overwrite -tz -10 "G:\Public Videos\_Updated\8-8-2015"
Updated 2015:08:08 21:35:21 -05:00 DST => 2015:08:09 05:13:21 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:22 -05:00 DST => 2015:08:09 05:13:22 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:23 -05:00 DST => 2015:08:09 05:13:23 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:24 -05:00 DST => 2015:08:09 05:13:24 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:25 -05:00 DST => 2015:08:09 05:13:25 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:26 -05:00 DST => 2015:08:09 05:13:26 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:27 -05:00 DST => 2015:08:09 05:13:27 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:28 -05:00 DST => 2015:08:09 05:13:28 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:29 -05:00 DST => 2015:08:09 05:13:29 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:30 -05:00 DST => 2015:08:09 05:13:30 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:31 -05:00 DST => 2015:08:09 05:13:31 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:32 -05:00 DST => 2015:08:09 05:13:32 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:33 -05:00 DST => 2015:08:09 05:13:33 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
OK: Changed date 26 times in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts
Updated 2015:08:08 21:38:04 -05:00 DST => 2015:08:09 05:16:04 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:05 -05:00 DST => 2015:08:09 05:16:05 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:06 -05:00 DST => 2015:08:09 05:16:06 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:07 -05:00 DST => 2015:08:09 05:16:07 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:08 -05:00 DST => 2015:08:09 05:16:08 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:09 -05:00 DST => 2015:08:09 05:16:09 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:10 -05:00 DST => 2015:08:09 05:16:10 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:11 -05:00 DST => 2015:08:09 05:16:11 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:12 -05:00 DST => 2015:08:09 05:16:12 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:13 -05:00 DST => 2015:08:09 05:16:13 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:14 -05:00 DST => 2015:08:09 05:16:14 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:15 -05:00 DST => 2015:08:09 05:16:15 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:16 -05:00 DST => 2015:08:09 05:16:16 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:17 -05:00 DST => 2015:08:09 05:16:17 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:18 -05:00 DST => 2015:08:09 05:16:18 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:19 -05:00 DST => 2015:08:09 05:16:19 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:20 -05:00 DST => 2015:08:09 05:16:20 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:21 -05:00 DST => 2015:08:09 05:16:21 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
OK: Changed date 36 times in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts
Updated 2015:08:08 21:52:32 -05:00 DST => 2015:08:09 05:30:32 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
Updated 2015:08:08 21:52:33 -05:00 DST => 2015:08:09 05:30:33 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
Updated 2015:08:08 21:52:34 -05:00 DST => 2015:08:09 05:30:34 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
Updated 2015:08:08 21:52:35 -05:00 DST => 2015:08:09 05:30:35 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
Updated 2015:08:08 21:52:36 -05:00 DST => 2015:08:09 05:30:36 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
Updated 2015:08:08 21:52:37 -05:00 DST => 2015:08:09 05:30:37 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
OK: Changed date 12 times in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts
Updated 2015:08:09 22:48:55 -09:00 DST => 2015:08:10 10:26:55 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:48:56 -09:00 DST => 2015:08:10 10:26:56 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:48:57 -09:00 DST => 2015:08:10 10:26:57 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:48:58 -09:00 DST => 2015:08:10 10:26:58 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:48:59 -09:00 DST => 2015:08:10 10:26:59 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:00 -09:00 DST => 2015:08:10 10:27:00 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:01 -09:00 DST => 2015:08:10 10:27:01 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:02 -09:00 DST => 2015:08:10 10:27:02 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:03 -09:00 DST => 2015:08:10 10:27:03 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:04 -09:00 DST => 2015:08:10 10:27:04 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:05 -09:00 DST => 2015:08:10 10:27:05 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:06 -09:00 DST => 2015:08:10 10:27:06 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:07 -09:00 DST => 2015:08:10 10:27:07 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:08 -09:00 DST => 2015:08:10 10:27:08 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:09 -09:00 DST => 2015:08:10 10:27:09 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:10 -09:00 DST => 2015:08:10 10:27:10 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:11 -09:00 DST => 2015:08:10 10:27:11 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:12 -09:00 DST => 2015:08:10 10:27:12 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:13 -09:00 DST => 2015:08:10 10:27:13 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:14 -09:00 DST => 2015:08:10 10:27:14 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:15 -09:00 DST => 2015:08:10 10:27:15 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:16 -09:00 DST => 2015:08:10 10:27:16 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:17 -09:00 DST => 2015:08:10 10:27:17 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:18 -09:00 DST => 2015:08:10 10:27:18 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:19 -09:00 DST => 2015:08:10 10:27:19 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:20 -09:00 DST => 2015:08:10 10:27:20 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (1 times)
OK: Changed date 51 times in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts
Updated 2015:08:09 22:50:48 -09:00 DST => 2015:08:10 10:28:48 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:49 -09:00 DST => 2015:08:10 10:28:49 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:50 -09:00 DST => 2015:08:10 10:28:50 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:51 -09:00 DST => 2015:08:10 10:28:51 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:52 -09:00 DST => 2015:08:10 10:28:52 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:53 -09:00 DST => 2015:08:10 10:28:53 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:54 -09:00 DST => 2015:08:10 10:28:54 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:55 -09:00 DST => 2015:08:10 10:28:55 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:56 -09:00 DST => 2015:08:10 10:28:56 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:57 -09:00 DST => 2015:08:10 10:28:57 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:58 -09:00 DST => 2015:08:10 10:28:58 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:59 -09:00 DST => 2015:08:10 10:28:59 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:51:00 -09:00 DST => 2015:08:10 10:29:00 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (1 times)
OK: Changed date 25 times in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts
Updated 2015:08:09 23:42:15 -09:00 DST => 2015:08:10 11:20:15 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
Updated 2015:08:09 23:42:16 -09:00 DST => 2015:08:10 11:20:16 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
Updated 2015:08:09 23:42:17 -09:00 DST => 2015:08:10 11:20:17 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
Updated 2015:08:09 23:42:18 -09:00 DST => 2015:08:10 11:20:18 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
Updated 2015:08:09 23:42:19 -09:00 DST => 2015:08:10 11:20:19 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
Updated 2015:08:09 23:42:20 -09:00 DST => 2015:08:10 11:20:20 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
OK: Changed date 12 times in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00984.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00985.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00986.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00987.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00988.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00989.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00990.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00991.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00992.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC01811.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC01812.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/IMG_4690.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/IMG_4691.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/IMG_4691.JPG_original
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/Thumbs.db

C:\Windows\system32>exiftool -r -s -a -G0:1 -"*Date*" "G:\Public Videos\_Updated\8-8-2015" -ext mts -ext m2ts
======== G:/Public Videos/_Updated/8-8-2015/20150808213521.m2ts
[File:System]   FileModifyDate                  : 2015:08:09 05:13:34-05:00
[File:System]   FileAccessDate                  : 2015:08:09 05:13:34-05:00
[File:System]   FileCreateDate                  : 2015:08:09 05:13:21-05:00
[H264]          DateTimeOriginal                : 2015:08:09 05:13:21-10:00
======== G:/Public Videos/_Updated/8-8-2015/20150808213804.m2ts
[File:System]   FileModifyDate                  : 2015:08:09 05:16:22-05:00
[File:System]   FileAccessDate                  : 2015:08:09 05:16:22-05:00
[File:System]   FileCreateDate                  : 2015:08:09 05:16:04-05:00
[H264]          DateTimeOriginal                : 2015:08:09 05:16:04-10:00
======== G:/Public Videos/_Updated/8-8-2015/20150808215232.m2ts
[File:System]   FileModifyDate                  : 2015:08:09 05:30:38-05:00
[File:System]   FileAccessDate                  : 2015:08:09 05:30:38-05:00
[File:System]   FileCreateDate                  : 2015:08:09 05:30:32-05:00
[H264]          DateTimeOriginal                : 2015:08:09 05:30:32-10:00
======== G:/Public Videos/_Updated/8-8-2015/20150809224855.m2ts
[File:System]   FileModifyDate                  : 2015:08:10 10:27:21-05:00
[File:System]   FileAccessDate                  : 2015:08:10 10:27:21-05:00
[File:System]   FileCreateDate                  : 2015:08:10 10:26:55-05:00
[H264]          DateTimeOriginal                : 2015:08:10 10:26:55-10:00
======== G:/Public Videos/_Updated/8-8-2015/20150809225048.m2ts
[File:System]   FileModifyDate                  : 2015:08:10 10:29:01-05:00
[File:System]   FileAccessDate                  : 2015:08:10 10:29:01-05:00
[File:System]   FileCreateDate                  : 2015:08:10 10:28:48-05:00
[H264]          DateTimeOriginal                : 2015:08:10 10:28:48-10:00
======== G:/Public Videos/_Updated/8-8-2015/20150809234216.m2ts
[File:System]   FileModifyDate                  : 2015:08:10 11:20:21-05:00
[File:System]   FileAccessDate                  : 2015:08:10 11:20:21-05:00
[File:System]   FileCreateDate                  : 2015:08:10 11:20:15-05:00
[H264]          DateTimeOriginal                : 2015:08:10 11:20:15-10:00
    1 directories scanned
    6 image files read

I do have a few questions:
Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on January 15, 2016, 03:47:01 PM
Quote

  • It's skipping the .JPG files because they don't have a QuickTime Create Date.  I assume it would modify any file that does have that date.  Do you know what file types do have that so that I know if I need to extract those files from my folders?
  • You said the script now restores the original file modification time.  In the last file in the output below, it restores it to 11:20 -5 while the DateTimeOriginal is 11:20 -10.  I was running a exiftool -r "-fileModifyDate<dateTimeOriginal" command to clean this up, but it set the modify time to 16:20 -5, which is how trying to prevent looping.  Since 16:20-5 = 11:20-10, which is technically more correct?
  • I ran your script again after the output show above and it gets stuck in an infinite loop on the first .m2ts file.  It did not do that with the older script.
1. I don't have a full answer for your first question, but it is likely that it would be mostly only QuickTime video files that have this. My script currently doesn't support selecting a filename extension, perhaps something I could add at a later stage.
2. I restore the modification time (using exiftool) as I find it. So my guess is it is not updated correctly when you run your modification exiftool commands. You didn't provide datetime output after you ran the updates so it is hard to tell.
3. What do you mean with infinite loop? Does the script stall, or otherwise keep changing the same files over and over? Can you post the command line and output when this happens?
Title: Re: m2ts DateTimeOriginal editing
Post by: ganymede55 on January 15, 2016, 11:27:23 PM
Thanks Hayo.
QuoteYou didn't provide datetime output after you ran the updates so it is hard to tell.
I thought I provided the output after running the files (the command lines are included in the output after the system32 prompt), but maybe I'm missing what exactly you're asking for.  I went ahead and included the output again, but also included the loop where it keeps changing the same file over and over.

Show directory contents of all m2ts files before starting
C:\Windows\system32>exiftool -r -s -a -G0:1 -"*Date*" "G:\Public Videos\_Updated\8-8-2015" -ext mts -ext m2ts
======== G:/Public Videos/_Updated/8-8-2015/20150808213521.m2ts
[File:System]   FileModifyDate                  : 2015:11:17 22:16:08-06:00
[File:System]   FileAccessDate                  : 2015:08:09 05:13:34-05:00
[File:System]   FileCreateDate                  : 2015:08:09 05:13:21-05:00
[H264]          DateTimeOriginal                : 2015:08:08 21:35:21-05:00
======== G:/Public Videos/_Updated/8-8-2015/20150808213804.m2ts
[File:System]   FileModifyDate                  : 2015:11:17 22:16:12-06:00
[File:System]   FileAccessDate                  : 2015:08:09 05:16:22-05:00
[File:System]   FileCreateDate                  : 2015:08:09 05:16:04-05:00
[H264]          DateTimeOriginal                : 2015:08:08 21:38:04-05:00
======== G:/Public Videos/_Updated/8-8-2015/20150808215232.m2ts
[File:System]   FileModifyDate                  : 2015:11:17 22:16:16-06:00
[File:System]   FileAccessDate                  : 2015:08:09 05:30:38-05:00
[File:System]   FileCreateDate                  : 2015:08:09 05:30:32-05:00
[H264]          DateTimeOriginal                : 2015:08:08 21:52:32-05:00
======== G:/Public Videos/_Updated/8-8-2015/20150809224855.m2ts
[File:System]   FileModifyDate                  : 2015:11:15 15:47:43-06:00
[File:System]   FileAccessDate                  : 2015:08:10 10:27:21-05:00
[File:System]   FileCreateDate                  : 2015:08:10 10:26:55-05:00
[H264]          DateTimeOriginal                : 2015:08:09 22:48:55-09:00
======== G:/Public Videos/_Updated/8-8-2015/20150809225048.m2ts
[File:System]   FileModifyDate                  : 2015:11:15 15:47:44-06:00
[File:System]   FileAccessDate                  : 2015:08:10 10:29:01-05:00
[File:System]   FileCreateDate                  : 2015:08:10 10:28:48-05:00
[H264]          DateTimeOriginal                : 2015:08:09 22:50:48-09:00
======== G:/Public Videos/_Updated/8-8-2015/20150809234216.m2ts
[File:System]   FileModifyDate                  : 2015:11:15 15:48:10-06:00
[File:System]   FileAccessDate                  : 2015:08:10 11:20:21-05:00
[File:System]   FileCreateDate                  : 2015:08:10 11:20:15-05:00
[H264]          DateTimeOriginal                : 2015:08:09 23:42:15-09:00
    1 directories scanned
    6 image files read


Set file create and modify dates back to match DateTimeOriginal since the modify date will be used by your script to update the DateTimeOriginal.
C:\Windows\system32>exiftool -r "-fileModifyDate<dateTimeOriginal" "-fileCreateDate<dateTimeOriginal" "G:\Public Videos\_Updated\8-8-2015" -ext mts -e
xt m2ts
    1 directories scanned
    6 image files updated


Update the DateTimeOriginal.  At first I was using +11:38, but +7:38 appears to adjust for the UTC-9 timezone vs. my UTC-5 time zone better.  For example, the 20150809234216.m2ts is getting adjusted from 2015:08:09 23:42:15-09:00 to  2015:08:10 11:20:15-10:00 correctly (see output section two down from here) using the combination of all my steps that use the exiftool commands and your script.
C:\Windows\system32>exiftool -r -s -fileCreateDate+="7:38:00" -fileModifyDate+="7:38:00" "G:\Public Videos\_Updated\8-8-2015" -ext mts -ext m2ts
    1 directories scanned
    6 image files updated


Run your script to recursively update DateTimeOriginal from FileModifyDate ... and set it to UTC-10 time zone.  I didn't change the DST flag, but previous testing didn't show any difference since exiftool can't show it for these files.  I'm not completely clear if I should specify it or not.  The location I was in doesn't use DST.  It does appear to update only the .m2ts files and skip the .JPGs (and even a Thumbs.db for good measure).  It does update the files several times, but it works. 

C:\Windows\system32>perl matchDateTime -r -overwrite -tz -10 "G:\Public Videos\_Updated\8-8-2015"
Updated 2015:08:08 21:35:21 -05:00 DST => 2015:08:09 05:13:21 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:22 -05:00 DST => 2015:08:09 05:13:22 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:23 -05:00 DST => 2015:08:09 05:13:23 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:24 -05:00 DST => 2015:08:09 05:13:24 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:25 -05:00 DST => 2015:08:09 05:13:25 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:26 -05:00 DST => 2015:08:09 05:13:26 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:27 -05:00 DST => 2015:08:09 05:13:27 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:28 -05:00 DST => 2015:08:09 05:13:28 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:29 -05:00 DST => 2015:08:09 05:13:29 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:30 -05:00 DST => 2015:08:09 05:13:30 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:31 -05:00 DST => 2015:08:09 05:13:31 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:32 -05:00 DST => 2015:08:09 05:13:32 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:08 21:35:33 -05:00 DST => 2015:08:09 05:13:33 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
OK: Changed date 26 times in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts
Updated 2015:08:08 21:38:04 -05:00 DST => 2015:08:09 05:16:04 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:05 -05:00 DST => 2015:08:09 05:16:05 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:06 -05:00 DST => 2015:08:09 05:16:06 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:07 -05:00 DST => 2015:08:09 05:16:07 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:08 -05:00 DST => 2015:08:09 05:16:08 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:09 -05:00 DST => 2015:08:09 05:16:09 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:10 -05:00 DST => 2015:08:09 05:16:10 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:11 -05:00 DST => 2015:08:09 05:16:11 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:12 -05:00 DST => 2015:08:09 05:16:12 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:13 -05:00 DST => 2015:08:09 05:16:13 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:14 -05:00 DST => 2015:08:09 05:16:14 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:15 -05:00 DST => 2015:08:09 05:16:15 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:16 -05:00 DST => 2015:08:09 05:16:16 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:17 -05:00 DST => 2015:08:09 05:16:17 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:18 -05:00 DST => 2015:08:09 05:16:18 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:19 -05:00 DST => 2015:08:09 05:16:19 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:20 -05:00 DST => 2015:08:09 05:16:20 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
Updated 2015:08:08 21:38:21 -05:00 DST => 2015:08:09 05:16:21 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts (2 times)
OK: Changed date 36 times in G:\Public Videos\_Updated\8-8-2015/20150808213804.m2ts
Updated 2015:08:08 21:52:32 -05:00 DST => 2015:08:09 05:30:32 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
Updated 2015:08:08 21:52:33 -05:00 DST => 2015:08:09 05:30:33 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
Updated 2015:08:08 21:52:34 -05:00 DST => 2015:08:09 05:30:34 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
Updated 2015:08:08 21:52:35 -05:00 DST => 2015:08:09 05:30:35 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
Updated 2015:08:08 21:52:36 -05:00 DST => 2015:08:09 05:30:36 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
Updated 2015:08:08 21:52:37 -05:00 DST => 2015:08:09 05:30:37 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts (2 times)
OK: Changed date 12 times in G:\Public Videos\_Updated\8-8-2015/20150808215232.m2ts
Updated 2015:08:09 22:48:55 -09:00 DST => 2015:08:10 10:26:55 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:48:56 -09:00 DST => 2015:08:10 10:26:56 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:48:57 -09:00 DST => 2015:08:10 10:26:57 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:48:58 -09:00 DST => 2015:08:10 10:26:58 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:48:59 -09:00 DST => 2015:08:10 10:26:59 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:00 -09:00 DST => 2015:08:10 10:27:00 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:01 -09:00 DST => 2015:08:10 10:27:01 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:02 -09:00 DST => 2015:08:10 10:27:02 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:03 -09:00 DST => 2015:08:10 10:27:03 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:04 -09:00 DST => 2015:08:10 10:27:04 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:05 -09:00 DST => 2015:08:10 10:27:05 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:06 -09:00 DST => 2015:08:10 10:27:06 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:07 -09:00 DST => 2015:08:10 10:27:07 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:08 -09:00 DST => 2015:08:10 10:27:08 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:09 -09:00 DST => 2015:08:10 10:27:09 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:10 -09:00 DST => 2015:08:10 10:27:10 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:11 -09:00 DST => 2015:08:10 10:27:11 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:12 -09:00 DST => 2015:08:10 10:27:12 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:13 -09:00 DST => 2015:08:10 10:27:13 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:14 -09:00 DST => 2015:08:10 10:27:14 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:15 -09:00 DST => 2015:08:10 10:27:15 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:16 -09:00 DST => 2015:08:10 10:27:16 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:17 -09:00 DST => 2015:08:10 10:27:17 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:18 -09:00 DST => 2015:08:10 10:27:18 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:19 -09:00 DST => 2015:08:10 10:27:19 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (2 times)
Updated 2015:08:09 22:49:20 -09:00 DST => 2015:08:10 10:27:20 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts (1 times)
OK: Changed date 51 times in G:\Public Videos\_Updated\8-8-2015/20150809224855.m2ts
Updated 2015:08:09 22:50:48 -09:00 DST => 2015:08:10 10:28:48 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:49 -09:00 DST => 2015:08:10 10:28:49 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:50 -09:00 DST => 2015:08:10 10:28:50 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:51 -09:00 DST => 2015:08:10 10:28:51 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:52 -09:00 DST => 2015:08:10 10:28:52 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:53 -09:00 DST => 2015:08:10 10:28:53 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:54 -09:00 DST => 2015:08:10 10:28:54 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:55 -09:00 DST => 2015:08:10 10:28:55 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:56 -09:00 DST => 2015:08:10 10:28:56 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:57 -09:00 DST => 2015:08:10 10:28:57 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:58 -09:00 DST => 2015:08:10 10:28:58 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:50:59 -09:00 DST => 2015:08:10 10:28:59 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (2 times)
Updated 2015:08:09 22:51:00 -09:00 DST => 2015:08:10 10:29:00 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts (1 times)
OK: Changed date 25 times in G:\Public Videos\_Updated\8-8-2015/20150809225048.m2ts
Updated 2015:08:09 23:42:15 -09:00 DST => 2015:08:10 11:20:15 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
Updated 2015:08:09 23:42:16 -09:00 DST => 2015:08:10 11:20:16 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
Updated 2015:08:09 23:42:17 -09:00 DST => 2015:08:10 11:20:17 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
Updated 2015:08:09 23:42:18 -09:00 DST => 2015:08:10 11:20:18 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
Updated 2015:08:09 23:42:19 -09:00 DST => 2015:08:10 11:20:19 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
Updated 2015:08:09 23:42:20 -09:00 DST => 2015:08:10 11:20:20 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts (2 times)
OK: Changed date 12 times in G:\Public Videos\_Updated\8-8-2015/20150809234216.m2ts
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00984.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00985.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00986.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00987.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00988.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00989.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00990.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00991.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC00992.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC01811.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/DSC01812.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/IMG_4690.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/IMG_4691.JPG
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/IMG_4691.JPG_original
Skipped: Unable to find QuickTime CreateDate in G:\Public Videos\_Updated\8-8-2015/Thumbs.db


Display directory contents, dates, and times again to see how this worked.  DateTimeOriginal fields appear correct.  File Modify and Create Dates are the same time, but set to UTC-5 (my time zone), which is effective a different time.  I'm fine with this, just a little confused as to why they're not 5 hours later if UTC-5.
C:\Windows\system32>exiftool -r -s -a -G0:1 -"*Date*" "G:\Public Videos\_Updated\8-8-2015" -ext mts -ext m2ts
======== G:/Public Videos/_Updated/8-8-2015/20150808213521.m2ts
[File:System]   FileModifyDate                  : 2015:08:09 05:13:34-05:00
[File:System]   FileAccessDate                  : 2015:08:09 05:13:34-05:00
[File:System]   FileCreateDate                  : 2015:08:09 05:13:21-05:00
[H264]          DateTimeOriginal                : 2015:08:09 05:13:21-10:00
======== G:/Public Videos/_Updated/8-8-2015/20150808213804.m2ts
[File:System]   FileModifyDate                  : 2015:08:09 05:16:22-05:00
[File:System]   FileAccessDate                  : 2015:08:09 05:16:22-05:00
[File:System]   FileCreateDate                  : 2015:08:09 05:16:04-05:00
[H264]          DateTimeOriginal                : 2015:08:09 05:16:04-10:00
======== G:/Public Videos/_Updated/8-8-2015/20150808215232.m2ts
[File:System]   FileModifyDate                  : 2015:08:09 05:30:38-05:00
[File:System]   FileAccessDate                  : 2015:08:09 05:30:38-05:00
[File:System]   FileCreateDate                  : 2015:08:09 05:30:32-05:00
[H264]          DateTimeOriginal                : 2015:08:09 05:30:32-10:00
======== G:/Public Videos/_Updated/8-8-2015/20150809224855.m2ts
[File:System]   FileModifyDate                  : 2015:08:10 10:27:21-05:00
[File:System]   FileAccessDate                  : 2015:08:10 10:27:21-05:00
[File:System]   FileCreateDate                  : 2015:08:10 10:26:55-05:00
[H264]          DateTimeOriginal                : 2015:08:10 10:26:55-10:00
======== G:/Public Videos/_Updated/8-8-2015/20150809225048.m2ts
[File:System]   FileModifyDate                  : 2015:08:10 10:29:01-05:00
[File:System]   FileAccessDate                  : 2015:08:10 10:29:01-05:00
[File:System]   FileCreateDate                  : 2015:08:10 10:28:48-05:00
[H264]          DateTimeOriginal                : 2015:08:10 10:28:48-10:00
======== G:/Public Videos/_Updated/8-8-2015/20150809234216.m2ts
[File:System]   FileModifyDate                  : 2015:08:10 11:20:21-05:00
[File:System]   FileAccessDate                  : 2015:08:10 11:20:21-05:00
[File:System]   FileCreateDate                  : 2015:08:10 11:20:15-05:00
[H264]          DateTimeOriginal                : 2015:08:10 11:20:15-10:00
    1 directories scanned
    6 image files read


Ran your script again just to see what would happen (might need to do this if I made a mistake the first time).  It gets stuck updating the same file over and over (I stopped execution manually).

C:\Windows\system32>perl matchDateTime -r -overwrite -tz -10 "G:\Public Videos\_Updated\8-8-2015"
Updated 2015:08:09 05:13:21 -10:00 => 2015:08:09 05:13:34 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:22 -10:00 => 2015:08:09 05:13:35 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:23 -10:00 => 2015:08:09 05:13:36 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:24 -10:00 => 2015:08:09 05:13:37 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:25 -10:00 => 2015:08:09 05:13:38 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:26 -10:00 => 2015:08:09 05:13:39 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:27 -10:00 => 2015:08:09 05:13:40 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:28 -10:00 => 2015:08:09 05:13:41 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:29 -10:00 => 2015:08:09 05:13:42 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:30 -10:00 => 2015:08:09 05:13:43 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:31 -10:00 => 2015:08:09 05:13:44 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:32 -10:00 => 2015:08:09 05:13:45 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:33 -10:00 => 2015:08:09 05:13:46 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:34 -10:00 => 2015:08:09 05:13:47 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:35 -10:00 => 2015:08:09 05:13:48 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:36 -10:00 => 2015:08:09 05:13:49 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Updated 2015:08:09 05:13:37 -10:00 => 2015:08:09 05:13:50 -10:00 in G:\Public Videos\_Updated\8-8-2015/20150808213521.m2ts (2 times)
Terminating on signal SIGBREAK(21)
Terminate batch job (Y/N)? y

Title: Re: m2ts DateTimeOriginal editing
Post by: Hayo Baan on January 16, 2016, 01:42:15 AM
Hi Chris,

What I meant is that I need to see the output of your first command exiftool -r -s -a -G0:1 -"*Date*" "G:\Public Videos\_Updated\8-8-2015" -ext mts -ext m2ts again after you did your two modifications with exiftool. The fileModifyDate you see then is what my script will use and I bet you that is not what you expect it to be :)

And the script is actually NOT in an infinite loop, it is just a large video so it has to change many timestamps (there are about two per second of video). As you can see, the time keeps increasing, so it is just churning through your file. If the video is really long, this can take a while to finish ;)

Hope this explains things,
Hayo