ExifTool Forum

ExifTool => Newbies => Topic started by: Plywood on April 28, 2025, 02:08:21 AM

Title: Arithmetics in FMT
Post by: Plywood on April 28, 2025, 02:08:21 AM
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>
Title: Re: Arithmetics in FMT
Post by: Phil Harvey on April 28, 2025, 11:53:35 AM
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
Title: Re: Arithmetics in FMT
Post by: Plywood on April 29, 2025, 01:11:47 AM
Thank you Phil!