Trying to use Hachoir to extract metadata from a video file. It works well enough unless you use "get" or the like to return the width and height values.
I assumed this would be:
metadata.get('width')
But this causes an error (the object does not have a 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 information from the General group.
When i use:
metadata.exportPlaintext
... information from "Common", "Video stream" and "Audio stream" is returned. I could just parse the resulting “text” and cross out the values for height and width, but I would rather try to do it right using metadata.get ('width') or similar.
After looking at the source code, I thought I could use the following:
for key, metadata in metadata.__groups.iteritems():
To iterate through ._groups in metadata, but then throw away the “AsfMetadata” object, it does not have the “_groups” attribute, which I'm sure should not be the way I thought, “AsfMetadata” was a subclass of MultipleMetadata (), which has such a variable.
Probably missing something completely obvious.
source share