XMP-Metadata shows up in output but is not writable

Started by gilhin, January 02, 2022, 10:02:49 AM

Previous topic - Next topic

gilhin

Dear,

first of all - have a great New Year with a lot of health and satisfaction   :D

To get back to topic. This great software has already saved me a lot of time.
Unfortunately, I am currently on a point where I cannot guess my way based on the forum or the support pages.
I am using Mylio as my DAM software. Unfortunately, Mylio is not using the standard XMP tags, but introduces specific tags.
Using

exiftool -a -G1 -s IMG-20171113-WA0069.xmp

on a (obviously) WhatsApp file (or the XMP file for it) shows

[ExifTool]      ExifToolVersion                 : 12.38
[System]        FileName                        : IMG-20171113-WA0069.xmp
[System]        Directory                       : .
[System]        FileSize                        : 1552 bytes
[System]        FileModifyDate                  : 2022:01:02 00:35:26+01:00
[System]        FileAccessDate                  : 2022:01:02 00:46:26+01:00
[System]        FileInodeChangeDate             : 2022:01:02 00:35:42+01:00
[System]        FilePermissions                 : -rw-r--r--
[File]          FileType                        : XMP
[File]          FileTypeExtension               : xmp
[File]          MIMEType                        : application/rdf+xml
[XMP-x]         XMPToolkit                      : Image::ExifTool 12.38
[XMP-MY]        DateRangeEnd                    : 1900:01:01 18:26:08.000
[XMP-MY]        DateRangeScope                  :
[XMP-MY]        DateRangeStart                  : 1900:01:01 18:26:08.000
[XMP-MY]        MetadataDate                    : 2021:07:14 11:45:47.927Z
[XMP-MY]        Undated                         : false
[XMP-MY]        Flag                            : false
[XMP-MY]        ProcessVersion                  : 1
[XMP-exif]      DateTimeOriginal                : 2017:11:13 00:00:00.000
[XMP-exif]      SubSecTime                      : 0
[XMP-exif]      SubSecTimeDigitized             : 0
[XMP-exif]      SubSecTimeOriginal              : 0
[XMP-xmp]       CreateDate                      : 2017:11:13 00:00:00
[XMP-xmp]       Label                           : Yellow
[XMP-xmp]       MetadataDate                    : 2021:07:14 11:45:47.927Z
[XMP-xmp]       ModifyDate                      : 2017:11:13 00:00:00.000
[XMP-xmpMM]     DocumentID                      : C69EB265-BD12-4285-9C39-35774441D2F4
[XMP-xmpMM]     InstanceID                      : xmp.iid:4B0232FB-F133-481F-8413-04B607F4B9F8
[XMP-xmpMM]     OriginalDocumentID              : C69EB265-BD12-4285-9C39-35774441D2F4


In the Mylio logic, I need to "copy" the exif:datetimeoriginal into both the MY:DateRangeEnd and MY:DateRangeStart.

To do so, I used the following command

exiftool "-DateRangeEnd<datetimeoriginal" IMG-20171113-WA0069.xmp

No matter if I use -DateRangeend, -MY:DateRangeEnd or -XMP-MY:DateRangeEnd - the output is always

Warning: Tag 'daterangeend' is not defined - IMG-20171113-WA0069.xmp
Warning: No writable tags set from IMG-20171113-WA0069.xmp
    0 image files updated
    1 image files unchanged


As I am perfectly aware that the issue is in front of the screen - what am I missing here?
Oh... And I am using ExifTool 12.38 on MacOS 12.1 if that matters.

Thank you for pushing me in the right direction,
best regards

Gilhin

StarGeek

The only thing you're missing is the fact that exiftool doesn't know how to write those tags.  XMP is easy for exiftool to read even when it has never encountered the tags, as the names are right there in the data, but writing is different.

So for exiftool to write those tags, a config file needs to be made with the definitions.  You can find details in the example config file if you want to do it yourself.  Or give me a couple hours (only just woke up, West coast US time) and I'll make a very basic config file for these tags.

Can you post some raw XMP data for these tags?  Some of the details to create a config file are in the raw data. Run this command to get the data
exiftool -XMP -b file.jpg

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

gilhin

Of course - and good morning  :D

