ExifTool Forum

ExifTool => Newbies => Topic started by: amkellett on April 12, 2018, 04:38:09 PM

Title: Can't write to properly-defined user namespace because of other tag namespaces?
Post by: amkellett on April 12, 2018, 04:38:09 PM
Hi,
i am trying to write some new tags into existing images.  I'm running exiftool from the command line under win7.  I have defined a new namespace using guidance from these forum topics. 

https://exiftool.org/forum/index.php?topic=3885.0
https://exiftool.org/forum/index.php?topic=8740.0

When I try to write any tags to these images I get this error. 

Warning: Undefined XMP namespace: avi - C:/AV GIS/exiftool_tools/IMG_000142.jpg

This namespace (avi) is NOT the video format, but is just an unfortunate name choice.  If I try to write my new tags to a file where all the metadata has been stripped (it was manipulated in Matlab) it writes just fine. 

I decided to just take the error at face value and define the avi namespace based on the tags I see when I write the tags using exiftool and the -v2 option.

Now my .ExifTool_ config file has two names spaces:




%Image::ExifTool::UserDefined::Camera = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-Camera', 2 => 'Camera' },
    NAMESPACE => { 'Camera' => 'http://pix4d.com/camera/1.0/'  },
    WRITABLE => 'string',
    Yaw             => { Writable => 'real' },
    Pitch           => { Writable => 'real' },
    Roll            => { Writable => 'real' },
    IMUSampleSize   => { Writable => 'integer' },

....more tags here.....

IMUAngularVelocity => {
        Binary => 1,
        ValueConv => 'Image::ExifTool::XMP::DecodeBase64($val)',
        ValueConvInv => 'Image::ExifTool::XMP::EncodeBase64($val)',
    },
);

%Image::ExifTool::UserDefined::avi = (
    GROUPS => { 0 => 'avi', 1 => 'avi', 2 => 'Image' },
    NAMESPACE => { 'Image' => 'http://avinc.com/avi'  },
    WRITABLE => 'string',
    AutoColor             => { Writable => 'real' },
    AutoExposure           => { Writable => 'real' },

... more tags here ..........

   ils_nir    => { },
    ils_red    => { },
);

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        Camera => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::Camera',
            },
        },
        avi => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::avi',
            },   
        },
    },
);


Even with this config, I get the same error "Undefined XMP namespace: avi  "
I did verify that the .ExifTool_config file is loading with a print statement placed at the end of the file.
Again, If no tags are previously written in the .jpg file, I can write my tags in avi and XMP-Camera.
I suspected the avi tags may be somehow malformed or misplaced inside the .jpg.  Here is the beginning and end of the xmp metadata:
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 8.71'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about='' xmlns:aerovironment='http://ns.aerovironment.com/'>
<XMP:XMP-Camera:BandName>Red,Green,Blue</XMP:XMP-Camera:BandName>
<XMP:XMP-Camera:Pitch>-1.590848</XMP:XMP-Camera:Pitch>
<XMP:XMP-Camera:Roll>-4.491234</XMP:XMP-Camera:Roll>
<XMP:XMP-Camera:Yaw>-167.393129</XMP:XMP-Camera:Yaw>
<av:test>test</av:test>
<avi:AutoColor>0</avi:AutoColor>
<avi:AutoExposure>1</avi:AutoExposure>
<avi:AutoExposureGainFilterConstant>0.750000</avi:AutoExposureGainFilterConstant>

.....more tags here......

<avi:ils_nir>0.000000</avi:ils_nir>
<avi:ils_red>1150.115967</avi:ils_red>
</rdf:Description>
<rdf:Description rdf:about=''
xmlns:xmp='http://ns.adobe.com/xap/1.0/'>
<xmp:Rating>0</xmp:Rating>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>


Hopefully someone sees a glaring error.
I do have uncertainty about the avi tag table definition.  the tags I see have the form avi:xxx, not XMP-avi:xxx, so I figured they exist in a less deep hierarchy, but my definition is, well ... I just don't know.
If you have read this far you already have my deepest thanks.
Thanks,
Title: Re: Can't write to properly-defined user namespace because of other tag namespaces?
Post by: Phil Harvey on April 12, 2018, 09:19:56 PM
Your avi definition should look start like this:

%Image::ExifTool::UserDefined::avi = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-avi', 2 => 'Image' },
    NAMESPACE => { 'avi' => 'http://avinc.com/avi'  },
...


- Phil
Title: Re: Can't write to properly-defined user namespace because of other tag namespaces?
Post by: amkellett on April 13, 2018, 12:03:07 PM
Changed the definition and I still have that error, but at least i have some confidence in that part of my setup now.  I will keep at it and try to narrow the problem. 

It is astounding to me that every forum post has a reply - Thanks very much!!
Title: Re: Can't write to properly-defined user namespace because of other tag namespaces?
Post by: amkellett on April 13, 2018, 12:15:06 PM
Here is a narrow question:
I have seen this structure:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        Camera => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::Camera',
            },
        },
        avi => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::avi',
            },   
        },
    },
);


