Using ffmpeg to take a snapshot with a webcam in Windows

I downloaded the BtbN Windows build of ffmpeg from here:

The specific file I downloaded was:

  • ffmpeg-n4.4.1-2-gcc33e73618-win64-gpl-4.4.zip (download)

I extracted the zip file, then opened a command window in the “bin” folder where ffmpeg.exe was located and took a photo with camera 0 (the default video capture device) using the following command:

ffmpeg.exe -f vfwcap -i 0 -vframes 1 out.jpg

To do the same without all the text output:

ffmpeg.exe -nostats -loglevel 0 -f vfwcap -i 0 -vframes 1 out.jpg

It should be possible to move ffmpeg.exe to whatever folder you want to take photos in.

Using DirectShow

To list available DirectShow devices:

ffmpeg -list_devices true -f dshow -i dummy

If a suitable device is listed, use that device name in the following command (instead of “Integrated Webcam”) to snap a photo from the camera:

ffmpeg -f dshow -i video="Integrated Webcam" out.jpg
Advertisement
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s