<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about=""
    xmlns:exif="http://ns.adobe.com/exif/1.0/"
    xmlns:xmp="http://ns.adobe.com/xap/1.0/"
    xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
    xmlns:MY="http://ns.mylollc.com/MyloEdit/"
   exif:DateTimeOriginal="2016-11-13T00:00:08.000"
   exif:SubSecTime="0"
   exif:SubSecTimeDigitized="0"
   exif:SubSecTimeOriginal="0"
   xmp:CreateDate="2016-11-13T00:00:08.000"
   xmp:Label="Yellow"
   xmp:MetadataDate="2022-01-02T09:23:37.511Z"
   xmp:ModifyDate="2016-11-13T00:00:08.000"
   xmpMM:DocumentID="C69EB265-BD12-4285-9C39-35774441D2F4"
   xmpMM:InstanceID="xmp.iid:62F03F02-DA3C-4954-88E3-FFBE02458BA5"
   xmpMM:OriginalDocumentID="C69EB265-BD12-4285-9C39-35774441D2F4"
   MY:DateRangeStart="1900-01-01T00:00:08.000"
   MY:DateRangeEnd="1900-01-01T00:00:08.000"
   MY:DateRangeScope=""
   MY:Undated="false"
   MY:flag="false"
   MY:processVersion="1"
   MY:MetadataDate="2022-01-02T09:23:37.511Z"/>
</rdf:RDF>
</x:xmpmeta>


And in terms of definitions - if you have the time (and will) to do it, I would be more than happy.
Please just tell me if you are unable to do. I will need to have a closer look into the config file, as I haven't done so before.

gilhin

Even though it is certainly just a quick thing for you, I tried to start with it...
Am I right starting like this:

%Image::ExifTool::UserDefined::MY = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-MY', 2 => 'Image' },
    NAMESPACE => { 'MY' => 'http://ns.mylollc.com/MyloEdit/' },
    WRITABLE => 'string', # (default to string-type tags)
    XMP-MY:DateRangeStart => { Writable => 'lang-alt' },
    XMP-MY:DateRangeEnd => { Groups => { 2 => 'Author' } },


However, I currently have no idea how to change the format of the tags to be date tags...

StarGeek

You're on the right track.  You could make it Writable => 'date', and leave it at that, but if you want to make it a fully function date/time tag, it would be more like this.  At least I think this would work, I haven't tested it
DateRangeStart => {
Groups => { 2 => 'Time' },
%dateTimeInfo,
},


The %dateTimeInfo part should grab all the appropriate date/time options from the XMP.pm part of the exiftool source.  This will allow you to shift the time stamps and it will show up when you list Time:All.

If you want to expand it to be able to write Undated and Flag, you would use { Writable => 'boolean', %boolConv }.  and ProcessVersion would be Writable => 'integer',

All of the above is basically search/copy/paste/edit from the XMP source code of exiftool.

edit: Don't need the leading XMP-MY:, that's part of the header data
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

gilhin

Thank you for your swift feedback and support.
If I got you right, it would be

%Image::ExifTool::UserDefined::MY = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-MY', 2 => 'Image' },
    NAMESPACE => { 'MY' => 'http://ns.mylollc.com/MyloEdit/' },
    WRITABLE => 'string', # (default to string-type tags)
    DateRangeStart => {
Groups => { 2 => 'Time' },
%dateTimeInfo,
},
    DateRangeEnd => {
Groups => { 2 => 'Time' },
%dateTimeInfo,
}


If I got it right, I would now put this snippet into a .config file and activate it.
Could it really be that simple?

StarGeek

Almost that simple.  At the top, you also need to add the new namespace into the XMP main.  Add
%Image::ExifTool::UserDefined = (
# new XMP namespaces (eg. xxx) must be added to the Main XMP table:
    'Image::ExifTool::XMP::Main' => {
        # namespace definition for examples 8 to 11
        MY => { # <-- must be the same as the NAMESPACE prefix
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::MY',
                # (see the definition of this table below)
            },
        },
    },
);


There's still a few problems, but I almost have a complete config file.  For the moment, drop the %dateTimeInfo part and use
DateRangeEnd => {
Groups => { 2 => 'Time' },
Writable => 'date',
},


This is what I have so far
%Image::ExifTool::UserDefined = (
# new XMP namespaces (eg. xxx) must be added to the Main XMP table:
    'Image::ExifTool::XMP::Main' => {
        # namespace definition for examples 8 to 11
        MY => { # <-- must be the same as the NAMESPACE prefix
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::MY',
                # (see the definition of this table below)
            },
        },
    },
);

%Image::ExifTool::UserDefined::MY = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-MY', 2 => 'Image' },
    NAMESPACE => { 'MY' => 'http://ns.mylollc.com/MyloEdit/' },
    #WRITABLE => 'string', # (default to string-type tags)
DateRangeStart => {
Groups => { 2 => 'Time' },
%dateTimeInfo,
},
DateRangeEnd => {
Groups => { 2 => 'Time' },
%dateTimeInfo,
},
MetadataDate => {
Groups => { 2 => 'Time' },
%dateTimeInfo,
},
Undated => { Writable => 'boolean', %boolConv },
Flag => { Writable => 'boolean', %boolConv },
ProcessVersion => { Writable => 'integer' },
);


Works for the last three, still a problem with %dateTimeInfo,.  Change that as above for the moment.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

StarGeek