At both the beginning and end of example .ExifTool_config files.  Does it make a difference?
Title: Re: Can't write to properly-defined user namespace because of other tag namespaces?
Post by: amkellett on April 13, 2018, 12:28:55 PM
And here is the full verbose output from my latest attempt:
Z:\Bailey\4Andy\Parreira Almonds\Equalized Images>exiftool -v3 -xmp-camera:Roll=
666.66 "C:\AV GIS\exiftool_tools\IMG_000142_RGB.jpg
LOADED_floopy!
Writing XMP-Camera:Roll
======== C:/AV GIS/exiftool_tools/IMG_000142_RGB.jpg
Rewriting C:/AV GIS/exiftool_tools/IMG_000142_RGB.jpg...
  Editing tags in: APP1 XMP
  Creating tags in: APP1 XMP
JPEG APP0 (14 bytes):
    0000: 4a 46 49 46 00 01 01 00 00 01 00 01 00 00       [JFIF..........]
JPEG APP1 (928 bytes):
    0000: 45 78 69 66 00 00 4d 4d 00 2a 00 00 00 08 00 0b [Exif..MM.*......]
    0010: 01 0e 00 02 00 00 00 17 00 00 00 92 01 0f 00 02 [................]
    0020: 00 00 00 0e 00 00 00 aa 01 10 00 02 00 00 00 08 [................]
    0030: 00 00 00 b8 01 1a 00 05 00 00 00 01 00 00 00 c0 [................]
    0040: 01 1b 00 05 00 00 00 01 00 00 00 c8 01 28 00 03 [.............(..]
    0050: 00 00 00 01 00 02 00 00 01 31 00 02 00 00 00 07 [.........1......]
    0060: 00 00 00 d0 02 13 00 03 00 00 00 01 00 01 00 00 [................]
    [snip 816 bytes]
JPEG APP1 (3801 bytes):
    0000: 68 74 74 70 3a 2f 2f 6e 73 2e 61 64 6f 62 65 2e [http://ns.adobe.]
    0010: 63 6f 6d 2f 78 61 70 2f 31 2e 30 2f 00 3c 3f 78 [com/xap/1.0/.<?x]
    0020: 70 61 63 6b 65 74 20 62 65 67 69 6e 3d 22 ef bb [packet begin="..]
    0030: bf 22 20 69 64 3d 22 4b 4f 56 6e 6b 36 6f 37 58 [." id="KOVnk6o7X]
    0040: 41 65 57 76 7a 54 69 74 31 30 62 4e 31 6c 76 22 [AeWvzTit10bN1lv"]
    0050: 3f 3e 0a 3c 78 3a 78 6d 70 6d 65 74 61 20 78 6d [?>.<x:xmpmeta xm]
    0060: 6c 6e 73 3a 78 3d 27 61 64 6f 62 65 3a 6e 73 3a [lns:x='adobe:ns:]
    [snip 3689 bytes]
  Rewriting XMP
    + XMP-Camera:Roll = '666.66'
  Warning = Undefined XMP namespace: avi
    [XMP rewritten with no changes]
JPEG DQT (65 bytes):
JPEG DQT (65 bytes):
JPEG SOF0:
JPEG DHT (29 bytes):
JPEG DHT (179 bytes):
JPEG DHT (29 bytes):
JPEG DHT (179 bytes):
JPEG SOS
Nothing changed in C:/AV GIS/exiftool_tools/IMG_000142_RGB.jpg
Warning: Undefined XMP namespace: avi - C:/AV GIS/exiftool_tools/IMG_000142_RGB.
jpg
    0 image files updated
    1 image files unchanged
Title: Re: Can't write to properly-defined user namespace because of other tag namespaces?
Post by: Phil Harvey on April 13, 2018, 12:48:05 PM
Quote from: amkellett on April 13, 2018, 12:15:06 PM
At both the beginning and end of example .ExifTool_config files.  Does it make a difference?

No.
Title: Re: Can't write to properly-defined user namespace because of other tag namespaces?
Post by: Phil Harvey on April 13, 2018, 12:48:50 PM
Quote from: amkellett on April 13, 2018, 12:28:55 PM
And here is the full verbose output from my latest attempt:

Please attach your config file so I can see what the problem is.

- Phil
Title: Re: Can't write to properly-defined user namespace because of other tag namespaces?
Post by: amkellett on April 13, 2018, 12:59:07 PM
Attached, and again, thanks so much.
Title: Re: Can't write to properly-defined user namespace because of other tag namespaces?
Post by: Phil Harvey on April 13, 2018, 01:46:33 PM
Your config file works fine:

% exiftool -config ~/Desktop/ExifTool_config.dms a.jpg -xmp-camera:Roll=666.66
LOADED_floopx!
    1 image files updated
% exiftool a.jpg -xmp-camera:Roll
Roll                            : 666.66


The warning must be due to the XMP that already exists in your JPG image.  You can rebuild it like this to fix the problem (but this will remove any tags that are not known to ExifTool):

exiftool -xmp:all= -tagsfromfile @ -xmp:all FILE

- Phil