Change exif info based on file name

Started by MadEin, November 27, 2023, 03:50:13 AM

Previous topic - Next topic

MadEin

Good morning,
I would like to modify the creation date, and the DateTimeOriginal date of my mp4 videos depending on the file name.
after a lot of copy/pasting, the dates are either missing or incorrect.
my videos are in VID-YearMonthDay-comment or VID_YearMonthDay-comment format.
I've searched the web, but I can't find it...
sorry for my english, i use google translate.
I am a beginner  :-\

StarGeek

Just to verify your filename format, an exact example would be
VID-20231127-Comments.mp4
or
VID_20231127-Comments.mp4
And there isn't a time as well, just the date.

There are a couple of things to work around here.  First is the absence of a time.  Nearly all date/time tags require both, a date and a time.  The most common way to work around this is to use a dummy time, most commonly midnight e.g. 00:00:00.

But the second issue impacts this and that is that most video date/time tags are supposed to be set to UTC.  And setting a time of 00:00:00 means that in Western hemisphere time zones the time stamp would be shifted to the day before.  So you have to decide if you want to set it to 00:00:00 UTC or 00:00:00 in your local time zone adjusted to UTC.  Or possibly even something else.

I'm going to assume the that you are setting it to 00:00:00 in your local time and that the date in the file name is 8 numbers in a row.  In this case, your command would be along these lines, assuming you're using Windows CMD
exiftool -api QuickTimeUTC "-Quicktime:CreateDate<${Filename;m/(\d{8})/;$_=$1} 00:00:00" "-DateTimeOriginal<${Filename;m/(\d{8})/;$_=$1} 00:00:00" /path/to/files/

There may be other time stamps you want to change.  Possibly the file system ones, which I'm guessing that you mean by "creation date", because there is the file system create date FileCreateDate, and the embedded Quicktime:CreationDate, but the former is what will be used if you look at the file properties through the desktop.  If so, you would just add this to the command
"-FileCreateDate<${Filename;m/(\d{8})/;$_=$1} 00:00:00"

If it turns out that you there are other time stamps that you need to adjust, then use this command to see all time stamps in the file.  You would then add another copy operation to that tag.
exiftool -time:all -G -a -s /path/to/files/

If you are on Mac/Linux, then you need to change the double quotes to single quotes.  I cannot help with the quoting if you insist on using Windows PowerShell, as PS can fail on basic exiftool commands due to its idiosyncrasies.
"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

MadEin

Perfect! you are too strong... that's exactly what I needed.
Thanks a lot!  :)  :)  :)  I've been breaking my teeth over it for a few days (French expression)