News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

"0 output files created" - but no error message?

Started by lokatz, June 05, 2020, 03:30:57 PM

Previous topic - Next topic

lokatz

Hope this is a bit less of a newbie-ish question:  with great help from forum members, I figured out how to run ExifTool as a process from C# using -stay_open.  Testing my implementation, I ran it with a bunch of different image formats, where each is processed with ArgFile entries that look like this:

-b
-ThumbnailImage
-w
%0f[OUTPUTFILENAME]
[INPUTFILENAME]
-execute


This generally works well. 

I then read the redirected StandardOutput and StandardError streams since my program needs to know when ExifTool completed each file extraction.  The issue I am running into is that when ExifTool is unable to complete an operation, in some cases it will tell me by showing "0 output files created" in StandardOutput and giving a corresponding error message via StandardError, such as "Output file [OUTPUTFILENAME] already exists for [INPUTFILENAME], while in other cases, it won't do the latter.  For instance, when trying to extract a Thumbnail from a Minolta .MRW image, which apparently does not include one, StandardOutput will again read "0 output files created", but if my program then tries to read StandardError, it hangs because ExifTool apparently does not provide additional error information in this case.

Is this intended behavior, an ExifTool error, something I can work around somehow, or else?  The issue with it is that there is no way to detect whether StandardError has any information or not. All synchronous attempts to check the StandardError stream wait until the stream receives more data, which means the program hangs.  Even if reading StandardError asynchronously, the issue essentially remains as the async error handler would wait infinitely for an error message and has no way of figuring out that there won't be one.

StarGeek

Are you sure that the file contains a ThumbnailImage?  The sample MRW file I dug up doesn't, just the PreviewImage.

You can use -preview:all to see all the possible preview images in a file, as different camera types save previews in different places.  For example, my NEF file has ThumbnailTIFF, JpgFromRaw, and PreviewImage.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

lokatz

As I said: no, it does not contain one.  Problem is, I am trying to write a program to handle any type of image file, reading potentially large numbers of preview images as quickly as possible, so I was hoping handling the error message would be the fastest way for me to respond to issues.  I wasn't aware of the -preview:all option, so thank you for sharing that, but I sense it'll slow down the process a bit.

And yes, my OWN image files are NEFs, too.   ;)

StarGeek

Quote from: lokatz on June 05, 2020, 04:53:18 PM
As I said: no, it does not contain one. 

Oops, stopped reading too soon.  I saw ThumbnailImage and a raw file type and went looking for an sample to see the details because I knew it didn't exist in my NEFs.

I think that technically you don't get an error message because an error didn't occur.  The data just didn't exist.

Maybe check the return code from the command?  If there's an error then the return code is 1.  If the command fails and -if then the return code is 2.  I'm not sure if there are others.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

You can use -echo4 to send something to stderr after processing is complete

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

lokatz

#5
Will try out the -echo4 option, thanks! 

The return code route unfortunately won't work as the process won't release a return code until it completed, which 'stay_open' is supposed to prevent.

StarGeek

Quote from: lokatz on June 05, 2020, 06:06:49 PMThe return code route unfortunately won't work as the process won't release a return code until it completed, which 'stay_open' is supposed to prevent.

Ah, yes, of course. 
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).