Last active
          June 12, 2024 16:38 
        
      - 
      
- 
        Save matiaslopezd/67ec0185c4aac8a13e2bed2085565e1d to your computer and use it in GitHub Desktop. 
    Extract video metadata in 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 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) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Remember to install: