CHIP computer: USB webcam - take a photo and make a video
- August 20 2016
- Raspberry Pi, Cubieboard, Banana Pi, BeagleBone, Orange Pi
- 3002 Reads
- 0 Comments
Today, we use USB webcam. At first I wrote that's very easy and you can you use it for a Raspberry Pi Zero, a Raspberry Pi, a BeagleBone, an Odroid and another SBC's, where you use a debian or fork of the debian (an ubuntu, a minibian etc.). It's very simple.
Articles about the CHIP computer:
CHIP computer: first sight and comparison with Raspberry Pi Zero - pizero
CHIP computer: connection to WiFi, SSH, UART
CHIP computer: speed of USB, WiFi, current consumption and pictures from thermal image
CHIP computer: flashing OS, python, LED and blinking of LED after boot
CHIP computer: USB webcam
CHIP computer: I2C bus - AD7415 temperature sensor
How I wrote, I use debian without graphical environments. I use only a SSH connection for communication with the CHIP computer.
Hence, I was looking for program for controlling of USB webcam in a terminal.
You execute:
sudo apt-get update
sudo apt-get upgrade
And then install this program fswebcam:
sudo apt-get install fswebcam
Take a picture:
fswebcam -r 640x480 --jpeg 85 -D 1 web-cam-shot.jpg
fswebcam program name
-r resolution
640x480 resolution of webcam
--jpeg format of picture
85 quality (in percent)
D delay
1 1s delay
web-cam-shot.jpg name of picture
Another helpful tips:
--flip (direction)
--rotate (angle)
--no-banner no labels and banner in picture
Everything you find in help of program:
fswebcam --help
What next? You can connect a PIR sensor and if the PIR sensor is active, the CHIP computer takes a photo. For example.
Make a video
sudo apt-get update
sudo apt-get upgrade
Install libav-tools:
sudo apt-get install libav-tools
This command checks resolutions:
avconv -f video4linux2 -list_formats all -i /dev/video0
Make a video:
avconv -f video4linux2 -r 30 -i /dev/video0 test.avi
ctrl+c causes stoping of rendering.
30 framerate
Source of information:
http://askubuntu.com/questions/106770/take-a-picture-from-terminal
https://libav.org/avconv.html