I'm trying to call simple ffmpeg command line with subprocess.call. (Example : ffmpeg -i input\\video.mp4 -r 30 input\\video.avi
)
By typing directly the ffmpeg command it works, but when I try to call it with subprocess.call : subprocess.call('ffmpeg -i input\\video.mp4 -r 30 input\\video.avi', shell=True)
there is no error, but it doesn't produce anything.
Any idea where can be the problem? (I'm working with python 3.4 or 2.7, I tried both)
Finally found the problem : when you are using subprocess you MUST use
/
for your files location instead of
\
EDIT : or you can use raw-string literals -> r'ffmpeg -i input\\video.mp4 ...'
(notice: r'') or you can double them ' \\\\
' Thanks to JF Sebastian
x=subprocess.Popen('ffmpeg -i input\video.mp4 -r 30 input\video.avi', shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
output,err=x.communicate()
if output:
print "success ",output
else:
print "error ",err
You can try this and check output and errors if any.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.