Capture Single Frame from Webcam at the CommandLine

by Stephen Fluin 2009.06.17

This technique requires ffmpeg as well as a webcam that is properly supported under linux. For this example I will assume that your video shows up as /dev/video0, but you can check by unplugging your webcam, running ls /dev/video*, and then plug in your web cam and run it again. If a new line shows up, this will be the device representing your webcam.

To collect a single frame of video, run:

ffmpeg -t 1 -f video4linux2 -s 320x240 -i /dev/video0 -r 1 -f image2 ~/camera%05d.png