Metadata mp4/mov/avi/wmv files

Started by wildcowboy, November 06, 2016, 12:10:11 PM

Previous topic - Next topic

wildcowboy

Hello, I have many video files (mp4/mov/avi/wmv) created by different cameras and phones and converted by different software over years and thinking of cleaning up the mess with dates in their file properties and metadata. I just opened a sample video file and ExifTool GUI and here is what I see:


System
FileModifyDate 2016:08:07 14:06:00-06:00
FileAccessDate 2016:08:07 14:05:59-06:00
FileCreateDate 2016:07:20 15:27:10-06:00

QuickTime
CreateDate 2036:02:06 06:28:16
ModifyDate 2036:02:06 06:28:16
ContentCreateDate 2015:12:25 14:16:52Z

Track1
TrackCreateDate 2036:02:06 06:28:16
TrackModifyDate 2036:02:06 06:28:16
MediaCreateDate 2036:02:06 06:28:16
MediaModifyDate 2036:02:06 06:28:16

Track2
TrackCreateDate 2036:02:06 06:28:16
TrackModifyDate 2036:02:06 06:28:16
MediaCreateDate 2036:02:06 06:28:16
MediaModifyDate 2036:02:06 06:28:16

Microsoft
EncodingTime 2015:12:25 14:16:52Z


I am wondering how do I spell each tag when run an exiftool command.
For example I have seen:
exiftool "-FileCreateDate<CreateDate" "-FileModifyDate<CreateDate"
but not sure what exact tag the "CreateDate" is referring to.

In that particular case QuickTime ContentCreateDate as well as Microsoft EncodingTime contain the real date so I am interested in copying these values to the rest tags.

Thank you in advance for any help.

wildcowboy

Here is the output of exiftool -s command"
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

D:\Users\wca0272.WEIDMULLER>exiftool -s "sample.mp4"
ExifToolVersion                 : 10.31
FileName                        : sample.mp4
Directory                       : D:/Family Pictures/
FileSize                        : 18 MB
FileModifyDate                  : 2016:08:07 14:06:00-06:00
FileAccessDate                  : 2016:08:07 14:05:59-06:00
FileCreateDate                  : 2016:07:20 15:27:10-06:00
FilePermissions                 : rw-rw-rw-
FileType                        : MP4
FileTypeExtension               : mp4
MIMEType                        : video/mp4
MajorBrand                      : MP4 v2 [ISO 14496-14]
MinorVersion                    : 0.2.0
CompatibleBrands                : isom, iso2, avc1, mp41
MovieHeaderVersion              : 0
CreateDate                      : 2036:02:06 06:28:16
ModifyDate                      : 2036:02:06 06:28:16
TimeScale                       : 1000
Duration                        : 0:00:48
PreferredRate                   : 1
PreferredVolume                 : 100.00%
PreviewTime                     : 0 s
PreviewDuration                 : 0 s
PosterTime                      : 0 s
SelectionTime                   : 0 s
SelectionDuration               : 0 s
CurrentTime                     : 0 s
NextTrackID                     : 3
TrackHeaderVersion              : 0
TrackCreateDate                 : 2036:02:06 06:28:16
TrackModifyDate                 : 2036:02:06 06:28:16
TrackID                         : 1
TrackDuration                   : 0:00:47
TrackLayer                      : 0
TrackVolume                     : 0.00%
ImageWidth                      : 1080
ImageHeight                     : 1920
GraphicsMode                    : srcCopy
OpColor                         : 0 0 0
CompressorID                    : avc1
SourceImageWidth                : 1080
SourceImageHeight               : 1920
XResolution                     : 72
YResolution                     : 72
BitDepth                        : 24
VideoFrameRate                  : 29.917
MatrixStructure                 : 1 0 0 0 1 0 0 0 1
MediaHeaderVersion              : 0
MediaCreateDate                 : 2036:02:06 06:28:16
MediaModifyDate                 : 2036:02:06 06:28:16
MediaTimeScale                  : 48000
MediaDuration                   : 0:00:48
MediaLanguageCode               : eng
HandlerDescription              : Stereo
Balance                         : 0
AudioFormat                     : mp4a
AudioChannels                   : 2
AudioBitsPerSample              : 16
AudioSampleRate                 : 48000
Track2Name                      : Stereo
HandlerType                     : Metadata
HandlerVendorID                 : Apple
Encoder                         : HandBrake 0.10.2 2015060900
Title                           : Sample video
EncodingTime                    : 2015:12:25 14:16:52Z
SharedUserRating                : 50
Category                        : Sample/sample tag
ContentCreateDate               : 2015:12:25 14:16:52Z
MovieDataSize                   : 18777414
MovieDataOffset                 : 46630
AvgBitrate                      : 3.12 Mbps
ImageSize                       : 1080x1920
Megapixels                      : 2.1
Rotation                        : 0


