Main Menu

Guano Metadata

Started by Conrad Vispo, May 15, 2023, 10:04:57 AM

Previous topic - Next topic

Conrad Vispo

Cool. Once the new EXIFtool is out and Mario can include it in the next IMatch iteration, we'll see where we are at. Thanks again.

Mac2

Quote from: StarGeek on May 22, 2023, 10:56:45 AMDon't worry, I already have one written.  It's basically just a regex match against the block of text.  Then copy/paste that for every line.
Awesome. I'll give this a try with the sample images I have once the .63 release is out.
May take some time, 150% busy with the final stage of IMatch 2023 and all that's involved in shipping the new release.

StarGeek

Quote from: Conrad Vispo on May 22, 2023, 08:37:18 PMCool. Once the new EXIFtool is out and Mario can include it in the next IMatch iteration, we'll see where we are at.

I think all you would have to do is update the version of exiftool that IMatch is using in C:\Program Files\photools.com\imatch6, and then Preferences->Metadata 2->Tag Manager, though I could be wrong
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StarGeek

Here's the config file.  From the example file, I took the text from before the colon as the name with a "Guano" prefix.  Everything after the colon and spaces is the value.

#------------------------------------------------------------------------------
# File:         Guano.config
#
# Description:  User-defined Composite tag definitions to extract individual entries
#               from the RIFF:Guano text block.
#
#               Requires exiftool version 12.63+
#
#               See GUANO - Grand Unified Acoustic Notation Ontology
#               https://github.com/riggsd/guano-spec/blob/master/guano_specification.md
#
#               The code itself is simply a regex match.  If other entries are needed,
#               then all that needs to be done is to copy/paste one of the blocks, change
#               the name and edit the regex
#
# Examples:
#               This will list the Make and Model from the Guano text block, if they exist
#               exiftool -config Guano.config -GuanoModel -GuanoMake /path/to/files/
#
#               Lists all the Guano entries in the Guano text block
#               exiftool -config Guano.config -Guano* /path/to/files/
#
# Revisions:    2023/06/09 - Bryan K. Williams (aka StarGeek) Created
#------------------------------------------------------------------------------

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        GuanoVersion => {
        Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/GUANO\|Version:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoMake => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Make:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoModel => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Model:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoFirmwareVersion => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Firmware Version:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoSerial => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Serial:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoTimestamp => {
            Require => {
                0 => 'Guano',
            },
            Groups => { 2 => 'Time' },
            PrintConv => '$self->ConvertDateTime($val)',
            ValueConv => q{
                return (($val[0]=~m/Timestamp:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoLocPosition => {
            Require => {
                0 => 'Guano',
            },
            Groups => { 2 => 'Location' },
            ValueConv => q{
                return (($val[0]=~m/Loc Position:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoLocElevation => {
            Require => {
                0 => 'Guano',
            },
            Groups => { 2 => 'Location' },
            ValueConv => q{
                return (($val[0]=~m/Loc Elevation:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoTemperatureInt => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Temperature Int:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoFilterHP => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/^Filter HP:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoAnabatBatteryVoltage => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Anabat\|Battery voltage:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoAnabatMicrophone => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Anabat\|Microphone:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoAnabatActivation => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Anabat\|Activation:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoAnabatZcSensitivity => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Anabat\|Zc Sensitivity:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoAnabatTriggerMinFreq => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Anabat\|Trigger min freq:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoAnabatTriggerMaxFreq => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Anabat\|Trigger max freq:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoAnabatMinEvent => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Anabat\|Min event:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoAnabatTriggerWindow => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Anabat\|Trigger Window:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoAnabatMaximumFileDuration => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Anabat\|Maximum File Duration:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoSBVersion => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/SB\|Version:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoSBSpeciesAutoID => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/SB\|Species Auto ID:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoSpeciesAutoID => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Species Auto ID:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoSpeciesManualID => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Species Manual ID:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoSampleRate => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Samplerate:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoLength => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Length:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoTE => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/TE:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoSBFilterHP => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/SB\|Filter HP:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoNote => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/Note:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoSBRegion => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/SB\|Region:\s+(.*)/m)) ? $1 : undef;
            },
        },
        GuanoSBClassifier => {
            Require => {
                0 => 'Guano',
            },
            ValueConv => q{
                return (($val[0]=~m/SB\|Classifier:\s+(.*)/m)) ? $1 : undef;
            },
        },
    },
);
#------------------------------------------------------------------------------
1;  #end

Example output
C:\>exiftool -config Guano.config -G1 -a -s -Guano* us_2023-04-13_20-45-02.wav
[RIFF]          Guano                           : GUANO|Version:  1.0.Make:  Titley Scientific.Model:  Anabat Express FS.Firmware Version:  Sonic v2.4.5.23030.Serial:  660081.Timestamp:  2023-04-13T20:45:02.Loc Position:  42.360092 -73.592216.Loc Elevation:  203.3.Temperature Int:  26.0.Filter HP:  10.00.Anabat|Battery voltage:  5.06.Anabat|Microphone:  Ultrasonic.Anabat|Activation:  Triggered.Anabat|Zc Sensitivity:  18.Anabat|Trigger min freq:  15000.Anabat|Trigger max freq:  250000.Anabat|Min event:  2.Anabat|Trigger Window:  2000.Anabat|Maximum File Duration:  10000.SB|Version:  4.4.5.SB|Species Auto ID:  noID.Species Auto ID:  noID.Species Manual ID:  .Samplerate:  500000.Length:  0.0.TE:  .SB|Filter HP:  0.Note:  .SB|Region:  Northeastern NA.SB|Classifier:  northeastern US..
[Composite]     GuanoAnabatActivation           : Triggered
[Composite]     GuanoAnabatBatteryVoltage       : 5.06
[Composite]     GuanoAnabatMaximumFileDuration  : 10000
[Composite]     GuanoAnabatMicrophone           : Ultrasonic
[Composite]     GuanoAnabatMinEvent             : 2
[Composite]     GuanoAnabatTriggerMaxFreq       : 250000
[Composite]     GuanoAnabatTriggerMinFreq       : 15000
[Composite]     GuanoAnabatTriggerWindow        : 2000
[Composite]     GuanoAnabatZcSensitivity        : 18
[Composite]     GuanoFilterHP                   : 10.00
[Composite]     GuanoFirmwareVersion            : Sonic v2.4.5.23030
[Composite]     GuanoLength                     : 0.0
[Composite]     GuanoLocElevation               : 203.3
[Composite]     GuanoLocPosition                : 42.360092 -73.592216
[Composite]     GuanoMake                       : Titley Scientific
[Composite]     GuanoModel                      : Anabat Express FS
[Composite]     GuanoNote                       : SB|Region:  Northeastern NA
[Composite]     GuanoSBClassifier               : northeastern US
[Composite]     GuanoSBFilterHP                 : 0
[Composite]     GuanoSBRegion                   : Northeastern NA
[Composite]     GuanoSBSpeciesAutoID            : noID
[Composite]     GuanoSBVersion                  : 4.4.5
[Composite]     GuanoSampleRate                 : 500000
[Composite]     GuanoSerial                     : 660081
[Composite]     GuanoSpeciesAutoID              : noID
[Composite]     GuanoSpeciesManualID            : Samplerate:  500000
[Composite]     GuanoTE                         : SB|Filter HP:  0
[Composite]     GuanoTemperatureInt             : 26.0
[Composite]     GuanoTimestamp                  : 2023-04-13T20:45:02
[Composite]     GuanoVersion                    : 1.0
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Mac2

Hi, StarGeek
thanks for the support here and the configuration file.
I've just installed the 12.63 edition of ExifTool and ran it with the two sample videos provided to me by Conrad.

ExifTool imports the data into the RIFF::Main\guan\Guano tag and IMatch imports this data without problems.
As far as I know, the -config option can be used only once, and IMatch already uses this to specify its own config file, with some custom IPTC tags and options.

I have copied your configuration setup into the default config file IMatch uses and it works perfect.

Do I have your permission to include your configuration with IMatch?

I have copied a link to this thread and your Revisions info with your name and community tag into the IMatch ExifTool config file. Let me know if this is OK for you.

This is how IMatch displays the GUANO metadata in the Metadata Panel:

Image1.jpg

Phil Harvey

I'll add guano.config to the official ExifTool distribution.

Thanks StarGeek.

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

StarGeek

Quote from: Mac2 on June 11, 2023, 09:06:08 AMDo I have your permission to include your configuration with IMatch?

Anything I post here I consider to be public domain, to be freely spread, edited, folded, spindled, mutilated as desired.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Mac2


StarGeek

Quote from: Phil Harvey on June 11, 2023, 09:33:55 AMI'll add guano.config to the official ExifTool distribution.

One quick edit I feel should be done first, but I can't really figure it out on my own.

The Loc Position is a GPS coordinate, Lat & Long separated by a space.
        GuanoLocPosition => {
            Require => {
                0 => 'Guano',
            },
            Groups => { 2 => 'Location' },
            ValueConv => q{
                return (($val[0]=~m/Loc Position:\s+(.*)/m)) ? $1 : undef;
            },
        },

How would this be changed so that the numbers are affected by the -c (-coordFormat) option?  Do they need to be separate tags first?

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

I think this PrintConv should do it.

            PrintConv => q{
                require Image::ExifTool::GPS;
                my @v = split ' ', $val;
                return Image::ExifTool::GPS::ToDMS($self, $v[0], 1, "N") . ', ' .
                       Image::ExifTool::GPS::ToDMS($self, $v[1], 1, "E");
            },

Attached is a slightly cleaned up config file with this addition.

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

Conrad Vispo

Mario did a great job of integrating this into IMatch. I had one follow-up question - ExifTool reports the GUANO metadata as read-only, and so they can't be edited within IMatch, is this necessary or could it be opened in an editable way? The data can of course be edited in the bat-call specific software, but being able to also edit it from within IMatch would add flexibility.

Thanks,
Conrad.

StarGeek

The original file was a wav file and exiftool cannot edit wav files
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Conrad Vispo