ffprobe.py 398 B

123456789101112131415
  1. #!/usr/bin/env python
  2. import os
  3. import subprocess
  4. import json
  5. file = input("File: ")
  6. command = f"ffprobe -v quiet -print_format json -show_format -show_streams \"{file}\""
  7. data = subprocess.getoutput(command)
  8. print(data)
  9. data = json.loads(data)
  10. print(data["streams"][0]["codec_name"])
  11. print(data["streams"][0]["codec_type"])
  12. print(f'{data["streams"][0]["width"]}x{data["streams"][0]["height"]}')