def device_names
      @device_names ||= begin
        names      = []
        cmd_output = ''
        count      = 0
        while cmd_output.empty? || !cmd_output.split('DirectShow')[2]
          cmd_output = system_call(ffpmeg_list_devices_cmd, true)
          count += 1
          raise 'failed to find a video capture device with ffmpeg -list_devices' if count == 5

          sleep 0.1
        end
        cmd_output.gsub!("\r\n", "\n")
        video = cmd_output.split('DirectShow')[1]

        video.lines.map do |line|
          names << Regexp.last_match(1) if line =~ /"(.+)"\n/
        end

        debug "Capturer: found #{names.length} video devices: #{names.join(', ')}"
        names
      end
    end
def device_names
      @device_names ||= begin
        names      = []
        cmd_output = ''
        count      = 0
        while cmd_output.empty? || !cmd_output.split('DirectShow')[2]
          cmd_output = system_call(ffpmeg_list_devices_cmd, true)
          count += 1
          raise 'failed to find a video capture device with ffmpeg -list_devices' if count == 5

          sleep 0.1
        end
        cmd_output.gsub!("\r\n", "\n")
        video = cmd_output.split('DirectShow')[1]

        video.lines.map do |line|
          names << Regexp.last_match(1) if line =~ /"(.+)"\n/
        end

        debug "Capturer: found #{names.length} video devices: #{names.join(', ')}"
        names
      end
    end
inspired by this code from @rdp http://tinyurl.com/y7t276bh