How can I change date taken movie mp4 via ExifTool?

Started by pital, February 16, 2015, 07:06:03 AM

Previous topic - Next topic

pital

Hi there,


I have some home films with filename likes yyyymmdd.mp4 or yyyymmdd_hhmmss.mp4 or  yyyymmdd_hhmmss_streetname.mp4
And at this films have wrong exif date teken (date create and etc).

I need change exif films (video file mp4) to filename date and time.


Help me, please...

I need example for single file :))

P.s. for example
"exiftool(-k).exe" -dateTimeOriginal="2012:01:01 12:11:10" c:\1\
doesn't work at mp4

best regards,
Petr

Phil Harvey

Hi Petr,

You could try this to set the CreateDate from the file names.

exiftool "CreateDate<${filename} 00:00:00" DIR

The above quoting is for Windows.  Use single quotes instead on Mac/Linux.  Here DIR is the name of a directory containing your MP4's (or the name of one or more MP4 files).  I have added an extra 00:00:00 for the files which are missing times.  This should write XMP:CreateDate to the files.  There are other date/time tags in MP4 files, and ExifTool will only change some of them.  Use this command to see them all:

exiftool -a -s -G1 -time:all FILE

- 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 ($).

pital

Hi Phil,

Thank you for response.

I execute at original file exiftool -a -s -G1 -time:all FILE and I'l see that date of creation mp4 file is right:
----------------------------
C:\Temp>"exiftool(-k).exe" -a -s -G1 -time:all c:\1\20140109_185251.mp4
[System]        FileModifyDate                  : 2015:01:20 09:20:04+03:00
[System]        FileAccessDate                  : 2015:02:17 08:22:11+03:00
[System]        FileCreateDate                  : 2015:02:17 08:22:11+03:00
[QuickTime]     CreateDate                      : 2014:01:09 14:54:39
[QuickTime]     ModifyDate                      : 2014:01:09 14:54:39
[Track1]        TrackCreateDate                 : 2014:01:09 14:54:39
[Track1]        TrackModifyDate                 : 2014:01:09 14:54:39
[Track1]        MediaCreateDate                 : 2014:01:09 14:54:39
[Track1]        MediaModifyDate                 : 2014:01:09 14:54:39
[Track2]        TrackCreateDate                 : 2014:01:09 14:54:39
[Track2]        TrackModifyDate                 : 2014:01:09 14:54:39
[Track2]        MediaCreateDate                 : 2014:01:09 14:54:39
[Track2]        MediaModifyDate                 : 2014:01:09 14:54:39
-- press any key --

----------------------------


But Synology Photostation, iPhoto and etc used "[System] FileCreateDate: 2015:02:17 08:22:11+03:00".

Then I tried execute exiftool "CreateDate<${filename} 00:00:00" DIR
----------------------------
C:\Temp>"exiftool(-k).exe" "-CreateDate<${filename}" c:\1\
    1 directories scanned
    1 image files updated
----------------------------

