ExifTool Forum

ExifTool => Developers => Topic started by: Wade Tregaskis on March 03, 2024, 07:35:23 PM

Title: How to split metadata between EXIF and XMP
Post by: Wade Tregaskis on March 03, 2024, 07:35:23 PM
I'm trying to use exiftool to generate the EXIF & XMP blobs to go into images that I'm constructing myself in memory.  I'll be modifying those blobs a little before actually inserting them into the files, and the files don't exist on disk, so having exiftool manipulate the files directly isn't an option.

I'm able to generate the blobs just fine (i.e. `-o -.EXIF` & `-o -.XMP`), but of course I don't want their contents to overlap.  Furthermore, I want to use EXIF in preference because it's more efficient (unfortunately the file format I'm using doesn't support compression of metadata).  But of course not every possible tag is supported in EXIF, thus the need for XMP as a fallback.

I'm not sure what the best approach is.  It seems like I can:


It seems reasonably straightforward - unless there's caveat(s) I'm overlooking? - but is there an easier or more efficient way?

Is there a way to have exiftool generate both EXIF & XMP blobs in a single invocation?

(I'm already using -stay_open, but even so having to feed potentially huge lists of tags & values in multiple times is suboptimal)
Title: Re: How to split metadata between EXIF and XMP
Post by: Phil Harvey on March 05, 2024, 03:59:08 PM
ExifTool is able to generate EXIF and XMP simultaneously.  It will split EXIF into multiple segments if necessary either when writing tags individually or EXIF as a block.  Unfortunately XMP must be written as individual tags because the format changes when it is split between segments.

- Phil
Title: Re: How to split metadata between EXIF and XMP
Post by: Wade Tregaskis on March 05, 2024, 04:15:23 PM
How do I have it generate EXIF & XMP in one command?  If I specify `-o -.EXIF -o -.XMP`, only the last `-o` is honoured.

I'm also not sure how I'd tell the two binary blobs apart in the output stream - is there a special delimiter used between them?
Title: Re: How to split metadata between EXIF and XMP
Post by: Phil Harvey on March 05, 2024, 05:23:06 PM
Ah, I see.  You can use -o -.exv to write both (but in the same file).  It can't be used to generate them as separate files in one command.  Actually, if you use EXV output format then the EXIF and XMP will automatically be split into segments.

- Phil