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
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
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?
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.
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 ?
I think Phil's command is missing a closing brace } just before the last quote.
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?
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
it says 10.0.0.0
If you're on a Mac, or Linux, change the double quotes into single quotes.
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 ?
Yes. FAQ 24 (https://exiftool.org/faq.html#Q24) perhaps?
- Phil