extracting JPG from RAW and copying EXIF in one call for single file

Started by fpria, January 08, 2024, 02:48:17 PM

Previous topic - Next topic

fpria

I need to extract a jpg from a RAW file and copy the EXIF data to it. I care about speed so I tried using -execute but my command doesn't work and returns "Error renaming out.jpg"
exiftool -a -b -JpgFromRaw r5.cr3 > out.jpg -execute -tagsfromfile r5.cr3 -exif:all out.jpgWhen I run the commands separately, they work, but an additional file is created: out.jpg_original

Can anyone help me build a one-line command that would work in the fastest way?
I don't need all the exif data, all I need is: focal length, shutter speed, aperture, iso if it has any significance for the speed of operation

My platform is Windows.

fpria

I managed to create a command that works. Is there any way to speed up its work even more?
exiftool
-b -jpgfromraw -w %f.jpg
-execute
-tagsfromfile @ -EXIF:FNumber -exif:exposureTime -exif:iso -exif:FocalLength -exif:orientation -srcfile %f.jpg -overwrite_original
-common_args r5.cr3

Phil Harvey

Well done.  That's a bit of a tricky command, but you nailed it.

I don't see any way to speed this up for a single file, but it should be much faster per file if you process multiple files in the same command (eg. use -ext cr3 DIR instead of r5.cr3).

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

fpria

@
Quote from: Phil Harvey on January 08, 2024, 03:52:55 PMWell done.  That's a bit of a tricky command, but you nailed it.

I don't see any way to speed this up for a single file, but it should be much faster per file if you process multiple files in the same command (eg. use -ext cr3 DIR instead of r5.cr3).

- Phil
Phil, can you help me construct an equivalent of this command that works in stay_open mode?
After an hour of trying, I gave up.

Phil Harvey

Are you sure you need to use -stay_open?  This is only used when exiftool is called by another app to avoid the startup delay.

But if you really do want to use -stay_open then you can't use the -common_args and your argument stream would look like this:

-stay_open
true
-b
-jpgfromraw
-w
%f.jpg
r5.cr3
-execute
-tagsfromfile
@
-EXIF:FNumber
-exif:exposureTime
-exif:iso
-exif:FocalLength
-exif:orientation
-srcfile
%f.jpg
-overwrite_original
r5.cr3
-execute

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

fpria

Yes, I meant stay_open mode. I'm looking for a solution that will give me the best speed.
A single command execution from the CLI takes about 1600ms, and executing it in stay_open mode takes about 560ms.
It's a pity that it can't be done in one go. It seems that jpegfromraw takes about 270ms and copying exif also takes 270ms.

Alternatively, I would be satisfied if the jpeg extracted from raw was correctly rotated according to orientation, but I know that exiftool does not perform such operations :(