from subprocess import Popen, PIPE
import re
def getvideodetails(filepath):
cmd = 'ffmpeg -i %s" % filepath'
p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
di = p.communicate()
for line in di:
if line.rfind("Video") > 0:
resolution = re.findall("(\d+x\d+)", line)[0]
return resolution
getvideodetails("путь к видео")