Inconsistent warnings about "Tag not defined"

Started by scfc, May 14, 2025, 09:40:07 AM

Previous topic - Next topic

scfc

With Fedora 41's exiftool 13.10 and current Git HEAD (commit eeeb377653f5b178cc613b866b54257eaa613ea0, my $version = '13.29';), I get inconsistent warnings about "Tag not defined":

$ PERL5LIB=./blib/lib:./blib/arch \
> /usr/bin/perl ./exiftool \
> -q -userParam MaximumLength=640 \
> -if '(defined ($SourceImageWidth) ? $SourceImageWidth : $ImageWidth) > $MaximumLength || ($SourceImageHeight || $ImageHeight) > $MaximumLength' \
> -p '$Filename' \
> ./t/images/ASF.wmv \
> ./t/images/DV.dv \
> ./t/images/Flash.flv \
> ./t/images/M2TS.mts \
> ./t/images/MP3.mp3 \
> ./t/images/Matroska.mkv \
> ./t/images/Pentax.avi \
> ./t/images/QuickTime.mov \
> ./t/images/RIFF.avi
DV.dv
Warning: [Minor] Tag 'SourceImageWidth' not defined - ./t/images/DV.dv
M2TS.mts
Warning: [minor] The ExtractEmbedded option may find more tags in the video data - ./t/images/M2TS.mts
Matroska.mkv
Warning: [Minor] Tag 'SourceImageWidth' not defined - ./t/images/Matroska.mkv
Pentax.avi
Warning: [Minor] Tag 'SourceImageWidth' not defined - ./t/images/Pentax.avi
$

There are two confusing aspects here:

  • Even though for example t/images/ASF.wmv and t/images/MP3.mp3 have no tag SourceImageWidth, no warning is triggered for these files.
  • The warning is triggered for $SourceImageWidth (despite being "guarded" by a defined()), but not for ("unguarded") $SourceImageWidth.

Even more bizarre, a non-existing tag used later "cancels" the warning:

$ PERL5LIB=./blib/lib:./blib/arch \
> /usr/bin/perl ./exiftool \
> -q -userParam MaximumLength=640 \
> -if '($SourceImageWidth || $DoesNotExist) > $MaximumLength || ($SourceImageHeight || $ImageHeight) > $MaximumLength' \
> -p '$Filename' \
> ./t/images/ASF.wmv \
> ./t/images/DV.dv \
> ./t/images/Flash.flv \
> ./t/images/M2TS.mts \
> ./t/images/MP3.mp3 \
> ./t/images/Matroska.mkv \
> ./t/images/Pentax.avi \
> ./t/images/QuickTime.mov \
> ./t/images/RIFF.avi
$

StarGeek

#1
One additional thing. It happens with the -p (-printFormat) option, but not if you list the tag.

C:\>exiftool  -q -userParam MaximumLength=640  -if "(defined ($SourceImageWidth) ? $SourceImageWidth : $ImageWidth) > $MaximumLength || ($SourceImageHeight || $ImageHeight) > $MaximumLength"  -p "$Filename"  ./t/images/ASF.wmv  ./t/images/DV.dv  ./t/images/Flash.flv  ./t/images/M2TS.mts  ./t/images/MP3.mp3  ./t/images/Matroska.mkv  ./t/images/Pentax.avi  ./t/images/QuickTime.mov  ./t/images/RIFF.avi
DV.dv
Warning: [Minor] Tag 'SourceImageWidth' not defined - ./t/images/DV.dv
M2TS.mts
Warning: [minor] The ExtractEmbedded option may find more tags in the video data - ./t/images/M2TS.mts
Matroska.mkv
Warning: [Minor] Tag 'SourceImageWidth' not defined - ./t/images/Matroska.mkv
Pentax.avi
Warning: [Minor] Tag 'SourceImageWidth' not defined - ./t/images/Pentax.avi

C:\>exiftool -q -userParam MaximumLength=640  -if "(defined ($SourceImageWidth) ? $SourceImageWidth : $ImageWidth) > $MaximumLength || ($SourceImageHeight || $ImageHeight) > $MaximumLength"  -filename ./t/images/ASF.wmv  ./t/images/DV.dv  ./t/images/Flash.flv  ./t/images/M2TS.mts  ./t/images/MP3.mp3  ./t/images/Matroska.mkv  ./t/images/Pentax.avi  ./t/images/QuickTime.mov  ./t/images/RIFF.avi
File Name                       : DV.dv
File Name                       : M2TS.mts
File Name                       : Matroska.mkv
File Name                       : Pentax.avi

I narrowed it down to a change in version 12.60
C:\>exiftool_12.59 -q -userParam MaximumLength=640  -if "(defined ($SourceImageWidth) ? $SourceImageWidth : $ImageWidth) > $MaximumLength || ($SourceImageHeight || $ImageHeight) > $MaximumLength"  -p "$Filename"  ./t/images/ASF.wmv  ./t/images/DV.dv  ./t/images/Flash.flv  ./t/images/M2TS.mts  ./t/images/MP3.mp3  ./t/images/Matroska.mkv  ./t/images/Pentax.avi  ./t/images/QuickTime.mov  ./t/images/RIFF.avi
DV.dv
M2TS.mts
Warning: [minor] The ExtractEmbedded option may find more tags in the video data - ./t/images/M2TS.mts
Matroska.mkv
Pentax.avi

C:\>exiftool_12.60 -q -userParam MaximumLength=640  -if "(defined ($SourceImageWidth) ? $SourceImageWidth : $ImageWidth) > $MaximumLength || ($SourceImageHeight || $ImageHeight) > $MaximumLength"  -p "$Filename"  ./t/images/ASF.wmv  ./t/images/DV.dv  ./t/images/Flash.flv  ./t/images/M2TS.mts  ./t/images/MP3.mp3  ./t/images/Matroska.mkv  ./t/images/Pentax.avi  ./t/images/QuickTime.mov  ./t/images/RIFF.avi
DV.dv
Warning: [Minor] Tag 'SourceImageWidth' not defined - ./t/images/DV.dv
M2TS.mts
Warning: [minor] The ExtractEmbedded option may find more tags in the video data - ./t/images/M2TS.mts
Matroska.mkv
Warning: [Minor] Tag 'SourceImageWidth' not defined - ./t/images/Matroska.mkv
Pentax.avi
Warning: [Minor] Tag 'SourceImageWidth' not defined - ./t/images/Pentax.avi

It might be this (Notes on v12.60)
QuoteFixed handling of undefined tags in -if conditions to conform with documentation and match -p and -tagsFromFile behaviour when -m or -f option is used

I recall there was a thread that led to this change.

Edit: Found the thread. But I'm not sure if this is the problem or not, as neither -f (-ForcePrint) option or -m (-ignoreMinorErrors) option are used in this command.
"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

Phil Harvey

Thanks for this report, I'll have to look into this.

StarGeek is correct.  The change in version 12.60 is responsible for this.

Part of the inconsistency is explained due to the fact that the warning isn't issued for files that fail the -if condition.

This will take some time to sort out.

- 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

Version 13.30 will include a patch to remove the warning for undefined tags in a -if condition.

The reason for this warning was to inform the user that the -m option could be used to set the undefined values to an empty string, but as you point out the warning was emitted inconsistently, and I can't see a better way to fix this, so the user will just have to be aware of this feature.  (It is mentioned in the -m option documentation.)

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