Trying to use Hachoir to retrieve metadata from a video file. Working reasonably well except when using 'get' or similar to return the width and height values.
I assumed it would be:
metadata.get('width')
But this throws an error (object does not have 'width' property).
When I run the following:
for data in sorted(metadata):
if len(data.values ) > 0:
print data.key, data.values[0].value
All that is returned is the information from the "Common" Group.
When I use the:
metadata.exportPlaintext
... the information from "Common", "Video stream" and "Audio stream" is returned. I could simply parse over the resulting 'text' item and strip out the height and width values, but I would rather try to do it properly using metadata.get('width') or similar.
Looking at the source code, I thought I could use the following:
for key, metadata in metadata.__groups.iteritems():
To iterate through the ._groups in the metadata, but it then throws a "'AsfMetadata' object has no attribute '_groups' - which I'm sure shouldn't be the case as I thought 'AsfMetadata' was a subclass of MultipleMetadata() which does have such a variable.
Probably missing something quite obvious.