I want to add new custom metadata tags in keys section of .mov

Started by johndunce, October 29, 2023, 05:13:15 PM

Previous topic - Next topic

johndunce

I am trying to add a few new metadata tags that will be added to the keys section of .mov video files.

None of the tags are writable so I decided to make a config file:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Keys' => {
        HW => 'HW',
        Bitrate => 'Bitrate',
        Maxrate => 'Maxrate',
        Source => 'Source',
        TelsReencode => 'TelsReencode',
        WriterType => 'WriterType',
        Encoder => 'Encoder',
    },
);

However, when I run my code I get these errors:

D:\path>exiftool -config "C:\Windows\new.ExifTool_config" -keys:BitRate="5000 kbps" -MaxRate="6000 kbps" -Source="Camera" -TelsReencode="Yes" -WriterType="AVC" -Encoder="x264" IMG_0294.mov
Can't find table Image::ExifTool::Keys
Warning: Sorry, keys:BitRate doesn't exist or isn't writable
Can't find table Image::ExifTool::Keys
Warning: Sorry, MaxRate is not writable
Can't find table Image::ExifTool::Keys
Can't find table Image::ExifTool::Keys
Warning: Sorry, TelsReencode is not writable
Can't find table Image::ExifTool::Keys
Warning: Sorry, WriterType is not writable
Can't find table Image::ExifTool::Keys
    1 image files updated

It isn't working at all. I need these specific tags to go in the keys section of .mov files.

Any help?

Phil Harvey

Quote from: johndunce on October 29, 2023, 05:13:15 PMCan't find table Image::ExifTool::Keys

It should be Image::ExifTool::QuickTime::Keys.

Also, if the tag name is the same as the ID, then you can just do this:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::QuickTime::Keys' => {
        HW => { },
        Bitrate => { },
        Maxrate => { },
        Source => { },
        TelsReencode => { },
        WriterType => { },
        Encoder => { },
    },
);

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

johndunce

Quote from: Phil Harvey on October 29, 2023, 05:31:32 PM
Quote from: johndunce on October 29, 2023, 05:13:15 PMCan't find table Image::ExifTool::Keys

It should be Image::ExifTool::QuickTime::Keys.

Also, if the tag name is the same as the ID, then you can just do this:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::QuickTime::Keys' => {
        HW => { },
        Bitrate => { },
        Maxrate => { },
        Source => { },
        TelsReencode => { },
        WriterType => { },
        Encoder => { },
    },
);

- Phil

Thanks, this worked perfectly.

Is it possible to change the order of the tags when viewed in exiftool? For example so that HW is first, followed by Bitrate, and so on. It's not exactly matching the way it is in the config file.

Not sure if that is possible.

Phil Harvey

The tags are extracted in the order you specify on the command line.  If you don't specify, then generally they are extracted in the order found in the file, but you may use the -sort option to sort them alphabetically.

When writing, Keys are added in alphabetical order if writing multiple keys at the same time, after any Keys that already exist in the file.

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