You cannot see categories here but again ContentCreateDate  and/or EncodingTime are what I am willing to copy and paste to the rest date tags

wildcowboy

Trying to run this command:
exiftool -config QuickTimeUTC.config -MediaCreateDate<ContentCreateDate "C:\Share\sample.mp4"
where QuickTimeUTC.config is a text file containing:
%Image::ExifTool::UserDefined::Options = (
    QuickTimeUTC => 1,      # assume Quicktime date/time tags are stored as UTC
);
1;  #end

and located in C:\Windows
but keep getting this error:

The system cannot find the file specified.

I am not sure what causing the error. I double checked the file name and path, double quotes, NTFS read/write security rights, etc. but nothing seems to help.

StarGeek

See the forth paragraph under the docs on tagsFromFile, which is what you're doing with the -MediaCreateDate<ContentCreateDate part of the command. 

tl;dr
You need to put quotes around the part of the command that has a < symbol in it to prevent shell redirection.  Use double quotes since you're on Windows.

Also, one thing to remember is that exiftool has limited support for video files.  My quick test shows that MediaCreateDate can be changed but other tags may not.
* 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).

wildcowboy

Quote from: StarGeek on November 06, 2016, 01:43:00 PM
See the forth paragraph under the docs on tagsFromFile, which is what you're doing with the -MediaCreateDate<ContentCreateDate part of the command. 

tl;dr
You need to put quotes around the part of the command that has a < symbol in it to prevent shell redirection.  Use double quotes since you're on Windows.

Also, one thing to remember is that exiftool has limited support for video files.  My quick test shows that MediaCreateDate can be changed but other tags may not.

Thanks for the advise. Here is the command I created:
exiftool -config "c:windows\QuickTimeUTC.config"
"-MediaCreateDate<ContentCreateDate"
"-MediaModifyDate<ContentCreateDate"
"-QuickTime:CreateDate<ContentCreateDate"
"-QuickTime:ModifyDate<ContentCreateDate"
"-TrackCreateDate<ContentCreateDate"
"-TrackModifyDate<ContentCreateDate"
"-FileCreateDate<ContentCreateDate"
"-FileAccessDate<ContentCreateDate"
"-FileModifyDate<ContentCreateDate"


I does work however there are couple small issues.
1. I keep getting warning:
Warning: Sorry, fileaccessdate is not writable - D:/Family Pictures/2015/2015-12-25 Christmas vacation on Bahamas/20151225_185834 (Encoded).mp4
    1 image files updated

ExifTool does update the FileAccessDate though.
2. I have to run the command twice to get the FileCreateDate changed.
3. FileCreateDate, FileModifyDate and FileAccessDate seem to be offset 7 hours. See the output of exiftool -s below. I did try running the command without the config but it did not help.


FileModifyDate                  : 2015:12:25 18:58:34-07:00
FileAccessDate                  : 2015:12:25 18:58:34-07:00
FileCreateDate                  : 2015:12:25 18:58:34-07:00

CreateDate                      : 2015:12:26 01:58:34
ModifyDate                      : 2015:12:26 01:58:34

TrackCreateDate                 : 2015:12:26 01:58:34
TrackModifyDate                 : 2015:12:26 01:58:34

MediaCreateDate                 : 2015:12:26 01:58:34
MediaModifyDate                 : 2015:12:26 01:58:34

EncodingTime                    : 2015:12:26 01:58:34Z

ContentCreateDate               : 2015:12:26 01:58:34Z

Any ideas?
Also, why do some dates have Z at the end?

StarGeek

Quote from: wildcowboy on November 07, 2016, 10:26:15 AM
I does work however there are couple small issues.
1. I keep getting warning:
Warning: Sorry, fileaccessdate is not writable - D:/Family Pictures/2015/2015-12-25 Christmas vacation on Bahamas/20151225_185834 (Encoded).mp4
    1 image files updated

ExifTool does update the FileAccessDate though.

FileAccessDate isn't writable, but is set to the same time as FileModifyDate when FileModifyDate is written.  It's a useless property anyway.  It doesn't do anything on Windows versions other than XP unless you edit the registry.

Quote2. I have to run the command twice to get the FileCreateDate changed.

Hmm...  That's really odd, I'm not sure why that would be.

Quote3. FileCreateDate, FileModifyDate and FileAccessDate seem to be offset 7 hours. See the output of exiftool -s below. I did try running the command without the config but it did not help.
...
Also, why do some dates have Z at the end?

