Combine Syntax question

Started by tkwasnitschka, March 31, 2023, 04:19:23 AM

Previous topic - Next topic

tkwasnitschka

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?

Phil Harvey

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

tkwasnitschka

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

Phil Harvey

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

Phil Harvey

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