Writing XMP to stdout

Started by Misty, August 31, 2012, 01:25:37 PM

Previous topic - Next topic

Misty

This is hopefully just an EPEBKAC on my part, but I'm having difficulty writing XMP metadata to standard out.  I've tried a variety of commands, which typically produce the error "Error: Can't create file (unknown type) -" - leading me to think maybe Exiftool is relying on the format of the output file to determine how to write the output, which of course fails for stdout. The command I thought should work is:


exiftool -tagsfromfile input.MTS -all=xmp -o -


Which produces the message:


Warning: Can't set value for all tags
Error: Can't create file (unknown type) -


Replacing - with a filenname writes valid XMP as expected.

Phil Harvey

Yes.  From the command line the only way that exiftool knows the output format is from the file extension.

Via the API, this may be specified, but the application currently doesn't have an option for this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Misty

Thanks, Phil.

I'm not calling this from perl, so I'll just use a temporary file. Any chance of adding an option to specify the output format on the commandline so that writing to stdout could work?

Phil Harvey

Thanks for the suggestion.  I'll keep this in mind, but I really try to resist adding new options -- there are too many already.  But you may get your wish if other people request this too.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Bilge

It should definitely be added. It is inappropriate to assume that everyone wants to output to files and therefore rely on inferencing type from file name.

Phil Harvey

I'm thinking that maybe I can add this feature without creating a new option.  What about if I extend the -o option to allow a syntax like this:

exiftool -o -.EXT ...

which would write to stdout with a file format specified by EXT.

This breaks backward compatibility a little bit because now you'd have to do something like "-o ./-.xmp" instead of just "-o -.xmp" if you really wanted to create a file named "-.xmp", but I doubt anybody would ever want to do this anyway.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

This new feature is now available with ExifTool 9.02.  Use "-o -.xmp" to write XMP output to the console.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Misty

Excellent, thank you Phil! It works great! Much appreciated.