Created
December 27, 2024 02:25
-
-
Save documentprocessing/b3bd9e7708f0322defeefc17474dfdbc to your computer and use it in GitHub Desktop.
Read Metadata information using hachoir-metadata API for Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hachoir.parser import createParser | |
from hachoir.metadata import extractMetadata | |
# File to extract metadata from | |
file_path = "media_file.mp4" | |
# Create a parser for the file | |
parser = createParser(file_path) | |
if not parser: | |
print("Unable to parse file.") | |
else: | |
# Extract metadata | |
metadata = extractMetadata(parser) | |
if metadata: | |
for line in metadata.exportPlaintext(): | |
print(line) | |
else: | |
print("No metadata found.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment