A Raspberry Pi surveillance camera can be a cheap alternative to common variants like IP cameras. An ideal Raspberry Pi camera module represents normal webcams that can be used as well, connected via USB.
This tutorial shows how to use a webcam with the help of the software fswebcam. In addition, I show different settings for the perfect result.
Accessories
Only the following things are needed:
- Raspberry Pi (internet access is required to view images everywhere, so it does not work with Model A)
- USB Webcam (the price does not matter, you can also take the cheapest model. Almost all webcams are recognized.)
It’s best to connect the webcam before starting the Pi via USB. We use the software fswebcam, which recognizes almost all webcams. First we install it:
sudo apt-get install fswebcam
Everything is set up automatically. You can already take a picture now. With
fswebcam image.jpg
you will take a picture named “image.jpg” in the directory where the shell is currently located (for example, main directory). If you are connected via SSH you will not be able to view the image immediately, you must connect via FTP (instructions here) and open the corresponding image. If you work directly on the Pi, you can just open the directory and view the picture.
Other Commands – Raspberry Pi Security Camera
You have certainly noticed the bar with the date below. You can remove this by specifying the following option:
fswebcam --no-banner image.jpg
The resolution is also very easy to change. For this, however, you should pay attention to the resolution of your camera, so as not to get a distorted picture:
fswebcam -r 480x320 image.jpg
Another useful command is to skip the first frame, as the webcam will usually adjust brightness, etc. You can also skip multiple frames, but it takes longer to record:
fswebcam --skip 1 image.jpg
Of course, you can also combine these and other commands, e.g.:
fswebcam --no-banner -r 480x320 --skip 1 image.jpg
PS: If you have several webcams connected, you can choose the device from which the picture should be taken:
fswebcam --device /dev/video0 image.jpg
You can find the number by means of fswebcam –list-inputs (under “available inputs” is the number and the name).
6 Comments
This is not at all a security camera! Waste o time..
This isn’t a webcam, it’s a digital still camera.
I want to be able to show continuous video on my 3.5″ GPIO screen.
Me too, is it possible???
Ruud.
check motion library for raspberry pi
nice tool, organized with a CronTab, and upload to a FTP server, it do the job, no need more 🙂
“USB Webcam* (the price does not matter, you can also take the cheapest model. Almost all webcams are recognized.)”
I bought cheapest cam and does not work. Not recognized. Also no on my PC, Windows & Linux. So not all work. Now I found this list, maybe that helps: https://elinux.org/RPi_USB_Webcams