代码改变世界

python3 subprocess 内存操作视频转换流格式

2017-11-06 14:46  夏洛克·福尔摩斯  阅读(728)  评论(0编辑  收藏  举报

import subprocess
out = open('./tmp/sss.mp4','rb').read()
p = subprocess.Popen(["./ffmpeg","-i","-","-ac","1","-ar", "8000","-f","wav","-"] , stdin=subprocess.PIPE,stdout=subprocess.PIPE)
voice = p.communicate(input = out)[0]