XMP sidecar

Started by TSM, October 27, 2015, 10:33:51 AM

Previous topic - Next topic

TSM

Is there a way to tell exiftool when loading metadata for a file to test if there is a sidecar file (same filename.xmp etc) to use that, ie -usexmp, but if it does use the XMP file that the 'File' section in the results is that of the file not the XMP. Any changes would be on the XMP file not the source.
This would be really useful when scanning directories.

Phil Harvey

There are lots of ways to tell exiftool to use XMP.  The syntax depends on what you are doing.  See the -srcfile option and the Sidecar files page.

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

TSM

Hmm, not sure if I have a syntax error.
The file section is related to the XMP file not the original JPG, also it complains if the XMP does not exist.
I was hoping for a 'if exists use it' flag.


[root@cron-server2 exif]# ./exiftool /tmp/wenn23071234.jpg -srcfile %d%f.xmp -g -j
[{
  "SourceFile": "/tmp/wenn23071234.xmp",
  "ExifTool": {
    "ExifToolVersion": 9.65
  },
  "File": {
    "FileName": "wenn23071234.xmp",
    "Directory": "/tmp",
    "FileSize": "5.3 kB",
    "FileModifyDate": "2015:10:27 15:01:55+00:00",
    "FileAccessDate": "2015:10:27 15:01:56+00:00",
    "FileInodeChangeDate": "2015:10:27 15:01:55+00:00",
    "FilePermissions": "rw-r--r--",
    "FileType": "XMP",
    "MIMEType": "application/rdf+xml"
  }
.....

Phil Harvey

Quote from: TSM on October 27, 2015, 11:05:57 AM
The file section is related to the XMP file not the original JPG

Yes.  You can either process the file or the sidecar.  There is no complex option available to take some information from one and some from another.

Quotealso it complains if the XMP does not exist.

From the -srcfile documentation:

            If than one -srcfile option is specified, the files are tested in
            order and the first existing source file is processed.  If none of
            the source files already exist, then exiftool uses the first
            -srcfile specified.

            A FMT of "@" may be used to represent the original FILE, which may
            be useful when specifying multiple -srcfile options (eg. to fall
            back to processing the original FILE if no sidecar exists).


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

TSM

It still would be nice to have the ability for the file section map to the image file and not the JPG else ile have to do two calls.

The ideal situation would the ability to scan a directory and say return all the metadata for files but if there is an XMP for a file return that data but with the file section that matches the source file.

For the moment ile have to write a fair bit of workaround code to handle this and merge the results.

Phil Harvey

I don't see any way around the merging.  The exiftool application isn't designed to process two files simultaneously.

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

TSM

Not really a merge but more...

1. supply file XXX.mp4
2. before reading metadata check if XXX.xmp exists and user has supplied option (read from XMP if exists)
3. return metadata stored in xmp file as if it was read from the mp4

I suspect what you are getting at is that the File/EXIF/JIFF/Quicktime data comes from the mp4 and the XMP/IPTC comes from the XMP, merging these together may be a problem.

What about adding all the XMP data into a separate section on the JSON output ie 'XMPSidecarData'.

Phil Harvey

This doesn't make sense with respect to the way ExifTool writes JSON (there are no sections, just tag names and values).

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