drewnoakes / metadata-extractor

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Apache License 2.0
2.57k stars 482 forks source link

Canon CR3 files reporting incorrect Focus Distance values #605

Open johnbaro opened 1 year ago

johnbaro commented 1 year ago

Per this sample image, the values below show as zero, whereas the correct values are reported by exiftool

metadata-extractor

[Canon Makernote] Focus Distance Upper - 0
[Canon Makernote] Focus Distance Lower - 0

exiftool

Focus Distance Upper            : 0.95 m
Focus Distance Lower            : 0.94 m

I'd be happy to help out on this given some guidance as to where issue is occurring.

drewnoakes commented 1 year ago

Those tags are defined in:

https://github.com/drewnoakes/metadata-extractor/blob/5754a0d33659e6b1e9d8f35cf24bc03e0fbaf1b6/Source/com/drew/metadata/exif/makernotes/CanonMakernoteDirectory.java#L348-L349

Certain Canon makernote values have logic to present their values in:

https://github.com/drewnoakes/metadata-extractor/blob/5754a0d33659e6b1e9d8f35cf24bc03e0fbaf1b6/Source/com/drew/metadata/exif/makernotes/CanonMakernoteDescriptor.java#L47

It looks like there's no specific handling for those tags, so one idea would be to add them.

However I'm unclear whey we're showing a zero here. The first step would be to run in a debugger and identify what value was read from the backing data. It's possible the code that reads data into the CanonMakernoteDirectory is faulty here.

johnbaro commented 1 year ago

Thanks @drewnoakes, I did run a debugger through and saw they were zero but didn't get further than that due to time.
I'll do a deeper dive shortly.