Main Menu

Arithmetics in FMT

Started by Plywood, April 28, 2025, 02:08:21 AM

Previous topic - Next topic

Plywood

Hi,
I'm trying to export kml from MP4 video and I want the <name> tag to include an increasing number for each placemark extracted.
I have successfully defined a user parameter called Counter using:
exiftool -userparam Counter#=1
and used it in my custom FMT

#[BODY]        <name>$main:directory;$_=self-GetValue('Counter)}</name>
But I can't find a way to increment it between every extracted coordinate

All outputs in the generated kml are <name>1</name>

Phil Harvey

You can ause a trick like this in the format file:

#[BODY]        <name>${main:directory;$_=++$Image::ExifTool::myCounter}</name>

Here I have defined a "myCounter" variable in the Image::ExifTool namespace so it maintains its value between usages.

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

Plywood