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.
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
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?
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
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.
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
This new feature is now available with ExifTool 9.02. Use "-o -.xmp" to write XMP output to the console.
- Phil
Excellent, thank you Phil! It works great! Much appreciated.