ExifTool Forum

ExifTool => Developers => Topic started by: Gnits on February 13, 2016, 09:24:28 AM

Title: Using -StayOpen
Post by: Gnits on February 13, 2016, 09:24:28 AM
Background.

I would like to present a list of files (in a text file)  to Exiftool so I can get a simple csv containing Camera Make, Model and Serial No. (ie 1 line per image). I have 75,000 image files. (I am an amateur photographer).


I am using VBA to create a VB script on Windows 10.

I cannot use a simple *.* mechanicism as the filenames / extensions are too awkward and dealing with too many files.

I have successfully generated a script which creates an individual bat file to create a csv per image file, which I then read and process in VBA.

Unfortunately, as outlined in the documentation, this has a major overhead in performance as Exiftool is loaded each time.

I just discovered the -stay_open  and struggling to get it work, using one of the discussions here for inspiration.

So 2 related questions.
1. What is the most efficient method for me to use.
and or
2. If -stay_open is the optimum has anyone got a sample bat file and argument file I could use as a template to get me started.

Seriously impressed with ExifTool.
Title: Re: Using -StayOpen
Post by: Phil Harvey on February 13, 2016, 11:39:43 AM
You don't need to use -stay_open if you want to do the same thing to a large number of files.  Just use -@ with a file list as you mentioned.  The -stay_open is useful to speed things up if you want to run exiftool a number of times with different options each time.

- Phil
Title: Re: Using -StayOpen
Post by: Gnits on February 13, 2016, 11:47:11 AM
Delighted to get such a prompt response.  I will explore the -@  further.

So, would it be too much to ask for an example bat file which would give me a csv file for say Make and Model using an argument file  holding the paths to c:\file_a.jpg and c:\file_b.jpg

Much appreciated.
Title: Re: Using -StayOpen
Post by: Phil Harvey on February 13, 2016, 11:52:19 AM
The command would be:  exiftool -make -model -csv -@ file_list.args > out.csv

and file_list.args would be:

c:\file_a.jpg
c:\file_b.jpg


- Phil
Title: Re: Using -StayOpen
Post by: Gnits on February 13, 2016, 11:53:55 AM
So simple .... so obvious but
  ......so grateful. 

Title: Re: Using -StayOpen
Post by: Gnits on February 13, 2016, 12:04:04 PM
Works a treat.

Thanks.
Title: Re: Using -StayOpen
Post by: Gnits on February 14, 2016, 04:46:28 PM
Now that I am able to use ExifTool against a reasonable size list of files (still tidying up my code) .... 2 observations...

1. Surprised that no Exif info from Xmp files (or am i missing something)
2. Canon 5dm2 camera serial numbers has an extra leading zero in Cr2 files (but appear correct in Lightroom). Psd files from the same raw have the correct serial numbers.
3. Delighted to get what looks like a serial number from Sony A7 raw files.


Title: Re: Using -StayOpen
Post by: Phil Harvey on February 14, 2016, 08:44:05 PM
There is a way to write Exif info to XMP, but whatever software you use would need to do this.

The extra zero may be just due to inconsistencies in the way Canon uses serial numbers for different models.

- Phil
Title: Re: Using -StayOpen
Post by: Gnits on February 15, 2016, 06:21:04 PM
My query was more to do with reading Exif data from Xmp files. 

See this example ....


SourceFile,DateTimeOriginal,Make,Model,SerialNumber,InternalSerialNumber
P:/TestImages/MoB_00784_S007175.ARW,2016:02:01 15:00:57,SONY,ILCE-7,,86ff310a
P:/TestImages/MoB_00784_S007175.XMP,,,,,

No Exif info from the related XMP file (maybe it is not possible ...

I do not want to write to an xmp file myself,under any circumstances).


Real World Scenario. Multiple photographers on the same shoot . Ideal at the time, but now I want to put the different raws and xmp files into separate folders as defined by their camera serial numbers.

I do not want to be a drain on your time.  I am extremely pleased to have got your response with the worked example above, so no need to reply if this is asking too much.
Title: Re: Using -StayOpen
Post by: Phil Harvey on February 16, 2016, 07:13:13 AM
All of the tags you are extracting except InternalSerialNumber have representations in XMP.  But again, it is up to the software that wrote the XMP to generate these.

- Phil
Title: Re: Using -StayOpen
Post by: Gnits on February 16, 2016, 08:23:03 AM
Ok... thanks.

I will write some code to extract the relevant info from the xmp file and save it in a format similar to your csv output. Probably only need 20 lines of code.

I can then write a small app where I can combine the output from exiftool and use it to copy the correct pair of raw and xmp files for a specific camera to a different directory.

That will solve my main reason to explore exiftool.


Thank you.