Display of unrecognised MakerNotes values

Started by Leonard WHYTE, June 29, 2024, 08:32:23 PM

Previous topic - Next topic

Leonard WHYTE

Phil, I have a workflow involving exiftool, and it's being upset by the presence of Unicode characters in the output from exiftool -a -u -G -H --IFD1:all, so I'm wondering whether there is already, or whether you could add, a mechanism to display the values of unrecognised MakerNotes tags as hex values rather than the "Egyptians and Smiley Faces" of Unicode characters ;) ?  Len

Phil Harvey

Hi Len,

You can use the API Filter option to filter out any characters you want.  For example, to change all characters 0x80 through 0xff to hex:

exiftool -api filter="s/([\x80-\xff])/unpack('H*',$1)/ge" ...

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

Leonard WHYTE

Thanks Phil.

However, if I understand correctly, that will filter the entire output from exiftool.

Is there perhaps a way of restricting the filtering to MakerNotes tags? Or maybe add  CharsetMakerNotes and a Unicode codepoint representation within ASCII characterset?

Len

Phil Harvey

Hi Len,

This may be possible but I would have to look into if further.

Could you give me a specific example of how you want this formatted and a sample 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 ($).

Leonard WHYTE

The Unicode approach seems quite complex, do I'm turning to your plan A. However, if $1 is set at the point where exiftool is called using this api expression, then $1 gets substituted by the shell and the filter fails. I might have to save $1, unset it, call exiftool, and then set $1 agsin.

Phil Harvey

Use single quotes if you are on Mac/Linux/PowerShell.

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

Leonard WHYTE

Still having problems.

Here's the shell command:
exiftool -api filter='s/([\x80-\xff])/unpack('\''H*'\'',$1)/ge'  -a -u -G -H -e  ./2004-12-BAESXmsBsh-DSC0799.jpg | grep '^\[MakerNotes\]'

here's its output:
[MakerNotes]    0x9001 Sony 0x9001                     : a5.8ab8df.dfdb..ll.y.ffd8],a0c4fffau.ea[...]
[MakerNotes]    0x9002 Sony 0x9002                     : .95}b6`f98aje0fffffff9@pfb3fc85ce.Opb2pfba0%92M..9290[...]
[MakerNotes]    0x9003 Sony 0x9003                     : dcdcsFReedaZf1.%.db..9a4`cfe0t`eeacSe7d1.f2d9.a4.a487{c2../9f..[...]
[MakerNotes]    0x9004 Sony 0x9004                     : .^...@.d8c4c4c4c4
[MakerNotes]    0x9005 Sony 0x9005                     : ..d8b0d8...}pV..[...]
[MakerNotes]    0x9006 Sony 0x9006                     : 988f0|b7e5b7f2$b8]e92c4bb9bb8b9292ecaaa0e595[...]
[MakerNotes]    0x9007 Sony 0x9007                     : 9v.$\ bbipe3V.e78c.88^e3d8a5.5.c5.81Lqa39hy`\b492fc88,pd8cd9eea0.9ce79cc590e2[...]
[MakerNotes]    0x9008 Sony 0x9008                     : [...]

and here's the Sony 9001 tag data as output from htmldump0

00 00 00 00
00 00 00 a5 00 00 00 1b  00 8a b8 df 00 7f df db
00 04 1a 00 00 00 00 6c  00 00 00 00 00 00 00 6c
00 01 79 07 ff 00 00 d8  00 00 5d 2c a0 c4 ff fa
75 08 ea 30 70 bc ff ff  ff fa ff 67 00 9a d7 f1
20 7d 70 00 d7 de 88 00  70 00 69 70 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00

Three questions:

1) Why is the output for the Sony 0x9001 tag truncated at the 0xea byte?
2) What does the [...] at the end of the output mean?
3) If it signifies truncation, how can I get ALL the data without truncation?

Len

PS:  I'm happy to take this direct if you would prefer.

Phil Harvey

Your quoting seems to work, but is more complex than necessary.  Try this:

exiftool -api filter='s/([\x80-\xff])/unpack("H*",$1)/ge' ...

Use -api limitlongvalues=0 to disable the value truncation.  See the API option documentation here.

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

Leonard WHYTE

Thanks Phil,

Ultimately, I went with this, to pick up your above suggestions, to treat all non-printable ASCII characters, and to expand to (0xNN) making it obvious which bytes have been processed:

exiftool -api limitlongvalues=0  -api filter='s/([\x00-\x1f\x7f-\xff])/"(0x".unpack("H*",$1).")"/ge' ...

generating, this for the Sony 9001 tag:

MakerNotes]    0x9001 Sony 0x9001                    : (0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0xa5)(0x00)(0x00)(0x00)(0x1b)(0x00)(0x8a)(0xb8)(0xdf)(0x00)(0x7f)(0xdf)(0xdb)(0x00)(0x04)(0x1a)(0x00)(0x00)(0x00)(0x00)l(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)l(0x00)(0x01)y(0x07)(0xff)(0x00)(0x00)(0xd8)(0x00)(0x00)],(0xa0)(0xc4)(0xff)(0xfa)u(0x08)(0xea)0p(0xbc)(0xff)(0xff)(0xff)(0xfa)(0xff)g(0x00)(0x9a)(0xd7)(0xf1) }p(0x00)(0xd7)(0xde)(0x88)(0x00)p(0x00)ip(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)(0x00)

Thanks so much.

Len