Skip to content

Instantly share code, notes, and snippets.

@ToshY
Last active May 7, 2020 19:50
Show Gist options
  • Save ToshY/69483e4c99ab69ac28960cf85ed78436 to your computer and use it in GitHub Desktop.
Save ToshY/69483e4c99ab69ac28960cf85ed78436 to your computer and use it in GitHub Desktop.
FFprobe file metadata (Python 3.x)
# Use FFprobe to get file metadata, e.g. streams, tags, etc., in JSON format
import json
import subprocess as sp
def get_file_metadata(input_file):
return json.loads(sp.check_output(["ffprobe","-v","quiet","-print_format","json","-show_streams","-show_format",input_file]).decode('utf-8'))
file_metadata = get_file_metadata(r"D:\hello_world.mp4")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment