Main Menu

ARG File and DateFMT

Started by Quant007, July 02, 2020, 05:44:54 AM

Previous topic - Next topic

Quant007

Hallo,
in an ARG-File I will doing something like

-QuickTime:CreateDate>QuickTime:CreationDate
${QuickTime:CreationDate;DateFmt("%Y:%m:%d %H:%M:%S%z"}

but in doesen't work.
In the commandline exiftool -p -overwrite_original -api largefilesupport=1 -QuickTime:CreateDate>QuickTime:CreationDate '-${QuickTime:CreationDate#;DateFmt("%Y:%m:%d %H:%M:%S%z"}' %video%
reports an Error:
Error: File not found - '-${QuickTime:CreationDate#;DateFmt(%Y:%m:%d %H:%M:%S%z}'
    1 image files read
    1 files could not be read
Whats going wrong?


StarGeek

Don't put it on a line by itself.  You replace the static tag name with the dollar sign version.

Also, according to the example, you want to use CreateDate.  And in your second example you caught the fact that I forget the hashtag in the previous post.  You also have to reverse the order as a dollar sign format can't be after the dash.

So normally, the command would be something like this in the arg file
-QuickTime:CreationDate<${QuickTime:CreateDate#;DateFmt("%Y:%m:%d %H:%M:%S%z"}

Except there's a problem with the inclusion of the %z.  By itself, QuickTime:CreateDate does not include the time zone.
* 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).

Quant007

Thanks for your Support, but it doesn't work:
I tried the commandline exiftool -QuickTime:CreateDate>${QuickTime:CreationDate#;DateFmt("%Y:%m:%d %H:%M:%S%z")} %video% an than came the message:
Invalid TAG name: "QuickTime:CreateDate;DateFmt(%Y:%m:%d %H:%M:%S%z)}"
Unmatched ) in regex; marked by <-- HERE in m/^%S%z) <-- HERE }( \(|$)/ at Image/ExifTool.pm line 4339.

Did i make sothing wrong?

StarGeek

Yes, the DateFmt helper function needs to be in the tag you copy from, not copy to.  And since you can't put a modified tag first in a tag copy, you need to swap the tags and change from a Greater than > to a Less than <.  Also, on the command line (not in an arg file), the arguments with a greater/less than symbol need to be enclosed in quotes. 

Looking at your first post in this thread, the error seems to indicate you're using Windows CMD?  Also the most recent post uses a %video% variable.  Is that inside a bat file?

On the command line (assuming Windows CMD), the last post should be
exiftool "-QuickTime:CreationDate<${QuickTime:CreateDate#;DateFmt('%Y:%m:%d %H:%M:%S%z')}" /path/to/files/
Because it's on the command line, double quotes need to encase the tag copy part and single quotes need to be around the date format string.  If you're on Linux/Mac, swap the single/double quotes.

If it's in a batch file as the %video% seems to indicate, the % signs need to be doubled (see FAQ #27).

One additional note.  The QuickTime:CreateDate tag is normally in UTC.  But when you include the %z in your date format string for this tag, it will be filled with the local time zone of your computer without altering the time stamp.  So that would end up being an incorrect time.  For example, if I have a video that was taken at 2019:12:06 18:15:00-08:00, then QuickTime:CreateDate will be set as 2019:12:07 02:15:00.  Using your format string would result in a date/time of 2019:12:07 02:15:00-08:00 being copied.

If you add the -api QuickTimeUTC option to your command, exiftool will properly adjust the time, in this example resulting in 2019:12:06 18:15:00-0800.

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

Quant007

Thank you very much, now it works :D 8)