Capture Video from USB Grabber using ffmpeg on Windows 10 Command Line

Find out the capabilities of the grabber using the following command:

cd c:\program files\ffmpeg\bin
ffmpeg  -f dshow  -list_devices true -i dummy

This will produce a list of devices on the system like:

C:\Program Files\ffmpeg\bin>ffmpeg  -f dshow  -list_devices true -i dummy
ffmpeg version N-85750-ga75ef15 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 93.100 / 57. 93.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 88.100 /  6. 88.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[dshow @ 0000000000eb6400] DirectShow video devices (some may be both video and audio devices)
[dshow @ 0000000000eb6400]  "Microsoft® LifeCam Cinema(TM)"
[dshow @ 0000000000eb6400]     Alternative name "@device_pnp_\\?\usb#vid_045e&pid_075d&mi_00#6&24444fbd&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 0000000000eb6400]  "USB2.0 Grabber"
[dshow @ 0000000000eb6400]     Alternative name "@device_pnp_\\?\usb#vid_05e1&pid_0408&mi_00#6&3829e82&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\{77e95fd6-7a3d-4f69-9723-582a8dd5c0a1}"
[dshow @ 0000000000eb6400] DirectShow audio devices
[dshow @ 0000000000eb6400]  "Desktop Microphone (3- Microsoft® LifeCam Cinema(TM))"
[dshow @ 0000000000eb6400]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{59A9B105-DBCD-4397-BA77-C2C9E12AE0DE}"
[dshow @ 0000000000eb6400]  "Digital Audio Interface (USB Audio Interface)"
[dshow @ 0000000000eb6400]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{1E77847A-3A5B-49C7-AAF1-9A74B1771A9B}"

Here we can see a system with “USB2.0 Grabber” and a “Microsoft┬« LifeCam Cinema(TM)” webcam.

To get the capabilities of a device use:

ffmpeg  -f dshow  -list_options true -i video="USB2.0 Grabber"

This will return the capabilities of the named device “USB2.0 Grabber” in this instance. This happens to be a STK1160 USB video interface.

C:\Program Files\ffmpeg\bin>ffmpeg  -f dshow  -list_options true -i video="USB2.0 Grabber"
ffmpeg version N-85750-ga75ef15 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 93.100 / 57. 93.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 88.100 /  6. 88.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[dshow @ 00000000000b6420] DirectShow video device options (from video devices)
[dshow @ 00000000000b6420]  Pin "Capture" (alternative pin name "0")
[dshow @ 00000000000b6420]   pixel_format=uyvy422  min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 00000000000b6420]   pixel_format=uyvy422  min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 00000000000b6420]   pixel_format=uyvy422  min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 00000000000b6420]   pixel_format=uyvy422  min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 00000000000b6420]   pixel_format=uyvy422  min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 00000000000b6420]   pixel_format=uyvy422  min s=720x480 fps=5 max s=720x480 fps=30
[dshow @ 00000000000b6420]   pixel_format=uyvy422  min s=720x576 fps=5 max s=720x576 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuyv422  min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuyv422  min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuyv422  min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuyv422  min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuyv422  min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuyv422  min s=720x480 fps=5 max s=720x480 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuyv422  min s=720x576 fps=5 max s=720x576 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuv420p  min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuv420p  min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuv420p  min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuv420p  min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 00000000000b6420]   pixel_format=yuv420p  min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 00000000000b6420]   pixel_format=bgr24  min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 00000000000b6420]   pixel_format=bgr24  min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 00000000000b6420]   pixel_format=bgr24  min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 00000000000b6420]   pixel_format=bgr24  min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 00000000000b6420]   pixel_format=bgr24  min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 00000000000b6420]   pixel_format=bgr24  min s=720x480 fps=5 max s=720x480 fps=30
[dshow @ 00000000000b6420]   pixel_format=bgr24  min s=720x576 fps=5 max s=720x576 fps=30
[dshow @ 00000000000b6420] Crossbar Switching Information for USB2.0 Grabber:
[dshow @ 00000000000b6420]   Crossbar Output pin 0: "Video Decoder" related output pin: 1 current input pin: 0 compatible input pins: 0 1
[dshow @ 00000000000b6420]   Crossbar Output pin 1: "Audio Decoder" related output pin: 0 current input pin: 4 compatible input pins: 3 4
[dshow @ 00000000000b6420]   Crossbar Input pin 0 - "Video Composite" related input pin: 4
[dshow @ 00000000000b6420]   Crossbar Input pin 1 - "S-Video" related input pin: 4
[dshow @ 00000000000b6420]   Crossbar Input pin 2 - "Video Tuner" related input pin: 3
[dshow @ 00000000000b6420]   Crossbar Input pin 3 - "Audio Tuner" related input pin: 2
[dshow @ 00000000000b6420]   Crossbar Input pin 4 - "Audio Line" related input pin: 0

You can then grab the video using a chosen format using something like:

"C:\program files\ffmpeg\bin\ffmpeg.exe" -f dshow -pixel_format yuv420p  -video_size 640x480 -i video="USB2.0 Grabber":audio="Digital Audio Interface (USB Audio Interface)" c:\data\video.mp4

This command saves the captured data to a file c:\data\video.mp4 using the Video grabber “USB2.0 Grabber” and the audio interface “Digital Audio Interface (USB Audio Interface)” using the video format yuv420p with a video size of 640×480 pixels using direct show.

Leave a Reply