I just added an old webcam on my slug and wanted to share in here. First of all if you want to add webcam to your system go ahead and upgrade your system as explained in the previous post.
Anyway, I upgraded my system and plugged in the webcam to one of the empty slots. Surprisingly the green webcam light was on which means it if successfully loaded. I checked lsusb
Bus 002 Device 003: ID 0ac8:301b Z-Star Microelectronics Corp. ZC0301 WebCam
then video port by typing ls /dev/video* and I had /dev/video0 in there. But when I tried to get some pictures it failed...
It was automatically loading zc0301 module (check with lsmod) but I soon realized that this module bad. I had to prevent that module loading. To do so,
nano /etc/modprobe.d/blacklist
and add
blacklist zc0301
We need another module at this point, gspca.To load this module debian has an easy and beatiful application module-assistant. Go ahead and install it
apt-get install module-assistant
then to install gspca module
m-a auto-install gspca
That is it. Your webcam should be ready now. To test
apt-get install streamer
then
streamer -t 10 -r 2 -o foobar00.jpeg
should capture ten frames, two per second.
To setup a system that captures images and put them to your webserver you can use webcam software. To install write
apt-get install webcam
After that you should put your config file to /root/.webcamrc.
nano /root/.webcamrc
paste the lines below
[grab]
device = /dev/video0
text = "NSLU2 webcam %Y-%m-%d %H:%M:%S (EST)"
# infofile =
fg_red = 255
fg_green = 255
fg_blue = 255
width = 640
height = 480
# delay = number of seconds between snapshots
delay = 30
wait = 1
input = ZC301-2
# norm = webcam
rotate = 0
top = 0
left = 0
bottom = -1
right = -1
quality = 100
trigger = 0
once = 0
# archive =
[ftp]
host = 127.0.0.1
user = root
pass = xxxx
dir = /var/www/webcam
file = webcam.jpeg
tmp = uploading.jpeg
passive = 1
debug = 0
auto = 0
# local = 1 means just use the local directory specified above, do not use ftp or ssh
local = 1
ssh = 0
now if you type
webcam
it should start capturing images and put them to the folder you specified. There is something to mention though
input = ZC301-2
this line is catchy. I guess it differs at different webcams. To learn the correct input name of your device first install v4l-conf
apt-get install v4l-conf
Then,
v4l-info | grep name
should give you the correct name. In my case I got
ioctl VIDIOCGTUNER: Invalid argument
ioctl VIDIOCGAUDIO: Invalid argument
name : "Z-star Vimicro zc0301p"
name : "ZC301-2"
and I used ZC301-2 as the input.Try and see what is yours.
After the setup if you want it to work automatically after restart you can set up a crontab:
crontab -e
@reboot /usr/bin/webcam
I hope this helps someone...
Hey,
ReplyDeleteSorry but your Tutorial didnt worked for me... :( my debian gets the /dev/video0 but if i try to make a pic with streamer it returns:
setformat: 12 bit YUV 4:2:0 (planar) (320x240): failed
followed by 3 nearly same error Messages
The cam works fine under Ubuntu 9.10 without installing components
i would be happy about getting an email from you
Hi,
ReplyDeleteMaybe we can find a way to make it work.
What do you get after this command
v4l-info | grep name
and what do you see after lsusb?
v4l-info <-- command not found
ReplyDeletelsusb:
Bus 001 Device 002: ID 18ec:3288 Arkmicro Technologies Inc.
Iam am not able to copy something out of Putty XD
First read the whole post, then do this
ReplyDeleteapt-get install v4l-conf
You should be able to copy from putty though.
I red the text up to the installation of streamer. Maybe my english isnt perfect and so i was not able to understand something correctly.
ReplyDeleteThank you for help
And here is the Output of v4l-conf:
### v4l2 device info [/dev/video0] ###
general info
VIDIOC_QUERYCAP
driver : "uvcvideo"
card : "USB2.0 PC CAMERA"
bus_info : "0000:00:01.2"
version : 0.1.0
capabilities : 0x4000001 [VIDEO_CAPTURE,STREAMING]
standards
inputs
VIDIOC_ENUMINPUT(0)
index : 0
name : "Camera 1"
type : CAMERA
audioset : 0
tuner : 0
std : 0x0 []
status : 0x0 []
video capture
VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)
index : 0
type : VIDEO_CAPTURE
flags : 0
description : "YUV 4:2:2 (YUYV)"
pixelformat : 0x56595559 [YUYV]
VIDIOC_G_FMT(VIDEO_CAPTURE)
type : VIDEO_CAPTURE
fmt.pix.width : 640
fmt.pix.height : 480
fmt.pix.pixelformat : 0x56595559 [YUYV]
fmt.pix.field : NONE
fmt.pix.bytesperline : 1280
fmt.pix.sizeimage : 614400
fmt.pix.colorspace : unknown
fmt.pix.priv : 0
controls
VIDIOC_QUERYCTRL(BASE+0)
id : 9963776
type : INTEGER
name : "Brightness"
minimum : 0
maximum : 255
step : 1
default_value : 100
flags : 0
VIDIOC_QUERYCTRL(BASE+1)
id : 9963777
type : INTEGER
name : "Contrast"
minimum : 0
maximum : 255
step : 1
default_value : 150
flags : 0
VIDIOC_QUERYCTRL(BASE+2)
id : 9963778
type : INTEGER
name : "Saturation"
minimum : 0
maximum : 255
step : 1
default_value : 80
flags : 0
VIDIOC_QUERYCTRL(BASE+3)
id : 9963779
type : INTEGER
name : "Hue"
minimum : -128
maximum : 127
step : 1
default_value : 0
flags : 0
### video4linux device info [/dev/video0] ###
general info
VIDIOCGCAP
name : "USB2.0 PC CAMERA"
type : 0x1 [CAPTURE]
channels : 1
audios : 0
maxwidth : 0
maxheight : 0
minwidth : 48
minheight : 32
channels
ioctl VIDIOCGCHAN: Invalid argument
tuner
ioctl VIDIOCGTUNER: Invalid argument
audio
ioctl VIDIOCGAUDIO: Invalid argument
picture
VIDIOCGPICT
brightness : 25700
hue : 32896
colour : 20560
contrast : 38550
whiteness : 30583
depth : 16
palette : YUYV
buffer
ioctl VIDIOCGFBUF: Invalid argument
window
VIDIOCGWIN
x : 0
y : 0
width : 640
height : 480
chromakey : 0
flags : 0
And the Hole Output of lsusb:
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 18ec:3288 Arkmicro Technologies Inc.
Bus 001 Device 003: ID 0204:6025 Chipsbank Microelectronics Co., Ltd CBM2080 Flash drive controller
OK,
ReplyDeleteNow install this
# apt-get install webcam
then do
# nano /root/.webcamrc
Copy these lines into that file
[grab]
device = /dev/video0
text = "NSLU2 webcam %Y-%m-%d %H:%M:%S (EST)"
# infofile =
fg_red = 255
fg_green = 255
fg_blue = 255
width = 640
height = 480
# delay = number of seconds between snapshots
delay = 30
wait = 1
input = Camera 1
# norm = webcam
rotate = 0
top = 0
left = 0
bottom = -1
right = -1
quality = 100
trigger = 0
once = 0
# archive =
[ftp]
host = 127.0.0.1
user = root
pass = xxxx
dir = /var/www/webcam
file = webcam.jpeg
tmp = uploading.jpeg
passive = 1
debug = 0
auto = 0
# local = 1 means just use the local directory specified above, do not use ftp or ssh
local = 1
ssh = 0
According to that config file you should have a webcam directory at
ReplyDelete# /var/www/webcam
so either make a directory like that or change the directory path.
Afterwardds go ahead and run it, write
# webcam
You should be able to get the images in that directory
-Cheers
Input/output error
ReplyDeletecan't get rgb24 data
this is what i got when i was starting webcam
Sorry it wasnt the hole Output:
ReplyDeleteioctl: VIDIOC_S_FMT(type=VIDEO_CAPTURE;fmt.pix.width=640;fmt.pix.height=480;fmt.pix.pixelformat=0x56595559 [YUYV];fmt.pix.field=ANY;fmt.pix.bytesperline=0;fmt.pix.sizeimage=0;fmt.pix.colorspace=unknown;fmt.pix.priv=0): Input/output error
can't get rgb24 data
Could you send me lsmod output?
ReplyDeletesure:
ReplyDeleteModule Size Used by
ipv6 288564 10
ext2 63752 1
evdev 8672 0
snd_usb_audio 78112 0
snd_pcm_oss 39328 0
snd_mixer_oss 14912 1 snd_pcm_oss
snd_pcm 71109 2 snd_usb_audio,snd_pcm_oss
snd_timer 20836 1 snd_pcm
snd_page_alloc 8520 1 snd_pcm
snd_usb_lib 15904 1 snd_usb_audio
snd_rawmidi 21376 1 snd_usb_lib
snd_seq_device 7532 1 snd_rawmidi
snd_hwdep 7140 1 snd_usb_audio
uvcvideo 53800 0
compat_ioctl32 1184 1 uvcvideo
ixp4xx_eth 12280 0
videodev 29344 1 uvcvideo
v4l1_compat 15236 2 uvcvideo,videodev
ixp4xx_npe 8000 2 ixp4xx_eth
snd 49812 8 snd_usb_audio,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer,snd_rawmidi,snd_seq_device,snd_hwdep
firmware_class 7648 1 ixp4xx_npe
ixp4xx_qmgr 5272 6 ixp4xx_eth
soundcore 7172 1 snd
ixp4xx_beeper 2816 0
ohci_hcd 18276 0
ext3 123688 1
jbd 45460 1 ext3
mbcache 7968 2 ext2,ext3
sd_mod 22736 4
ehci_hcd 35212 0
usb_storage 83559 3
usbcore 128828 7 snd_usb_audio,snd_usb_lib,uvcvideo,ohci_hcd,ehci_hcd,usb_storage
scsi_mod 111300 2 sd_mod,usb_storage
Did you do these?
ReplyDeleteapt-get install module-assistant
m-a auto-install gspca
yep i did
ReplyDeleteHmm, I guess either another video module prevents it to install or your webcam driver is not compatible with this.
ReplyDeleteSo, disconnect the webcam and send me the lsmod again please
Module Size Used by
ReplyDeleteipv6 288564 10
ext2 63752 1
evdev 8672 0
snd_usb_audio 78112 0
snd_pcm_oss 39328 0
snd_mixer_oss 14912 1 snd_pcm_oss
snd_pcm 71109 2 snd_usb_audio,snd_pcm_oss
snd_timer 20836 1 snd_pcm
snd_page_alloc 8520 1 snd_pcm
snd_usb_lib 15904 1 snd_usb_audio
snd_rawmidi 21376 1 snd_usb_lib
snd_seq_device 7532 1 snd_rawmidi
snd_hwdep 7140 1 snd_usb_audio
uvcvideo 53800 0
compat_ioctl32 1184 1 uvcvideo
ixp4xx_eth 12280 0
videodev 29344 1 uvcvideo
snd 49812 8 snd_usb_audio,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer,snd_rawmidi,snd_seq_device,snd_hwdep
ixp4xx_npe 8000 2 ixp4xx_eth
v4l1_compat 15236 2 uvcvideo,videodev
firmware_class 7648 1 ixp4xx_npe
soundcore 7172 1 snd
ixp4xx_qmgr 5272 6 ixp4xx_eth
ixp4xx_beeper 2816 0
ohci_hcd 18276 0
ext3 123688 1
jbd 45460 1 ext3
mbcache 7968 2 ext2,ext3
sd_mod 22736 4
ehci_hcd 35212 0
usb_storage 83559 3
usbcore 128828 7 snd_usb_audio,snd_usb_lib,uvcvideo,ohci_hcd,ehci_hcd,usb_storage
scsi_mod 111300 2 sd_mod,usb_storage
it should be possible to run this webcam on Debian XD because on ubuntu it is running without any additional action... it would be ql to run the webcam on the NSLU2 because i want to use it for an Quadrocopter Project...
ReplyDeleteWell I am trying to do my best. I will try to figure that out when I go home. I will look at my slug and tell you some more but if your webcam again does not work sorry.
ReplyDeleteBy the way what is the model of the webcam. Did you look online for that model, which module does that use?
Thank you for helping me again.
ReplyDeleteThe webcam is a Digitus Webcam
http://www3.hardwareversand.de/articledetail.jsp?aid=23214&agid=127
if you tell me how i could tell you what driver is used by ubuntu i will tell you
Hi,
ReplyDeleteSorry for the delay
nano /etc/modprobe.d/blacklist
and add
blacklist uvcvideo
reboot the sytem and try to run webcam after reboot. Tell me how it goes
Hey,
ReplyDeleteI am just installing ubuntu 9.04 to try the webcam on this OS. Maybe it would autodetect it like my Ubuntu 9.10 Desktop. If it would not autodetect i will try your tip! Or Ubuntu is maybe to slow for my aims. But we will see.
Excellent blog post. Thanks - just got mine up and running with your help.
ReplyDeleteI'm using:
Creative Technology, Ltd Webcam Live!/Live! Pro
The images are ok, but I'm still seeing this message from dmesg:
gspca: [spca5xx_set_light_freq:1932] Sensor currently not support light frequency banding filters
Thank for the pointer regarding v4l-info. This got me working...
ReplyDelete