How do I "log" the M most recent images from a webcam using the command-line?

Solution 1:

Well ,why don't you try uvccapture or fswebcam both are an excellent choices.

For using uvccapture, install using sudo apt-get install uvccapture and to use uvvcaputure -m -q100 -x640 -y480 -opic.jpg where pic.jpg is the filename. Similarly install fswebcam and to use fswebcam $filename,

Solution 2:

Try using webcam. Here you find more info regarding webcam https://help.ubuntu.com/community/Webcam