u2takey / ffmpeg-go

golang binding for ffmpeg
Apache License 2.0
1.66k stars 167 forks source link

Problems detecting the 'video=' parameter in dshow #101

Closed AndrusGerman closed 11 months ago

AndrusGerman commented 11 months ago

I'm trying to translate the command ffmpeg -f dshow -i video="HP TrueVision HD Camera" -vframes 1 out.png to go-ffmpeg.

In the process I stay something like this

var err = ffmpeg.Input(fmt.Sprintf("video=\"%s\"", cam.cameraName), ffmpeg.KwArgs{
        "f": "dshow",
    }).Output("a.png", ffmpeg.KwArgs{
        "vframes": "1",
    }).ErrorToStdOut().Run()

But when I run this command, the library gives me this output with an error. According to the library log the command is fine but the error is strange.

go run .\cli\main.go
2023/09/25 15:09:44 compiled command: ffmpeg -f dshow -i video="HP TrueVision HD Camera" -vframes 1 a.png
ffmpeg version 6.0-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint 
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
[dshow @ 00000164ff71e200] Could not find video device with name ["HP TrueVision HD Camera"] among source devices of type video.
video="HP TrueVision HD Camera": I/O error
panic: exit status 1

goroutine 1 [running]:
main.main()
        C:/Users/andru/proyectos/gocam/cli/main.go:22 +0xce
exit status 2

The command even shows in console I run it on my own and it works, but inside the library it fails

AndrusGerman commented 11 months ago

Apparently this is solved by removing the double quotation marks from the argument. I would like this to be more explicit :(