These are related.  The Z at the end of a time stamp stands for Zero UTC offset.  So I'm guessing you're in a -7 timezone.  If you compare the file timestamps with the others, you'll see it's 7 hours different.  It's setting the time correct according to your system time.

Unrelated to the above, you should be able to skip the config file by adding -api quicktimeutc=1 to your command.

* 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).

Phil Harvey

Quote from: wildcowboy on November 07, 2016, 10:26:15 AM
2. I have to run the command twice to get the FileCreateDate changed.

I don't understand this either.  I'll have to run some tests to see if I can reproduce this when I get access to a Windows system.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

wildcowboy

Thank you Phil and StarGeek very much for your help.
Here is the command:
exiftool -api quicktimeutc=1 "-MediaCreateDate<ContentCreateDate" "-MediaModifyDate<ContentCreateDate" "-QuickTime:CreateDate<ContentCreateDate" "-QuickTime:ModifyDate<ContentCreateDate" "-TrackCreateDate<ContentCreateDate" "-TrackModifyDate<ContentCreateDate" "-FileCreateDate<ContentCreateDate" "-FileModifyDate<ContentCreateDate" -overwrite_original -ext mp4 DIR
Works as a charm!
The issue with FileCreateDate dissapeared after I removed "-FileAccessDate<ContentCreateDate"

Phil Harvey

Quote from: wildcowboy on November 07, 2016, 03:20:34 PM
The issue with FileCreateDate dissapeared after I removed "-FileAccessDate<ContentCreateDate"

This must be  unrelated.  FileAccessDate is not writable so this won't make any difference.

The problem must have been something else, but as long as it keeps working I won't worry about it any more.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

wildcowboy

#9
Quote from: StarGeek on November 07, 2016, 11:39:23 AM


Quote3. FileCreateDate, FileModifyDate and FileAccessDate seem to be offset 7 hours. See the output of exiftool -s below. I did try running the command without the config but it did not help.
...
Also, why do some dates have Z at the end?

These are related.  The Z at the end of a time stamp stands for Zero UTC offset.  So I'm guessing you're in a -7 timezone.  If you compare the file timestamps with the others, you'll see it's 7 hours different.  It's setting the time correct according to your system time.

Unrelated to the above, you should be able to skip the config file by adding -api quicktimeutc=1 to your command.

Hello StarGeek. I got lost a bit. Here is the dates per exiftool:

FileModifyDate                  : 2014:02:02 09:34:05-07:00
FileAccessDate                  : 2014:02:02 09:34:05-07:00
FileCreateDate                  : 2014:02:02 09:34:05-07:00

CreateDate                      : 2014:02:02 09:34:05
ModifyDate                      : 2014:02:02 09:34:05

TrackCreateDate                 : 2014:02:02 09:34:05
TrackModifyDate                 : 2014:02:02 09:34:05

MediaCreateDate                 : 2014:02:02 09:34:05
MediaModifyDate                 : 2014:02:02 09:34:05

EncodingTime                    : 2014:02:02 16:34:05Z
ContentCreateDate               : 2014:02:02 16:34:05Z


Are these all the same dates or some of them are incorrect?

Here is what commands I ran:
First, I copied date/time from ContentCreateDate to FileCreateDate with QuickTimeUTC set to 1
exiftool -api quicktimeutc=1 "-FileCreateDate<ContentCreateDate" -overwrite_original -ext mp4 DIR

Second, I copied date/time from FileCreateDate to a bunch of other tags without quicktimeutc=1
exiftool "-MediaCreateDate<FileCreateDate" "-MediaModifyDate<FileCreateDate" "-QuickTime
:CreateDate<FileCreateDate" "-QuickTime:ModifyDate<FileCreateDate" "-TrackCreateDate<FileCreateDate" "-TrackModifyDate<F
ileCreateDate" "-FileModifyDate<FileCreateDate" -overwrite_original -ext mp4 DIR

If I don't split them and run everything with quicktimeutc=1 all times except for the top three will be 16:34:05 (without Z)
The real time is 09:34:05 (I know that because I have another pictures in the folder)
Let me know

StarGeek

Quote from: wildcowboy on November 08, 2016, 01:58:52 PM
Are these all the same dates or some of them are incorrect?

tl;dr
Yes, it's all the same time

Longer Technical answer... maybe?

FileModifyDate, FileAccessDate, FileCreateDate, EncodingTime, and ContentCreateDate are all the same time.  The last two are UTC 0, aka Greenwich Mean Time (GMT).  The first three are 7 hours later, indicating Mountain Standard Time (MST).  Same time, different time zones.

