Fswebcam

From Leo's Notes
Last edited on 14 June 2020, at 22:01.

fswebcam is a Linux utility that captures an image using a Video4Linux compatible webcam.

Usage[edit | edit source]

# fswebcam -r 640x480 --jpeg 85 -D 1 web-cam-shot.jpg

Dumping fswebcam images via HTTP[edit | edit source]

You can make a quick an dirty wrapper around the command above so that it can be viewed via the web.

<?php
system("fswebcam -r 640x480 --jpeg 85 -D 1 /tmp/out.jpg > /dev/null");
header("Content-Type: image/jpeg");
echo file_get_contents("/tmp/out.jpg");