drewnoakes / metadata-extractor-dotnet

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Other
941 stars 167 forks source link

Support "Sequence Info" in Sony Makernote #274

Open crener opened 3 years ago

crener commented 3 years ago

I'm trying to get the bracket index from the Sony makerNote metadata but this doesn't seem to handle that or any pieces of data which aren't exposed at a root level. This seems to know ShotInfo ("SonyType1MakernoteDirectory.TagShotInfo") but it shows as "[Sony Makernote] Shot Info - [390 values]" with no way to extract the values or just the byte data?

I've gone and looked at the source and looked at the code to try and add an implementation for the 0x9400 address but (based on ShotInfo) there isn't a mechanism or preferred way of implementing this kind of extraction as it contains multiple datatypes.... Am I missing something or is this just not something that the library supports (or wants to support)? Why can't I just access this data directly and parse it myself if this doesn't currently have support for it? :)

If you're curious there is documentation on 0x9400 here: https://exiftool.org/TagNames/Sony.html#Tag9400c

drewnoakes commented 3 years ago

I've gone and looked at the source and looked at the code to try and add an implementation for the 0x9400 address but (based on ShotInfo) there isn't a mechanism or preferred way of implementing this kind of extraction as it contains multiple datatypes

Plenty of tags unpack to multiple values. In such cases we create a new directory class for them, with tags for each value.

Why can't I just access this data directly and parse it myself

You can retrieve the raw bytes from the directory. Use GetObject on the directory and pass the tag you want. You'll get a byte array back.

Of course, if you can make a pull request here so that everyone benefits, it'd be great.

It seems we already have some sample images to test with: https://github.com/drewnoakes/metadata-extractor-images/search?q=sony+%22Shot+Info%22

There are other non-Sony images with unhandled "Shot Info" tags too. We should investigate whether they have the same format or not.

crener commented 3 years ago

Ahh minor confusion here. I personally don't care about "Shot Info" I want/need "0x9400" but it doesn't have a nice name yet so is slightly more annoying to talk about... Maybe "Sequence Info" is appropriate as it's about bracketed/continuous shot information?

crener commented 3 years ago

So the preferred way of implementing this is adding a new directory entirely... but wouldn't that clutter everything cause of the large amount of random nested dictionaries that are in the Sony Makernote? (I assume it's the same in other manufacturers)

Also if I do go and figure this out when I have a minute what do you call the descriptor/dictionary class? "SonyType1MakernoteSequenceLengthDescriptor", again I had a quick look for more nested types but don't know what the projects naming conventions are in this area?

:)

drewnoakes commented 3 years ago

The proliferation of directory/descriptor classes is unfortunate, but not something we can fix without a redesign. The name you suggest makes sense to me, assuming the directory is not used in other contexts.

crener commented 3 years ago

So I've been looking at this and I think that if you moved some of the bigger makernote groups into sub groups it would make it look a lot more organised.

Olympus, Reconyx and Sony would be good candiates cause I'm looking to add around 9 more classes which are Sony specific which makes the makernote directory look huge...

drewnoakes commented 3 years ago

In general if data is "nested" (as these byte array tag values are) then we create a new directory. This means the tree of directory objects mirrors the physical structure of the data. This may be useful in future if we support writing metadata.