Only write to specific tag id

Started by alexmerkel, July 13, 2020, 12:34:58 PM

Previous topic - Next topic

alexmerkel

I want to write a description to a QuickTime file.
The QuickTime ItemList contains multiple tags named Description but with different ids: 'desc', 'dscp' and '©des'.
When using exiftool -ItemList:Description={} out.mp4, the description is written to both 'desc' and '©des'.

Is there a way to specify, that I only want the information to be written to one tag id, in this case 'desc'?

Thanks,
Alex

Phil Harvey

Hi Alex,

This is a bit of a mess. [Video metadata I mean]

'dscp' and 'desc' are avoided when writing, which means that they won't be created but will be updated if they already exist.

'©des' is preferred, so will be created.

To change this, you can override the Quicktime::ItemList tags with user-defined tags using this config file:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::QuickTime::ItemList' => {
        "\xa9des" => { Name => 'Description', Avoid => 1 },
        dscp => { Name => 'Description', Avoid => 1 },
        desc => { Name => 'Description' },
    },
);
1; #end


With this config file 'desc' will be created instead of '©des'.

Alternatively, you could change the names of the tags to make them different if you want to address them separately.

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

alexmerkel

Hi Phil,

works like a charm  :D

Thanks a lot,
Alex

dae65

In addition to Name and Avoid, some tags as defined in %Image::ExifTool::QuickTime::ItemList have other keys: Groups, ValueConv, PrintConv, etc. Do we need to copy and paste those additional key-value pairs into %Image::ExifTool::UserDefined{...} as well?

I was wondering if ExifTool takes default values from %Image::ExifTool::QuickTime::ItemList into account when just Name or Avoid is overriden in %Image::ExifTool::UserDefined? I couldn't tell from reading ExifTool::TagLookup::AddTags() how it would handle those.

Thanks.

Phil Harvey

Quote from: dae65 on July 22, 2020, 08:06:48 AM
In addition to Name and Avoid, some tags as defined in %Image::ExifTool::QuickTime::ItemList have other keys: Groups, ValueConv, PrintConv, etc. Do we need to copy and paste those additional key-value pairs into %Image::ExifTool::UserDefined{...} as well?

Yes.  You are overriding the tag definition, and need to include everything that you want for the new tag.

Some defaults may be specified in the table definition (like AVOID).  For ItemList tags, these defaults are:

    WRITABLE => 1,
    FORMAT => 'string',
    GROUPS => { 1 => 'ItemList', 2 => 'Audio' },


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

Phil Harvey

ExifTool 12.03 allows the tag ID to be specified as a family 7 group name, providing a better solution to this problem.  (No user-defined tags are necessary.)

ie) you would use ItemList:ID-a9des:Description, ItemList:ID-dscp:Description or ItemList:ID-desc:Description to access the specific Description tag that you want to read or write.

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

Kirill Vercetti

QuoteExifTool 12.03 allows the tag ID to be specified as a family 7 group name

Good day. What if I want to specify both the ID and the language?

This syntax doesn't work:
-ItemList:ID-desc:Description-ru="Описание на русском"

Phil Harvey

Hi Kirill,

Very good point.  The language code was messing with the tag ID match.  I'll fix this in version 12.51.

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