I try to get resolution of a video file, and hope this code would help thanks to arionik from GitHub
from subprocess import Popen, PIPE
def getWH(pathvideofile):
in_pipe = Popen(["ffmpeg", "-i", "\"%s\"" % (pathvideofile)], stderr=PIPE)
lines = in_pipe.stderr.readlines()
for line in lines:
rx = re.compile('.+Video.+, (\d{2,4})x(\d{2,4}).+')
m = rx.match(line)
if m is not None:
w = int(m.group(1))
h = int(m.group(2))
return w, h
But get this error code:
m = rx.match(line)
TypeError: cannot use a string pattern on a bytes-like object
What it could be?
Thank you,