From: "jonforums (Jon Forums)" Date: 2012-09-28T10:33:50+09:00 Subject: [ruby-core:47718] [ruby-trunk - Bug #7070] sometimes backticks can fail to return data Issue #7070 has been updated by jonforums (Jon Forums). While I'm interested in discovering root cause on this, ffmpeg enumerates directshow devices like http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavdevice/dshow.c;h=120ddd9a64ddfb0eaeaa128eee5600e88d42efb0;hb=HEAD#l252 Looks like COM-in-C. Perhaps you've already tried, but does win32ole + wmi enable you to directly enumerate the video and audio devices? ---------------------------------------- Bug #7070: sometimes backticks can fail to return data https://bugs.ruby-lang.org/issues/7070#change-29768 Author: rogerdpack (Roger Pack) Status: Open Priority: Normal Assignee: Category: Target version: ruby -v: ruby 1.9.3p194 (2012-04-20) [i386-mingw32] 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! -- http://bugs.ruby-lang.org/