ffmpeg - Python - second subprocess won't open if sys.argv containts "&" character -


i've got python script download video using youtube-dl , extract frames using ffmpeg. code:

def downloadvideo():     output_file = "/users/francesco/desktop/source/%(title)s-%(id)s.%(ext)s"     check_call(["youtube-dl","--output", output_file, "--restrict-filenames", "-f", "best", sys.argv[1]])  def convertvideo(video):     dest = "/users/francesco/desktop/output"     source = "/users/francesco/desktop/source"     ffmpeg_path = "/users/francesco/desktop/ffmpeg/ffmpeg"     video_path = source + "/" + video     dest_path = dest + "/" + os.path.splitext(video)[0] + "-%d.png"     check_call([ffmpeg_path, "-v", "0", "-i", video_path, "-f", "image2", dest_path])  def main():     downloadvideo()     video in os.listdir("/users/francesco/desktop/source"):        convertvideo(video) 

i run command python myscript.py myvideolink , goes fine in download process, convertvideo doesn't start, frozen couple of seconds , program exits.

if try run same command skipping downloadvideo() (with video downloaded in folder) doens't work too, if use python myscript.py without argv[1], ffmpeg process works! why happens?

update: i've tried remove -v 0 option in ffmpeg see happens, ffmpeg process starts, frozen this:

ffmpeg version 2.6.2 copyright (c) 2000-2015 ffmpeg developers   built llvm-gcc 4.2.1 (llvm build 2336.11.00)   configuration: --prefix=/volumes/ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect   libavutil      54. 20.100 / 54. 20.100   libavcodec     56. 26.100 / 56. 26.100   libavformat    56. 25.101 / 56. 25.101   libavdevice    56.  4.100 / 56.  4.100   libavfilter     5. 11.102 /  5. 11.102   libswscale      3.  1.101 /  3.  1.101   libswresample   1.  1.100 /  1.  1.100   libpostproc    53.  3.100 / 53.  3.100 

update 2: turns out happens when argument (which link) contains character "&". knows why problem ffmpeg? he's not neither using arg variable...

my guess you're specifying output location exists, , ffmpeg asking wether want overwrite file or not, waiting "y" (or else, mean no) on stdin. prevent doing so, use "-y" option, prevents asking question , force-overwrites output file.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -