Set up a webcam with Linux
You want to use your webcam with a Linux computer? Good, then this article is for you.
If you have a notebook or a laptop with an integrated webcam, this will most probably work out of the box. If you have a USB webcam, connect it to your computer.
Then, you open a console (aka terminal) and type
cheese
The "cheese" application will start up and show your webcam's output like this:
If this works, congratulations, you can now use your webcam with video editors, conferencing software, and so on. But:
- cheese may not be installed
- the drivers (aka kernel modules) for the webcam may not work
- your Linux computer may not have a graphical user interface (or you may not want it)
- you may want to switch between several webcams
Install Cheese
- for Debian, Raspbian, Ubuntu, Kubuntu, Flubuntu, Xubuntu, GEUbuntu, Edubuntu and similar:
sudo apt-get install cheese
- for SUSE Linux
yast -i cheese
Fix the webcam drivers
ls -ltr /dev/video*the output should be something like this
crw-rw----+ 1 root video 81, 0 Nov 11 09:06 /dev/video0
hwinfo --usb
I had a Logitech Quickcam Messenger plugged in and got:
06: USB 00.2: 0000 Unclassified device [Created at usb.122] UDI: /org/freedesktop/Hal/devices/usb_device_46d_8da_noserial_if2 Unique ID: Eopr.vE+cdFBwClB Parent ID: uIhY.uOe2OKugI8D SysFS ID: /devices/pci0000:00/0000:00:1a.2/usb3/3-1/3-1:1.2 SysFS BusID: 3-1:1.2 Hardware Class: unknown Model: "Logitech QuickCam Messanger" Hotplug: USB Vendor: usb 0x046d "Logitech, Inc." Device: usb 0x08da "QuickCam Messanger" Revision: "1.00" Driver: "snd-usb-audio" Driver Modules: "snd_usb_audio" Speed: 12 Mbps Module Alias: "usb:v046Dp08DAd0100dc00dsc00dp00ic01isc02ip00" Driver Info #0: Driver Status: quickcam_messenger is active Driver Activation Cmd: "modprobe quickcam_messenger" Driver Info #1: Driver Status: gspca is active Driver Activation Cmd: "modprobe gspca" Config Status: cfg=new, avail=yes, need=no, active=unknown Attached to: #20 (Hub)
This meant I could install and load the webcam driver like this (as I was using SUSE, I used yast -i to install the driver):
yast -i gspcav-kmp-default modprobe gspca
Then the kernel could "see" the device:
ls /dev/video* /dev/video /dev/video0
Then I started gqcam and it showed me the webcam's output. Needless to say, today I'd not use gqcam, but cheese... but that was not available on this old Linux distro, and nowadays, the driver loads automatically anyways.
There was also a webcam which needed the uvcvideo device driver:
yast -i uvcvideo_kmp_default modprobe uvcvideo
Without graphical user interface
- use fswebcam:
fswebcam -r 640x480 mypicture.jpg
- use mencoder:
mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0 -nosound -ovc lavc -o myvideo.avi
- streamer, example for five seconds:
streamer -c /dev/video0 -f jpeg -F stereo -o myvideo.avi -t 0:05
Comments
Post a Comment