将ffmpeg与子流程python结合使用
我试图从Witia下载视频,我设法以.bin&格式下载了它们;为了使用OpenCV,我想将它们转换为.mp4。为此,我在Python上使用subprocess调用ffmpeg,但返回代码的值为1,这意味着进程失败。知道为什么吗,我怎样才能改变这个 代码如下:将ffmpeg与子流程python结合使用,python,opencv,ffmpeg,subprocess,wistia,Python,Opencv,Ffmpeg,Subprocess,Wistia,我试图从Witia下载视频,我设法以.bin&格式下载了它们;为了使用OpenCV,我想将它们转换为.mp4。为此,我在Python上使用subprocess调用ffmpeg,但返回代码的值为1,这意味着进程失败。知道为什么吗,我怎样才能改变这个 代码如下: import subprocess infile = filename #a bin& file outfile = filename[:-7]+'mp4' subprocess.run(['ffmpeg', '-i
import subprocess
infile = filename #a bin& file
outfile = filename[:-7]+'mp4'
subprocess.run(['ffmpeg', '-i', infile, outfile],shell=True)
我得到:
CompletedProcess(args=['ffmpeg', '-i', '58c63bccfcc1c150646c261caad97a58ced4b5e3.bin&', '58c63bccfcc1c150646c261caad97a58ced4b5e3.mp4'], returncode=1)
此外,它在命令提示符下工作
谢谢你的帮助
真诚地说,试着使用Popen。我在python中使用FFmpeg,效果很好
process_ = subprocess.Popen(ffmpeg_cmd, start_new_session=True)
试着用Popen。我在python中使用FFmpeg,效果很好
process_ = subprocess.Popen(ffmpeg_cmd, start_new_session=True)
尝试删除
shell=True
。感谢您的帮助,但它似乎不起作用。。。只有我能看到命令窗口快速打开和关闭…尝试删除shell=True
。感谢您的帮助,但它似乎不起作用。。。只有我能看到命令窗口快速打开和关闭。。。