This should be a fully functional config file
%Image::ExifTool::UserDefined = (
# new XMP namespaces (eg. xxx) must be added to the Main XMP table:
    'Image::ExifTool::XMP::Main' => {
        # namespace definition for examples 8 to 11
        MY => { # <-- must be the same as the NAMESPACE prefix
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::MY',
                # (see the definition of this table below)
            },
        },
    },
);

%Image::ExifTool::UserDefined::MY = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-MY', 2 => 'Image' },
    NAMESPACE => { 'MY' => 'http://ns.mylollc.com/MyloEdit/' },
    WRITABLE => 'string', # (default to string-type tags)
DateRangeStart => {
Groups => { 2 => 'Time' },
Writable => 'date',
Shift => 'Time',
PrintConv => '$self->ConvertDateTime($val)',
PrintConvInv => '$self->InverseDateTime($val,undef,1)',
},
DateRangeEnd => {
Groups => { 2 => 'Time' },
Writable => 'date',
Shift => 'Time',
PrintConv => '$self->ConvertDateTime($val)',
PrintConvInv => '$self->InverseDateTime($val,undef,1)',
},
MetadataDate => {
Groups => { 2 => 'Time' },
Writable => 'date',
Shift => 'Time',
PrintConv => '$self->ConvertDateTime($val)',
PrintConvInv => '$self->InverseDateTime($val,undef,1)',
},
Undated => { Writable => 'boolean', %boolConv },
Flag => { Writable => 'boolean', %boolConv },
ProcessVersion => { Writable => 'integer' },
DateRangeScope => { },
);


I left DateRangeScope to default as a string, since I don't know what data might go there.

Edit: You did most of the work here, I just copy/pasted to expand things and tweak a few things to make it work.
Example output:
C:\>exiftool -config mylio.config -all= -P -overwrite_original -XMP-MY:DateRangeStart="2022:01:02 12:00:00" -XMP-MY:DateRangeEnd=now -XMP-MY:MetadataDate=now -XMP-MY:Undated=false -XMP-MY:Flag=false -XMP-MY:ProcessVersion=1 -DateRangeScope=1 y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -xmp-my:all y:\!temp\Test4.jpg
---- XMP-MY ----
DateRangeEnd                    : 2022:01:02 08:54:23-08:00
DateRangeScope                  : 1
DateRangeStart                  : 2022:01:02 12:00:00
Flag                            : False
MetadataDate                    : 2022:01:02 08:54:23-08:00
ProcessVersion                  : 1
Undated                         : False


Example raw XMP.  Your example XMP uses the more a more compact form of XMP.  See -api Compact
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.37'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about=''
  xmlns:MY='http://ns.mylollc.com/MyloEdit/'>
  <MY:DateRangeEnd>2022-01-02T08:54:23-08:00</MY:DateRangeEnd>
  <MY:DateRangeScope>1</MY:DateRangeScope>
  <MY:DateRangeStart>2022-01-02T12:00:00</MY:DateRangeStart>
  <MY:Flag>False</MY:Flag>
  <MY:MetadataDate>2022-01-02T08:54:23-08:00</MY:MetadataDate>
  <MY:ProcessVersion>1</MY:ProcessVersion>
  <MY:Undated>False</MY:Undated>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

gilhin

That's great, I will be more than happy to try...
One last thing though.

If I needed to copy the content from one string to another it would be like this, right?

exiftool -config mylio.config -all= -P -overwrite_original '-XMP-MY:DateRangeStart<datetimeoriginal' '-XMP-MY:DateRangeEnd<datetimeoriginal' -XMP-MY:MetadataDate=now -XMP-MY:Undated=false -XMP-MY:Flag=false FILEorDIR

And one very last  :D (sorry, I am a procurement guy in real life - there is always one more to ask  ;D).

If I understand correctly, I would use the -config flag with every command I use and putting it into my homefolder (or any other environment as described in the example.config) and renaming it would make the contents permanently availabale.

Is this assumption right?

EDIT: I forgot the quotes around the "less than" relation.

StarGeek

Quote from: gilhin on January 02, 2022, 12:42:40 PM
If I needed to copy the content from one string to another it would be like this, right?

Remove the -All= part.  That was in my command so all previous data in my test file gets removed.  You definitely don't want it in you main command.

QuoteIf I understand correctly, I would use the -config flag with every command I use and putting it into my homefolder (or any other environment as described in the example.config) and renaming it would make the contents permanently availabale.

If you want to keep it as a separate file, then then you can place it in the same directory as exiftool and call it with -config mylio.config (must be first option) or you could give the full path to the file.  Or rename it to .ExifTool_config and it will always be available without having to use the -Config option.

If you already have a .ExifTool_config file with other definitions, merging the two is a bit more complex.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

gilhin

Great - thank you so much for your support.
It is working as expected - and saving a lot of time...

Have a great evening (in my timezone  ;))

Regards

Gilhin