ExifTool Forum

General => Metadata => Topic started by: cybre on September 03, 2015, 09:01:55 AM

Title: m4v file namefile to date created
Post by: cybre on September 03, 2015, 09:01:55 AM
Hello Everybody,

I am new to this forum and need your help.

I have over 1000 video whose file name are like this (date and time), I am making test on 3 of them :

12-02-2013 12.48.24.m4v

Unfortunately the files have been re-encoded so the creation and modification date are now the ones of when I made the conversion.

I tried to use the following command, but it does not work. I tried with CreateDate and DateTimeOriginal with no success...

exiftool "-exif:datetimeoriginal<filename" c:\ski -d "%D-%m-%Y %H.%M.%S"

I get the following results

1 directories scanned
0 image files updated
3 image files unchanged

Can anyone help me please ?

Thank you for your help

Cyril
Title: Re: m4v file namefile to date created
Post by: Phil Harvey on September 03, 2015, 10:01:48 AM
One problem is that the -d option (unfortunately) doesn't work for parsing tag values when writing.  For this to work, the date must by in YYYY-MM-DD format.  Reformatting is possible, but you would need to use a user-defined tag or an advanced formatting expression.

Also, you should be writing either existing QuickTime tags, or XMP if necessary, because video files don't support EXIF.

- Phil
Title: Re: m4v file namefile to date created
Post by: cybre on September 04, 2015, 04:42:50 AM
Hello Phil,

I am afraid I dont understand what you're saying.

So you think it is not possible to do with such file type and name ?

12-02-2013 12.48.24.m4v

What would be the metadata tag I need to modify?

Title: Re: m4v file namefile to date created
Post by: Phil Harvey on September 04, 2015, 07:44:34 AM
I'm just saying that the -d option won't work for you, so you need to do the formatting yourself.  Try this:

exiftool "-createdate<${filename;my @a=/\d+/g;$_=sprintf('%.4d:%.2d:%.2d %.2d:%.2d:%.2d',@a[2,0,1,3,4,5])}" -ext m4v c:\ski

- Phil

Edit: Added missing closing brace (}) in advanced formatting expression.
Title: Re: m4v file namefile to date created
Post by: cybre on September 04, 2015, 11:24:37 AM
I get this error when running your script

Warning: [minor] Tag '_' not defined - c:/ski/12-02-2013 12.48.24.m4v
Warning: No writable tags set from c:/ski/12-02-2013 12.48.24.m4v
Warning: [minor] Tag '_' not defined - c:/ski/12-02-2013 12.51.42.m4v
Warning: No writable tags set from c:/ski/12-02-2013 12.51.42.m4v
Warning: [minor] Tag '_' not defined - c:/ski/14-02-2013 12.58.31.m4v
Warning: No writable tags set from c:/ski/14-02-2013 12.58.31.m4v
    1 directories scanned
    0 image files updated
    3 image files unchanged

Any idea ?
Title: Re: m4v file namefile to date created
Post by: StarGeek on September 04, 2015, 11:46:16 AM
I think Phil's command is missing a closing brace } just before the last quote.
Title: Re: m4v file namefile to date created
Post by: cybre on September 04, 2015, 12:10:40 PM
It is still not working, now it is changing the date to september 3rd 2015, it does not use the date/time in the filename.. :-(

Any other idea?
Title: Re: m4v file namefile to date created
Post by: Phil Harvey on September 04, 2015, 12:24:17 PM
Yes.  I forgot the closing brace.

But from the error it looks like you are using a really old version of ExifTool, from before this feature was added.  What version are you using?

- Phil
Title: Re: m4v file namefile to date created
Post by: cybre on September 04, 2015, 01:20:38 PM
it says 10.0.0.0
Title: Re: m4v file namefile to date created
Post by: Hayo Baan on September 04, 2015, 04:45:36 PM
If you're on a Mac, or Linux, change the double quotes into single quotes.
Title: Re: m4v file namefile to date created
Post by: cybre on September 05, 2015, 11:38:28 AM
I am on Windows.

The script runs fine but changes the date to todays date and not to what the file name says.....

Any idea ?
Title: Re: m4v file namefile to date created
Post by: Phil Harvey on September 08, 2015, 07:31:56 AM
Yes.  FAQ 24 (https://exiftool.org/faq.html#Q24) perhaps?

- Phil