Skip to content

Instantly share code, notes, and snippets.

@matiaslopezd
Last active June 12, 2024 16:38
Show Gist options
  • Save matiaslopezd/67ec0185c4aac8a13e2bed2085565e1d to your computer and use it in GitHub Desktop.
Save matiaslopezd/67ec0185c4aac8a13e2bed2085565e1d to your computer and use it in GitHub Desktop.
Extract video metadata in Python
from pymediainfo import MediaInfo
import json
# Path to your video file
video_path = 'example_with_metadata.webm'
# Extract metadata
media_info = MediaInfo.parse(video_path)
# Display metadata as JSON
for track in media_info.tracks:
# Convert the track to a dictionary
if track.track_type == 'General':
print(track.dni)
print(track.name)
print(track.worker)
print(track.operation_id)
@matiaslopezd
Copy link
Author

Remember to install:

pip install pymediainfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment