ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: tkwasnitschka on March 31, 2023, 04:19:23 AM

Title: Combine Syntax question
Post by: tkwasnitschka on March 31, 2023, 04:19:23 AM
Dear all,
could someone please tell me how to combine those three commands into one:
exiftool.exe -progress "-AllDates<filename" -EXIF:OffsetTimeOriginal=+00:00 Z:\data\P502\335ROV05\ -r -overwrite_original
exiftool.exe -progress Z:\data\P502\335ROV05\ -r -geotag Z:\projects\P502\POS502_ROVNav\Protocols\2016-07-24_POS502_335ROV05\Lat_Long_Time_24072016_merged.csv "-Geotime<SubSecDateTimeOriginal#" -overwrite_original
exiftool.exe -progress -GPSaltituderef="Below Sea Level" Z:\data\P502\335ROV05\ -r -overwrite_original
I have tens of thousands of images per run und it is a slow process this way...

As a side question, how do I parse (in the above command structure) such a date format of the GPSDatetime column: 24.07.2016 13:47:30. Right now, I corrected the source file date, but I would like to learn how to correctly work with the -d command in such a case?
Title: Re: Combine Syntax question
Post by: Phil Harvey on March 31, 2023, 10:23:39 AM
If you make the altitudes negative in your CSV file, you can skip the 3rd command.

You can combine the first 2 commands with ExifTool 12.60 or later (not yet released) like this:

exiftool.exe -progress "-AllDates<filename" -EXIF:OffsetTimeOriginal=+00:00 Z:\data\P502\335ROV05\ -r -overwrite_original -geotag Z:\projects\P502\POS502_ROVNav\Protocols\2016-07-24_POS502_335ROV05\Lat_Long_Time_24072016_merged.csv "-Geotime<${filename;$_=$self->InverseDateTime($_)}Z"
But unfortunately this won't work with version 12.59 because of a bug I just discovered where writing Geotime doesn't work as expected when an advanced-formatting expression containing a ">" symbol is used.

ExifTool 12.60 will also be patched to support the date/time format you are using in your CSV file.

- Phil
Title: Re: Combine Syntax question
Post by: tkwasnitschka on March 31, 2023, 10:34:22 AM
Awesome, Phil, thanks!
The negative altitude is stupid but yes we work in the deep sea.
I understand everything but this part:
"-Geotime<${filename;$_=$self->InverseDateTime($_)}Z"I see the first part actually does what I wanted to achieve with alldates in the first place, everything after the semicaolon is blackmagic to me, though...
Cheers!
Tom
Title: Re: Combine Syntax question
Post by: Phil Harvey on March 31, 2023, 10:41:09 AM
Hi Tom,

Yes.  Black magic is correct because I am using a non-public ExifTool member function (InverseDateTime) to parse the filename into a valid date/time value.  But other than that, everything after the semicolon is just standard Perl code (the ExifTool "advanced formatting expression" feature).

Also notice I added the "Z" because this is Zulu time.

- Phil
Title: Re: Combine Syntax question
Post by: Phil Harvey on March 31, 2023, 11:07:15 AM
I just realized that there is a work-around for 12.59 that will allow the last 2 commands to be combined as long as you can fix the date/time formatting in the CSV file to be YYYY.mm.dd format:

exiftool.exe -progress "-AllDates<filename" -EXIF:OffsetTimeOriginal=+00:00 Z:\data\P502\335ROV05\ -r -overwrite_original -geotag Z:\projects\P502\POS502_ROVNav\Protocols\2016-07-24_POS502_335ROV05\Lat_Long_Time_24072016_merged.csv -geotime=test "-Geotime<${filename;$_=$self->InverseDateTime($_)}Z"
(Adding the -geotime=test argument bypasses the bug which resulted in the default "-geotime<datetimeoriginal" being applied if there was a ">" in the advanced formatting expression.  Man, it took me some head-scratching to figure out why that wasn't working in the first place.)

- Phil