m4v file namefile to date created

Started by cybre, September 03, 2015, 09:01:55 AM

Previous topic - Next topic

cybre

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

Phil Harvey

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

cybre

#2
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?


Phil Harvey

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

cybre

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 ?

StarGeek

I think Phil's command is missing a closing brace } just before the last quote.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

cybre

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?

Phil Harvey

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


Hayo Baan

If you're on a Mac, or Linux, change the double quotes into single quotes.
Hayo Baan – Photography
Web: www.hayobaan.nl

cybre

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 ?

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