Webcam-Howto.: Unterschied zwischen den Versionen

Aus Weimarnetz Wiki
Zur Navigation springen Zur Suche springen
Zeile 149: Zeile 149:
 
=== ov511/ov51x - Driver===
 
=== ov511/ov51x - Driver===
 
<pre>
 
<pre>
ipkg install http://141.54.160.25/dave/ov511_0.1_mipsel.ipk
+
ipkg install http://141.54.160.25/dave/ov511_1_mipsel.ipk
  
 
oder  
 
oder  
Zeile 162: Zeile 162:
 
=== Logitech Quickcam Messenger - Driver ===
 
=== Logitech Quickcam Messenger - Driver ===
 
<pre>
 
<pre>
ipkg install http://141.54.160.25/dave/qc-usb-messenger-1.6_0.1_mipsel.ipk
+
ipkg install http://141.54.160.25/dave/qc-usb-messenger-1.6_1_mipsel.ipk
 
</pre>
 
</pre>
 
* Projektseite:
 
* Projektseite:

Version vom 24. Mai 2007, 15:10 Uhr


Dies ist eine Anleitung, wie man aus Freifunk Geräten eine mobile Webcam bastelt. Diese Anleitung ist aktueller als die aus Leipzig

Benoetigte Pakete

usb und video-Module installieren

ipkg install kmod-usb-ohci (abhängig vom Gerät:USB chips BCM4710 oder BCM4712)
oder 
ipkg install kmod-usb-uhci (für Asus wl500gd und Asus wl500gp)
ipkg install kmod-usb2     (nur bei Gerät mit USB 2.0 nötig)
ipkg install libpthread
ipkg install kmod-videodev

danach Neustart. USB-module werden selbsttätig geladen.

Webcam-Driver

spca5xx/spca5xx_LE - Driver

  • Welches DriverModul ihr braucht kommt auf Eure Kamera an --> Uebersicht
  • Installation:
# spca5xx-Modul
ipkg install http://ping02.stura.uni-weimar.de/dave/kmod-spca5xx_2.4.30+20060501-brcm-1_mipsel.ipk

# spca5xx/LE-Modul
cd /tmp
wget http://ping02.stura.uni-weimar.de/dave/spca5xx_le.o
mv spca5xx_le.o /lib/modules/2.4.30

danach Neustart.
Die Module werden leider nicht beim Neustart selbstständig geladen. Webcammodule laden mit

insmod videodev
insmod spca5xx oder insmod spca5xx_le

mit dem Befehl:

lsmod

kannst du überprüfen welche module geladen sind. Jetzt noch überprüfen ob die Webcam erkannt wurde indem wir

dmesg

eigeben. Da sollte dann sowas stehen wie:

Aldi Webcam DC-3110
....
usb.c: registered new driver spca5xx
drivers/usb/spca5xx.c: spca5xx driver 00.57.07 registered
hub.c: new USB device 00:04.0-1, assigned address 2
drivers/usb/spca5xx.c: USB SPCA5XX camera found. Qtec Webcam 100 Pac207-BCA 
drivers/usb/spca5xx.c: [spca5xx_probe:8380] Camera type GBRG 
drivers/usb/pac207.h: [pac207_config:148] Find Sensor PAC207
drivers/usb/spca5xx.c: [spca5xx_getcapability:2207] maxw 352 maxh 288 minw 160 minh 120

also Driver gefunden, Webcam erkannt. Und das mit der Aldi-Cam super!

pwc/pwcx - Driver

  • Alle gängigen Cams stehen in dieser Uebersicht
  • Installation:
ipkg install http://141.54.160.25/dave/philips-webcam_0.2_mipsel.ipk

bei der Installation wird automatisch ein startscript /etc/init.d/S90webcam angelegt.

cd /etc/init.d/
vi S90webcam
#!/bin/sh

# unload drivers in case the were loaded
killall camsrv; rmmod pwcx; rmmod pwc; rmmod videodev

