Piping multiple files in and out for a single operation?

Started by clement.nardi, December 15, 2014, 04:21:41 PM

Previous topic - Next topic

clement.nardi

Hello,

I'm working on an application whose job is to manage the transfer of the pictures on my camera's memory card to my computer.
In the process, I geotag these pictures using exiftool.

Today I do this in 3 steps:
- copy all the pictures to a temporary folder
- launch exiftool to geotag the pictures in place:
exiftool -config gps.config -geotag gps/* -progress -overwrite_original -P -if not $GPSLatitude tempfolder/
- move the pictures to their final destination

This is working fine, but I would like to improve this by avoiding to copy the files to a temporary folder and piping them through exiftool instead.
I checked the command line documentation and found that this is possible:
cat /memorycard/DSCF7386.JPG | exiftool -geotag gps/* - > ~/pictures/DSCF7386.JPG

However, I can't consider doing this file by file because of the GPS track files loading overhead.
Actually, loading the track files is as long as processing ~100 pictures, depending on the number of track files.

Then I checked the -stay_open option, but I don't see how this could help.

Is there a way to load some gps track files into exiftool, and then pipe multiple files through it?
Or do you see another way?


If not, then I started to consider another option, which is to call the perl routines from Geotag.pm directly from my application. But this seems a bit complex to do since my application is written in C++ and my primary target is Windows. I assume I need to embed perl in my executable, right?
How is it done for exiftool.exe? I couldn't find the source code of the windows executable, is it available somewhere?

Best regards,
Clement

Phil Harvey

Hi Clement,

Why not let ExifTool move the files for you.  Specify the memory card as the source, and use the -o option to specify the finale directory.  You can do this and geotag the images in a single command.

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

clement.nardi

Hi Phil,

Thanks for your prompt answer!

Indeed, this would work for a memory card. But there are two reasons why I did not consider this:
- It will not work if the pictures are on a smartphone or camera connected to the PC through protocols such as MTP or PTP. One of the key features of my app is to support these protocols.
- I may reach limitations to the command line length, as I would need to pass each file path individually... I already encountered this issue before, it's one of the reasons why I copy everything to a temporary location first.


Phil Harvey

OK, well then to answer your original question.  There is no way to pipe multiple files through exiftool because this would require a mechanism to be able to distinguish the individual files on output.

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