Bug #7070
closedsometimes backticks can fail to return data
Description
Basically, if you have ffmpeg for windows, ex: http://ffmpeg.zeranoe.com/builds
Then run it like this:
enum = ffmpeg.exe -list_devices true -f dshow -i dummy 2>&1
"every so often" the value returned is "" (presumably in error).
Example:
39 times you'll get this:
enum =
temp\\ffmpeg.exe -list_devices true -f dshow -i dummy 2>&1
=> "ffmpeg version N-44123-g5d55830 Copyright (c) 2000-2012 the FFmpeg developers\n built on Sep 2 2012 20:23:29 with gcc 4.7.1 (GCC)\n configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib\n libavutil 51. 70.100 / 51. 70.100\n libavcodec 54. 55.100 / 54. 55.100\n libavformat 54. 25.104 / 54. 25.104\n libavdevice 54. 2.100 / 54. 2.100\n libavfilter 3. 15.102 / 3. 15.102\n libswscale 2. 1.101 / 2. 1.101\n libswresample 0. 15.100 / 0. 15.100\n libpostproc 52. 0.100 / 52. 0.100\n[dshow @ 003cc3a0] DirectShow video
devices\n[dshow @ 003cc3a0] "screen-capture-recorder"\n[dshow @ 003cc3a0] DirectShow audio devices\n[dshow @ 003cc3a0] "Microphone (USB Audio Device)"\n[dshow @ 003cc3a0] "virtual-audio-capturer"\ndummy: Immediate exit requested\n"
irb(main):036:0> enum =temp\\ffmpeg.exe -list_devices true -f dshow -i dummy 2>&1
then the 40th will be
enum =
temp\\ffmpeg.exe -list_devices true -f dshow -i dummy 2>&1
=> ""
Running using C's "popen" seems to work reliably.
https://gist.github.com/3784971
I would note that jruby seems to suffer from the same difficulty for whatever reason. Running it with other executables
Thanks!