decode stdout
This commit is contained in:
parent
f54cb4160e
commit
164a71ed51
1 changed files with 2 additions and 1 deletions
|
@ -168,11 +168,11 @@ def avinfo(filename, cached=True):
|
|||
p = subprocess.Popen([ffmpeg2theora, '--info', filename],
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, error = p.communicate()
|
||||
stdout = stdout.decode('utf-8')
|
||||
try:
|
||||
info = json.loads(stdout)
|
||||
except:
|
||||
# remove metadata, can be broken
|
||||
stdout = stdout.decode('utf-8')
|
||||
reg = re.compile('"metadata": {.*?},', re.DOTALL)
|
||||
stdout = re.sub(reg, '', stdout)
|
||||
info = json.loads(stdout)
|
||||
|
@ -214,6 +214,7 @@ def ffprobe(filename):
|
|||
|
||||
], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
info, error = p.communicate()
|
||||
info = info.decode('utf-8')
|
||||
ffinfo = json.loads(info)
|
||||
|
||||
def fix_value(key, value):
|
||||
|
|
Loading…
Reference in a new issue