Everything else doesn't have a time zone, so technically, I couldn't say.  I mean, it's almost certain that they are.  But maybe you filmed this on a trip to Hollywood, which would be Pacific Standard Time (PST).  But at that point I'm just being incredibly nit picky.

Overall, it sounds like you're two step option correctly sets the times.  Video metadata isn't something I play with so I'm not the expert in this area.
* 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).

wildcowboy

Trying to figure out how to combine these two commands in one:

exiftool -api quicktimeutc=1 "-FileCreateDate<ContentCreateDate" -overwrite_original -ext mp4 DIR
and
exiftool -api quicktimeutc=1 "-MediaCreateDate<FileCreateDate" "-MediaModifyDate<FileCreateDate" "-QuickTime:CreateDate<FileCreateDate" "-QuickTime:ModifyDate<FileCreateDate" "-TrackCreateDate<FileCreateDate" "-TrackModifyDate<FileCreateDate" "-FileModifyDate<FileCreateDate" -overwrite_original -ext mp4 DIR


I know I can use -execute for that but not sure where should I put -overwrite_original -ext mp4 DIR

Phil Harvey

I don't think you need to use -execute because you can do this in a single command.  If ContentCreateDate is always available, then this is the command:

exiftool -api quicktimeutc=1 "-MediaCreateDate<ContentCreateDate" "-MediaModifyDate<ContentCreateDate" "-QuickTime:CreateDate<ContentCreateDate" "-QuickTime:ModifyDate<ContentCreateDate" "-TrackCreateDate<ContentCreateDate" "-TrackModifyDate<ContentCreateDate" "-FileModifyDate<ContentCreateDate" "-FileCreateDate<ContentCreateDate" -overwrite_original -ext mp4 DIR

but if it isn't, then the command gets a bit long (you have to write all tags from FileModifyDate first, then ContentCreateDate), so in this case -execute will produce a shorter (but less efficient) command:

exiftool "-FileCreateDate<ContentCreateDate" -execute "-MediaCreateDate<FileCreateDate" "-MediaModifyDate<FileCreateDate" "-QuickTime:CreateDate<FileCreateDate" "-QuickTime:ModifyDate<FileCreateDate" "-TrackCreateDate<FileCreateDate" "-TrackModifyDate<FileCreateDate" "-FileModifyDate<FileCreateDate" -common_args -api quicktimeutc=1 -overwrite_original -ext mp4 DIR

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

wildcowboy

Hello. I just wanted to post the final results here for other users reference.
Here is the command I use now:
exiftool -api quicktimeutc=1 "-FileCreateDate<ContentCreateDate" -execute "-MediaCreateDate<FileCreateDate" "-MediaModifyDate<FileCreateDate" "-QuickTime:CreateDate<FileCreateDate" "-QuickTime:ModifyDate<FileCreateDate" "-TrackCreateDate<FileCreateDate" "-TrackModifyDate<FileCreateDate" "-FileModifyDate<FileCreateDate" -common_args -overwrite_original -ext mp4 DIR
Please note I moved "-api quicktimeutc=1" from common arguments to before "-execute".
In that case I get all date/time stamps like this:
FileModifyDate                  : 2014:02:02 09:34:05-07:00
FileAccessDate                  : 2014:02:02 09:34:05-07:00
FileCreateDate                  : 2014:02:02 09:34:05-07:00

CreateDate                      : 2014:02:02 09:34:05
ModifyDate                      : 2014:02:02 09:34:05

TrackCreateDate                 : 2014:02:02 09:34:05
TrackModifyDate                 : 2014:02:02 09:34:05

MediaCreateDate                 : 2014:02:02 09:34:05
MediaModifyDate                 : 2014:02:02 09:34:05

EncodingTime                    : 2014:02:02 16:34:05Z
ContentCreateDate               : 2014:02:02 16:34:05Z


if I keep "-api quicktimeutc=1" in common args they look like this:
FileModifyDate                  : 2014:02:02 09:34:05-07:00
FileAccessDate                  : 2014:02:02 09:34:05-07:00
FileCreateDate                  : 2014:02:02 09:34:05-07:00

CreateDate                      : 2014:02:02 16:34:05
ModifyDate                      : 2014:02:02 16:34:05

TrackCreateDate                 : 2014:02:02 16:34:05
TrackModifyDate                 : 2014:02:02 16:34:05

MediaCreateDate                 : 2014:02:02 16:34:05
MediaModifyDate                 : 2014:02:02 16:34:05

EncodingTime                    : 2014:02:02 16:34:05Z
ContentCreateDate               : 2014:02:02 16:34:05Z