but the [System] FileCreateDate changed to now. :-\ :-[
----------------------------
C:\Temp>"exiftool(-k).exe" -a -s -G1 -time:all c:\1\20140109_185251.mp4
[System]        FileModifyDate                  : 2015:02:17 08:32:20+03:00
[System]        FileAccessDate                  : 2015:02:17 08:32:16+03:00
[System]        FileCreateDate                  : 2015:02:17 08:22:11+03:00
[QuickTime]     CreateDate                      : 2014:01:09 18:52:51
[QuickTime]     ModifyDate                      : 2014:01:09 14:54:39
[Track1]        TrackCreateDate                 : 2014:01:09 14:54:39
[Track1]        TrackModifyDate                 : 2014:01:09 14:54:39
[Track1]        MediaCreateDate                 : 2014:01:09 14:54:39
[Track1]        MediaModifyDate                 : 2014:01:09 14:54:39
[Track2]        TrackCreateDate                 : 2014:01:09 14:54:39
[Track2]        TrackModifyDate                 : 2014:01:09 14:54:39
[Track2]        MediaCreateDate                 : 2014:01:09 14:54:39
[Track2]        MediaModifyDate                 : 2014:01:09 14:54:39
[XMP-xmp]       CreateDate                      : 2014:01:09 18:52:51
-- press any key --

----------------------------


How can I change  the [System] FileCreateDate?


best regards,
Petr

Phil Harvey

Hi Petr,

System:FileModifyDate (and System:FileCreateDate in Windows) may be preserved by adding the -P option.

You may write these System tags using the same technique as any other tag.

- 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 ($).

pital

Thank you Phil.

I will try to do it

Best regards,
Petr

giopas

Hi all,

I stumbled across this post and I am facing to a very similar situation with my .mp4 on my QNAP.

Let's take an example:

Quote# exiftool -a -s -G1 -time:all VID_20151012_193041.mp4
[System]        FileModifyDate                  : 2015:10:14 12:10:00+02:00
[System]        FileAccessDate                  : 2015:10:14 16:11:22+02:00
[System]        FileInodeChangeDate        : 2015:10:14 18:19:13+02:00
[QuickTime]     CreateDate                      : 2015:10:12 17:32:22
[QuickTime]     ModifyDate                      : 2015:10:12 17:32:22
[Track1]        TrackCreateDate                 : 2015:10:12 17:32:22
[Track1]        TrackModifyDate                 : 2015:10:12 17:32:22
[Track1]        MediaCreateDate                 : 2015:10:12 17:32:22
[Track1]        MediaModifyDate                 : 2015:10:12 17:32:22
[Track2]        TrackCreateDate                 : 2015:10:12 17:32:22
[Track2]        TrackModifyDate                 : 2015:10:12 17:32:22
[Track2]        MediaCreateDate                 : 2015:10:12 17:32:22
[Track2]        MediaModifyDate                 : 2015:10:12 17:32:22

As you can see the name (reporting the exact time), does not match with the video creation date.

I suppose that in this case I should change "[QuickTime] CreateDate" tag.

QUESTION 1: How should I change that tag (on a *unix ExifTool environment)?

I would like to create a script to check if there is a mismatch between the file name and the creation date. I have already done something similar for recursively fixing 2002 creation date bug on .jpg created by my OnePlus One phone (see attached) and I would like to leverage on that script.

But I would really appreciate your help on how to tell ExifTool: "take time from filename and put it into "[QuickTime] CreateDate" tag".

I have checked and the filename type I have are only the following:

Quote2015-10-09 16.57.38.mp4
VID_20151012_190206.mp4

QUESTION 2: Someone would be able to help on this? I mean, just on the exiftool string to use.

Thanks a lot,

giopas

Phil Harvey

It isn't clear to me that there is a problem with the date/time tags in your file.  What is the Duration of the video?  If it is 1 minute and 41 seconds, then given a 2-hour time zone difference, the dates may agree.

But to answer your question, you could try this command to change all tags ending with "date":

exiftool "-*date<filename" -wm w FILE

Here the "-wm w" prevents ExifTool from creating new tags.

- 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 ($).

giopas

Hi Phil,

thank you for your answer.

The file is indeed 1:40 minutes long:

Quote# exiftool -a VID_20151012_193041.mp4
Media Duration                  : 0:01:40
Handler Type                    : Video Track
Handler Description             : VideoHandle
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 1920
Source Image Height             : 1080
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Pixel Aspect Ratio              : 65536:65536
Video Frame Rate                : 30.009
Track Header Version            : 0
Track Create Date               : 2015:10:12 17:32:22
Track Modify Date               : 2015:10:12 17:32:22
Track ID                        : 2
Track Duration                  : 0:01:39
Track Layer                     : 0
Track Volume                    : 100.00%
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2015:10:12 17:32:22
Media Modify Date               : 2015:10:12 17:32:22
Media Time Scale                : 48000
Media Duration                  : 0:01:39
Handler Type                    : Audio Track
Handler Description             : SoundHandle
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 48000
Movie Data Size                 : 253252109
Movie Data Offset               : 810040
Avg Bitrate                     : 20.3 Mbps
Image Size                      : 1920x1080
Megapixels                      : 2.1
Rotation                        : 0

In relation to the string you provided, can I use "filename" as such, or should I use RegEx to pass the right information to it?

Thanks,

giopas

Phil Harvey

Hi Giopas,

In this case you can use the FileName directly.  See FAQ 5 for details on accepted date/time formats.

- 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 ($).

giopas

Thank you Phil,

so, both situations here can be easily managed with your string?

Quote2015-10-09 16.57.38.mp4
VID_20151012_190206.mp4

That's wonderful!!

Thank you,

giopas

Phil Harvey

...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 ($).

giopas

Perfect, thank you!!!

Just one question, why the output still speaks about "images" instead of videos (or more generically, "files")? This may be confusing in a script.

Phil Harvey

Yes.  "Image" files in the documentation can mean any type of file processed by ExifTool.  See this diagram for a picture illustrating the various types of files.

- 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 ($).

giopas

I see, thank you for your answer Phil. I was asking because I wanted to use the standard output to receive a notification like "4 videos have been changed". But this is not a big deal.

hitnrun30

Ok i tried to do this, but i keep getting a "Error: Truncated 8588 atom" message, what am i doing wrong?

Phil Harvey

Sounds like there is a format problem in your video file. :(

- 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 ($).

StarGeek

It sounds like there's a problem with the file, not something you did.
* 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).

hitnrun30

Quote from: StarGeek on August 31, 2016, 03:52:17 PM
It sounds like there's a problem with the file, not something you did.

It came directly from my phone.  No issues with playback.

Phil Harvey

If you can email me a sample I'll take a look (philharvey66 at gmail.com)

- 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 ($).

hitnrun30

Quote from: Phil Harvey on September 01, 2016, 10:11:10 AM
If you can email me a sample I'll take a look (philharvey66 at gmail.com)

- Phil

Sent, thanks for the help, it will help with other files as well.

Phil Harvey

The end of this MP4 contains some "BackupRestore_data" that does not conform to the MP4 format.  If a video player ignores this, it will play the video fine, but ExifTool won't write this because it doesn't know how to rewrite the improperly formatted data.

- 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 ($).

hitnrun30

Quote from: Phil Harvey on September 01, 2016, 11:42:03 AM
The end of this MP4 contains some "BackupRestore_data" that does not conform to the MP4 format.  If a video player ignores this, it will play the video fine, but ExifTool won't write this because it doesn't know how to rewrite the improperly formatted data.

- Phil
So there is nothing that can be done.

StarGeek

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