ExifTool Forum

ExifTool => Newbies => Topic started by: javiavid on March 25, 2021, 06:03:37 AM

Title: Copy metadata from an MXF to an XMP
Post by: javiavid on March 25, 2021, 06:03:37 AM
Hello,
I am trying to extract a label that is called Video Coding Scheme ID and copy it to an XMP, if I execute the command:
Exiftool -u -Videocodingschemeid atom.mxf

I get:
Video Coding Scheme ID: 060E2B34-0401-010A-0401-020271080000


To create the XMP I use:
Exiftool -a -u -g1 -tagSfromfile atom.mxf -Videocodingschemeid atom.xmp

I get the following errors:

Warning: Tag 'videocodingschemeid' is not defined - atom.mxf
Warning: No Writable Tags Set from Atom.mxf
    0 image Files Updated
    1 image files unhanged

Any ideas?
Title: Re: Copy metadata from an MXF to an XMP
Post by: StarGeek on March 25, 2021, 10:53:51 AM
An XMP sidecar file can only hold XMP data.  That tag appears to be an MXF tag that doesn't have an equivalent tag in XMP.
Title: Re: Copy metadata from an MXF to an XMP
Post by: StarGeek on March 25, 2021, 11:38:28 AM
You can copy it into any existing XMP tag (https://exiftool.org/TagNames/XMP.html) you would like.  Either appending it to something like the Description, for example, "-Description<$Description Video Coding Scheme ID=$VideoCodingSchemeID" would add a note about the ID to the end of the Description, or you could repurpose a less common tag, for example, the CellTowerID used by some Sony Ericsson phones.

The former has the advantage that it would be visible in any program that reads metadata.  The latter is too specialized to do so.
Title: Re: Copy metadata from an MXF to an XMP
Post by: javiavid on March 25, 2021, 11:44:06 AM
Thank you very much, I got it to work
Title: Re: Copy metadata from an MXF to an XMP
Post by: javiavid on March 25, 2021, 11:54:05 AM
I have another doubt, is it possible in any way "format" this information before copying it?

For example, if it detects that the text on the source tag is"0004" that copy the text "ProRes" on the destination tag.
Title: Re: Copy metadata from an MXF to an XMP
Post by: Phil Harvey on March 26, 2021, 01:13:18 PM
Quote from: javiavid on March 25, 2021, 11:54:05 AM
For example, if it detects that the text on the source tag is"0004" that copy the text "ProRes" on the destination tag.

Like this?:  "-DSTTAG<${SRCTAG;$_ = 'ProRes' if /0004/}"

- Phil
Title: Re: Copy metadata from an MXF to an XMP
Post by: javiavid on March 29, 2021, 03:01:42 AM
This works well, thanks Phil
Title: Re: Copy metadata from an MXF to an XMP
Post by: javiavid on March 29, 2021, 04:14:36 AM
Hi,
I'm trying to follow this post https://exiftool.org/forum/index.php/topic,4682.msg22369.html#msg22369 because the example is very similar, but I do not get it.
The value at atom.mxf is VideoCodingSchemeID:
060E2B34-0401-010A-0401-020271080000.

The command that I use is as follows:
Exiftool -Config Example.config -a -u -g1 -tagsfromfile atom.mxf "-Headline <VideoCodingSchemeID" atom.xmp

And the example.config file contains this:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        Headline => {
            Require => 'VideoCodingSchemeID',
            ValueConv => q{
                return test1 if $val eq '060e2b34-0401-010a-0401-020271080000';
                return test2 if $val eq '060e2b34-0401-010a-0401-020271080001';
                # ...
                return undef;
            },
        },
    },
);
1; # end


The result I get is that I always copy the original value (060e2b34-0401-010a-0401-020271080000) but not test1.

I would really like to do this process to a folder with subfolders and many MXF. I tell you so as not to bother you again in another post ..   ;D

Thanks
Title: Re: Copy metadata from an MXF to an XMP
Post by: StarGeek on March 29, 2021, 11:22:48 AM
If you are returning a string, you need to put quotes around it.
return 'test1' if $val eq '060e2b34-0401-010a-0401-020271080000';
Title: Re: Copy metadata from an MXF to an XMP
Post by: javiavid on March 29, 2021, 02:24:33 PM
I get the same message as before
1 image files updated
And the same thing happens.

I've tried with double quotes (I'm not sure if windows uses double quotes...) but the same thing happens.

This is the content of the XMP.


<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.22'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about=''
  xmlns:photoshop='http://ns.adobe.com/photoshop/1.0/'>
  <photoshop:Headline>060e2b34-0401-010a-0401-020271080000</photoshop:Headline>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>
Title: Re: Copy metadata from an MXF to an XMP
Post by: StarGeek on March 29, 2021, 02:38:39 PM
Ah, I see the problem.  In your command you're copying from the original VideoCodingSchemeID tag, so it's always going to pass the value of that tag.  In order to copy from the user defined tag, you have to use the name of that new tag.  Unfortunately, you given it the same name as Headline, so that will probably cause some unexpected results.

Rename the new tag and copy from that tag
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
MyCodingScheme=> {
Require => 'VideoCodingSchemeID',
ValueConv => q{
return 'test1' if $val eq '060e2b34-0401-010a-0401-020271080000';
return 'test2 if $val eq '060e2b34-0401-010a-0401-020271080001';
# ...
return undef;
},
},
},
);
1; # end


Exiftool -Config Example.config -a -u -g1 -tagsfromfile atom.mxf "-Headline<MyCodingScheme" atom.xmp
Title: Re: Copy metadata from an MXF to an XMP
Post by: javiavid on March 30, 2021, 02:52:24 AM
Thank you, although the problem continues ..

Warning: No writable tags set from atom.mxf
    0 image files updated
    1 image files unchanged


If you need it, I can send you the MXF file.