Closed benbou8231 closed 3 years ago
Hi, here is an example how to use Hachoir to extract metadata: https://hachoir.readthedocs.io/en/latest/developer.html#hachoir-metadata-example
I don't think that the main() function should return a value different than an exit code, but I'm open for a new API which would simply such code. I suggest to add a new function instead.
Hello,
That makes a lot of sense. I'll write a getMetadata function as soon I have a few minutes. I'll update this PR when it will be done.
Thanks
With that new function we can get a list of dictionaries with the following code:
from hachoir.metadata.main import getMetadata
getMetadata(["--raw", "C:\\myVid.mkv"])
I don't understand the use case, but I dislike the implementation. You should return a dict, not modify a global variable.
I was looking for a tool to get video metadata in Python for a project I work on. I found this thread: https://stackoverflow.com/q/51342429/5806912
So I took a look at the source, and I found an easy way to allow users to retrieve metadata within Python.
Here a snippet of how to call it with the proposed modification (might be useful for the documentation):