Forums

Run avconv console command from script

Hello,

I try to use avconv for my web-app (Django). I have to extract a thumbnail from a video file. Using the bash console, I can run:

avconv -ss 00:01:00 -i myapp/myapp/media/inputvide.mp4 -vsync 1 -t 0.01 myapp/myapp/media/videothumb.png

This works fine. When I want to use this command by script (view.py) I tried:

cmd = 'avconv -ss 00:01:00 -i '+inputfile+' -vsync 1 -t 0.01 '+outputfile
os.system(cmd)

inputfile is the path to my video and outputile is the path to my video + '.png' There are no errors thrown, but I can not find the output file anywhere in my folders?

Any ideas?

Thanks!

You're probably getting an error from the command itself. I can't see any way to get at stderr and stdout from os.system. I would suggest using subprocess and checking what is in stderr and stdout.