Code for How to Extract Video Metadata in Python Tutorial


View on Github

extract_media_metadata.py

import ffmpeg
import sys
from pprint import pprint # for printing Python dictionaries in a human-readable way

# read the audio/video file from the command line arguments
media_file = sys.argv[1]
# uses ffprobe command to extract all possible metadata from the media file
pprint(ffmpeg.probe(media_file)["streams"])


🕒 Limited-Time Offer!
EBook Image

Web Security Week Special! Get our Cybersecurity eBook Bundle at 40% off. Limited time only!

$68.0 $40.8