# load webcam driver modules (it can be assumed that the USB drivers are compiled into the kernel or were installed & autoloaded)
insmod videodev || exit 1
insmod pwc || exit 2
insmod pwcx || exit 3

sleep 1

# check if video device was allocated
if [ ! -e /dev/v4l/video0 ]; then exit 4; fi

camsrv -D /dev/v4l/video0 -r VGA -c 0 -F 5 &

Tipp: Um die Kontrolllampe aus zu machen muss beim laden des Drivers noch die Option

insmod pwc leds=0,0

übergeben werden.

setpwc

  • Tool zum einstellen der Kamera
  • Hilfe:
setpwc -h

setpwc v1.2, (C) 2003-2006 by folkert@vanheusden.com
-d device  device to use (default: /dev/video0)
-p      dump current settings
-f x    set framerate (0...63)
-S w,h,x  set width/height/framerate
-b      store settings in nonvolatile RAM
-r      restore settings from nonvolatile RAM
-x      restore factory settings
-c x    set compression preference (0-3)
-g x    set automatic gain control (0...65535)
-s x    set shutter speed (1...65535)
-w auto/manual/indoor/outdoor/fl
        set automatic white balance mode
-a x    red-balance (only if -w manual) (0...65535)
-e x    blue-balance (idem) (0...65535)
-i x    speed of automatic white balance (1...65535)
-j x    delay for automatic white balance (1...65535)
-k x    set led on-time (0...25500ms
-l x    set led off-time
-m x    set electronic sharpness (0...65535)
-n x    set backlight compensation (0=0ff, other=on)
-o x    set antiflicker mode (0=0ff, other=on)
-q x    set noise reduction mode (0=none...3=high)
-t x    reset pan(bit 0) and/or tilt(bit 1)
-u      query pan/tilt status
-y x    set pan position
-z x    set tilt position
-h      this help

ov511/ov51x - Driver

ipkg install http://141.54.160.25/dave/ov511_1_mipsel.ipk

oder 

ipkg install http://141.54.160.25/dave/kmod-ov51x-2.4.30+1.65-1.12-mark-brcm_1_mipsel.ipk
  • beinhaltet ov511_decomp und ov518_decomp Module

Logitech Quickcam Messenger - Driver

ipkg install http://141.54.160.25/dave/qc-usb-messenger-1.6_1_mipsel.ipk

Programme

SpcaCat - Bildgrabber

Installation:

cd /tmp
wget http://ping02.stura.uni-weimar.de/dave/spcacat.gz
mv spcacat.gz /usr/bin
cd /usr/bin
gunzip spcacat.gz
chmod +x spcacat

Alle möglichen Einstellungen stehen in der Hilfe

spcacat -h
spcacat [-h -d -g -f -s -p -N -P -o]
     -h show this usage message.
     -d device ask the driver to use specified video
        output device (/dev/video1)
     -o outputfile  causes the program to output avi with
        image data received from the video device to the specified file.
     -g grab with READ method instead of default MMAP
     -f video format  nothing YUV420P  fourcc I420
        jpg JPEG         fourcc MJPG
        yuv YUV420P   fourcc I420
    r16 RGB565 16bits fourcc RGB2
    r24 RGB 24bits  fourcc RGB3
    r32 RGB 32bits  fourcc RGB4
    -v RAW data  fourcc RAWD
     -s widthxheight ask the driver for input size
     -p X take a picture every X seconds
     -p X && -o getPicture every X seconds and record in SpcaPict.jpg
     -N take N pictures and stop
     -P parport device (spcacat, spcaserv)

jetzt Link noch legen, weil das Programm das device /dev/v4l/video0 nicht verarbeiten kann. und dann spcacat starten.

ln -s /dev/v4l/video0 /dev/video0 
spcacat -d /dev/video0 -g -f jpg -p 10000 -o > /dev/null &

in unserm Falle speichert spcacat aller 10 sek. ein Bild namens SpcaPict.jpg ab.

Eleganter ist es auch diesmal ein script zu erstellen um nicht jedesmal die Module von Hand zu laden. Dazu legt man in dem Startverzeichnis(/etc/init.d) eine Datei z.B. S90webcam an

cd /etc/init.d/
vi S90webcam

#!/bin/sh

# unload drivers in case the were loaded
rmmod spca5xx; rmmod videodev

# load webcam driver modules (it can be assumed that the USB drivers are compiled into the kernel or were installed & autoloaded)
insmod videodev || exit 1
insmod spca5xx || exit 2

sleep 1

# check if video device was allocated
if [ ! -e /dev/v4l/video0 ]; then exit 3; fi

# Link legen fuer Vidiodevice
ln -s /dev/v4l/video0 /dev/video0

# Link legen fuer Bild
ln -s /tmp/SpcaPict.jpg /www/bild.jpg

# SpcaCat starten
cd /tmp
spcacat -d /dev/video0 -g -f jpg -s 320x240 -p 10000 -o > /dev/null &

sinnvoll ist hierbei, das Bild in den /tmp(Ram-Speicher) zu schreiben und es auf das /www Verzeichnis zu linken.
dann noch Berechtigungen setzen mit:

chmod 0777 S90webcam

Servfox - Streamserver

Installation:

cd /tmp
wget http://ping02.stura.uni-weimar.de/dave/servfox
mv servfox /usr/bin
cd /usr/bin
chmod +x servfox

Alle möglichen Einstellungen stehen in der Hilfe

servfox -h
usage: cdse [-h -d -g ]
-h      print this message
-d      /dev/videoX       use videoX device
-g      use read method for grab instead mmap
-s      widthxheight      use specified input size
-w      port      server port
  • Beispiel: Streamserver auf Port 8000 starten mit Auflösung: 320x240
servfox -g -s 320x240 -w 8000

Jetzt den Stream ansehen mit spcaview:
Download:

  • für Windows --> hier
    • entpacken
    • die Datei spcaview.bat öffen und ip-adresse und port eintragen wo servfox läuft, dann starten.
  • für Linux (Debian, Ubuntu)--> hier
    • einfach Befehl in der Konsole eintippen
spcaview -w IP-Adresse wo servfox läuft:8000

Motion - Stream und Bilder

Installation:

ipkg install http://ping02.stura.uni-weimar.de/dave/libjpeg_6b-1_mipsel.ipk
ipkg install http://ping02.stura.uni-weimar.de/dave/motion_3.2.6-1_mipsel.ipk

Nun noch die Config-Datei für motion anlegen.

vi /etc/motion.conf

#motion.conf

daemon on
quiet on

# You may very well need to change this (check with 'dmesg'
# after plugging in your webcam)
videodevice /dev/v4l/video0

# Image size in pixels (valid range is camera dependent)
width 320
height 240

quality 70
framerate 2
auto_brightness off

# Initial brightness, contrast, hue (NTSC), and saturation
# 0 = disabled (valid range 0-255)
brightness 0
contrast 0
saturation 0
hue 0

# ploetzlichen Lichteinfall daempfen
lightswitch 30

# Target base directory for pictures and films
# You should probably change this (create dir beforehand)
target_dir /tmp
jpeg_filename SpcaPict

# Speicherpause um das Geraet zu schonen
minimum_gap 30

low_cpu 1

# Define a port number (e.g. 8000) to enable the mini-http server
# 0 = disabled
webcam_port 8000

# Set to 'off' to allow anybody (not just localhost) to view the
# webcam via the mini-http server (http://hostname:port)
webcam_localhost off

webcam_quality 40
webcam_maxrate 1

# User defined text overlayed on each in the lower left corner
text_left  "Dave TV"

Und jetzt motion starten mit

motion

Jetzt kann man sich den Stream unter http://IP-Adresse_vom_Router:8000 ansehen

Eleganter ist es auch diesmal ein script zu erstellen um nicht jedesmal die Module von Hand zu laden. Dazu legt man in dem Startverzeichnis(/etc/init.d) eine Datei z.B. S90webcam an

cd /etc/init.d/
vi S90webcam

#!/bin/sh

# unload drivers in case the were loaded
rmmod spca5xx; rmmod videodev

# load webcam driver modules (it can be assumed that the USB drivers are compiled into the kernel or were installed & autoloaded)
insmod videodev || exit 1
insmod spca5xx || exit 2

sleep 1

# check if video device was allocated
if [ ! -e /dev/v4l/video0 ]; then exit 3; fi

# Link legen fuer Vidiodevice
ln -s /dev/v4l/video0 /dev/video0

# Link legen fuer Bild
ln -s /tmp/SpcaPict.jpg /www/bild.jpg

# motion starten              
motion

berechtigungen noch setzen mit

chmod 0777 S90webcam

Palantir - Streamserver

Installation:

ipkg install http://downloads.openwrt.org/backports/rc5/palantir_2.6-1_mipsel.ipk

ähnlich wie motion auch sound-streaming möglich.


Camsrv - Streamserver

LiveStream ähnlich motion - im pwc-Paket enthalten

camsrv -r CIF -d 100 -v --device=/dev/v4l/video0

Hilfe: camsrv -h

camsrv v0.3.4
(c)2002 Matthew Painter

Usage: camsrv [options]

Example: camsrv -r VGA -d 100 -v --device /dev/video1
Example: camsrv -w 320 -h 240 -s --file cam.ppm
Example: camsrv --delay 10-2 --script upload.pl --file cam.jpg

General options:
-v --verbose              display verbose information (for debugging)
-V --version              display version and exit
-W --width NUM            width of captured image
-H --height NUM           height of captured image
-r --resmode MODE         use standard resolution (see below)
-f --file FILENAME        save PPM/JPG image of first frame captured and exit
-q --jpegquality NUM      JPEG image quality percentage (value between 0 and 100,
                          defaults to 75)
-p --script FILENAME      run FILENAME after each image is captured
-P --port PORT            port to run the camsrv server on
-d --delay NUM-NUM | NUM  delay (in seconds) between frames are captured
-e --capturedelay NUM     portion of delay where camera is enabled (for image stabilisation)
-l --loop                 loop still image capture. Enabled if streaming is
                          also enabled
-L --log FILENAME         log verbose output messages to FILENAME
-D --device PATH          path to video device to use (defaults to /dev/video0)
-S --stream               streams to java client. This is enabled by default
                          if --file is not used
-h --help                 display help

Philips specific options:
-F --framerate NUM    framerate of camera (integer between 4 to 30)
-c --compression NUM  camera compression (0..3)
-s --shutter NUM      shutter speed (0..65535) default: automatic
-g --agc NUM          automatic gain control override (0..65535)

Default resolution modes:

Mode            Resolution
sQCIF           128x96
QSIF            160x120
QCIF            176x144
SIF             320x240
CIF             352x288
VGA             640x480


Mvc - Bildgrabber

einfaches motion capture Programm

mvc version 0.8.9 - motion detection video capture program

Usage: mvc <options>

 -B picture brightness value.
 -C picture contrast value.
 -D run in daemon mode.
 -O Base directory for output images. default is current dir.
 -o Don't create sub-directories for output.
 -t Print timestamp on image.
 -d <device> video device (default:/dev/video0).
 -e <program> excute a external program while motion detected.
 -f {jpeg|png} set output file format. default is jpeg.
 -q <quality>               jpeg quality setting.
 -h print this help.
 -i <channel> which input channel to use, default is 1, or 0 if only 1 input.
 -m use mono color (grayscale) for capture.
 -n {pal|ntsc|secam|auto}    video norm to use, default: PAL
 -s XxY size of the output image, example: -s 640x480
 -a HxV block division number in Horizantal and Vertical. Ex: -a 16x8
 -b <diff_block_limit>      threshold of hot block number.
 -c <diff_color_limit>      threshold of block color difference.
 -w delay time for each capture(seconds), example: -w 0.5
 -l logfile used in daemon mode. default is null.
 -v increase verbose level for more details, can multiple applied.


getjpeg - Bildgrabber

  • Installation:
cd /tmp
wget http://ping02.stura.uni-weimar.de/dave/getjpeg
mv getjpeg /usr/bin
cd /usr/bin
chmod +x jpeg


Automation

Cronjob einrichten: (z.B. aller 5min. Neustarten)

vi /etc/init.d/S51crond

0-59/5 * * * *  /usr/sbin/cron.5minutely

einfügen.

vi /usr/sbin/cron.5minutely

#!/bin/sh
killall -9 motion
logger "motion gekilld"
sleep 5
/usr/bin/motion -c /etc/motion.conf

berechtigungen noch setzen mit

chmod 0777 /usr/sbin/cron.5minutely

Anzeigen auf dem Router

Anlegen eines Links:

cd /www
vi 20-cgi-bin-webcam

Text einfügen:

<TR><TD>
         <DIV CLASS="plugin"><A CLASS="plugin" HREF="cgi-bin-webcam.html">Webcam</A></DIV></TD>
</TR>

Dann noch die Site anlegen

cd /www
vi cgi-bin-webcam.html

und Text einfügen:


Anzeigen als Bild

#!/bin/sh

export DATE="18.11.2006";SCRIPT=${0#/rom}
export TITLE="Webcam"
. ${SCRIPT%/*}/cgi-bin-pre.sh

cat<<EOF
<html><head>
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="refresh" content="10">
<center>
<H1>Webcam</H1><br>
<img src="bild.jpg" name="Webcambild" width="480" hight="360"><br>
Images refreshed every 10 seconds.
</center>
</body></html>
EOF

. ${SCRIPT%/*}/cgi-bin-post.sh


Anzeigen mit Java Applet (Stream oder Bild)

#!/bin/sh

export DATE="18.11.2006";SCRIPT=${0#/rom}
export TITLE="Webcam"
. ${SCRIPT%/*}/cgi-bin-pre.sh

cat<<EOF
<center>
<H1>Webcam</H1>
    <applet code=com.charliemouse.cambozola.Viewer
    archive=cambozola.jar width="320" height="240" style="border-width:1; border-color:gray; border-style:solid;">
    <param name="url" value="http://'''IP-Adresse''':8000">
    <param name="failureimage" value="offline.jpg">
    <param name="accessories" value="ZoomIn,ZoomOut,Pan,Info">
    </applet>
</center>
EOF

. ${SCRIPT%/*}/cgi-bin-post.sh
cd /www
wget http://141.54.160.25/dave/cambozola-0.68/dist/cambozola-server.jar
wget http://141.54.160.25/dave/cambozola-0.68/dist/cambozola.jar
wget http://141.54.160.25/dave/offline.jpg

oder

ipkg install http://141.54.160.25/dave/webcam-tools_1_mipsel.ipk
  • das offline.jpg ist automatisch dabei wenn ihr das PWC-Modul installiert habt
  • oder dieses ist auch ganz nett :-).

Geräte die getestet wurden

Router: Asus wl hdd 2,5 ; Yakumo Wireless Storage ; Siemens se505 ; Asus wl500g (alles USB 1.0)
Fabrikat ID (lsusb/dmesg) driver Programm Auflösung Notiz
Creative Vista Plus 0x41e/0x4028 spca5xx motion, spcacat max:176x144 schlechter Weißabgleich
Creative Webcam NoteBook 0x041e/0x401f spca5xx_le motion, spcacat :- zerhacktes Bild, ungeeignet
Labtec Notebook 0x046d/0x08aa spca5xx_le spcacat, servfox :- zerhacktes Bild, ungeeignet
Labtec Webcam Elch2 0x046d/0x0929 spca5xx spcacat, motion :- Totalabsturz, ungeeignet
Labtec Pro 0x046d/0x08a2 spca5xx_le spcacat, servfox :- zerhacktes Bild, ungeeignet
Logitech Quickcam Messenger 0x046d/0x08f6 quickcam motion, spcacat :- grünes Bild, ungeeignet
Logitech Sphere (nicht MP) 0x046d/0x08b5 pwc motion max:640x480 Steuerung evtl. möglich mit Setpwc?
Philips SPC600NC 0x0471/0x0328 spca5xx_le spcacat, servfox :- zerhacktes Bild, ungeeignet
Philips Vesta PCVC 675 0x471/0x307 pwc motion, camsrv, mvc max:640x480 etwas globig, super Bild
Philips ToUcam Fun PCVC 730 0x471/0x310 pwc motion, camsrv, mvc max:640x480 Bild gespiegelt
Philips ToUcam Pro PCVC 740 0x471/0x311 pwc motion, camsrv, mvc max:640x480 gutes Bild
Philips ToUcam II PCVC 820 0x05a9/0x0518 ov51x, ov518_decomp motion, mvc, getjpeg :- grünes Bild, ungeeignet
Philips ToUcam Fun II PCVC 830 0x471/0x310 pwc motion, camsrv, mvc max:640x480 gutes Bild
Philips ToUcam Pro II PCVC 840 0x471/0x311 pwc motion, camsrv, mvc max:640x480 gutes Bild
Qtec Webcam 100 DC-3110 (AldiCam) 0x93a/0x2460 spca5xx motion, spcacat max:176x144 schlechter Weißabgleich
Technaxx VP-1 0x93a/0x2468 spca5xx motion, spcacat max:176x144 schlechter Weißabgleich
Techsolo TCA-4810 0x0ac8/0x303b spca5xx spcacat, motion :- Totalabsturz, ungeeignet
Router: Asus WL500g Premium oder Deluxe; Linksys WRTSL 54GS (alles USB 2.0)
Fabrikat ID (lsusb/dmesg) driver Programm Qualität/Auflösung Notiz
Creative Vista Plus 0x41e/0x4028 spca5xx motion, spcacat max:352x288 schlechter Weißabgleich - nur indoor
Creative Webcam NoteBook 0x041e/0x401f spca5xx_le, spca5xx servfox, spcacat, motion max:640x480
Labtec Notebook 0x046d/0x08aa spca5xx_le, spca5xx spcacat, servfox, motion max:640x480
Labtec Webcam Elch2 0x046d/0x0929 spca5xx spcacat, motion max:352x288
Labtec Pro 0x046d/0x08a2 spca5xx_le, spca5xx spcacat, servfox max:640x480
Logitech Quickcam Messenger 0x046d/0x08f6 quickcam motion, spcacat max:320x240
Logitech Sphere (nicht MP) 0x046d/0x08b5 pwc motion max:640x480 Steuerung evtl. möglich mit Setpwc?
Philips SPC600NC 0x0471/0x0328 spca5xx_le spcacat, servfox max:640x480
Philips Vesta PCVC 675 0x471/0x307 pwc motion, camsrv, mvc max:640x480 etwas globig, super Bild
Philips ToUcam Fun PCVC 730 0x471/0x310 pwc motion, camsrv, mvc max:640x480 Bild gespiegelt
Philips ToUcam Pro PCVC 740 0x471/0x311 pwc motion, camsrv, mvc max:640x480 super Bild
Philips ToUcam II PCVC 820 0x05a9/0x0518 ov51x, ov518_decomp motion, mvc, getjpeg max:352x288 Weißabgleich OK - outdoor geeignet
Philips ToUcam Fun II PCVC 830 0x471/0x310 pwc motion, camsrv, mvc max:640x480 super Bild
Philips ToUcam Pro II PCVC 840 0x471/0x311 pwc motion, camsrv, mvc max:640x480 super Bild
Qtec Webcam 100 DC-3110 (AldiCam) 0x93a/0x2460 spca5xx motion, spcacat max:352x288 schlechter Weißabgleich - nur indoor
Technaxx VP-1 0x93a/0x2468 spca5xx motion, spcacat max:352x288 schlechter Weißabgleich - nur indoor
Techsolo TCA-4810 0x0ac8/0x303b spca5xx spcacat, servfox, motion max:640x480