Logitech QuickCam Pro 9000

Find out your hardware version

http://www.quickcamteam.net/documentation/faq/how-many-versions-of-the-quickcam-pro-9000-are-there

unfortunately I bought the revision 8 as the following command reveals:

sudo lsusb -d 046d:0990 -v | grep bcdDevice

according to quickcamteam.net this revision has a bug so that you have to unplug the cam from time to time...

get HD video to work with Skype on Ubuntu 10.10 maverick

http://wiki.ubuntuusers.de/Baustelle/Skype_HQ-Video

sudo aptitude install uvcdynctrl
uvcdynctrl -l
uvcdynctrl -d /dev/video0 -s "Exposure, Auto Priority" 0
sudo aptitude install guvcview
sudo gedit /etc/udev/rules.d/80-uvcdynctrl.rules

enter

###########################################
# Rules for adding dynamic UVC extension unit controls to UVC devices
################################################
ACTION=="add", SUBSYSTEM=="video4linux", DRIVERS=="uvcvideo", ENV{idVendor}="$attr{idVendor}", ENV{idProduct}="$attr{idProduct}", RUN+="/lib/udev/uvcdynctrl"

and save.

sudo guvcview

Follow the setup as described in http://wiki.ubuntuusers.de/Baustelle/Skype_HQ-Video#Anpassung-der-Einstellungen (German):

sudo aptitude install skype
skype

Open Skype once and close it again.

gedit ~/.Skype/skypeUsername/config.xml

and enter the following before the </Lib> tag:

<Video>
      <CaptureHeight>720</CaptureHeight>
      <CaptureWidth>960</CaptureWidth>
      <Device>/dev/video0</Device>
      <Fps>15</Fps>
  </Video>

now it should work.

directly display the stream from the webcam

http://ubuntuforums.org/showthread.php?p=6186384

sudo aptitude install mplayer ffmpeg

To view the stream:

mplayer -tv driver=v4l2:width=640:height=480:device=/dev/video0:fps=30:outfmt=yuy2 tv://

record the webcam stream

ffmpeg -f audio_device -i /dev/dsp1  -f video4linux2 -s 640x480 -i /dev/video0 -f avi - | tee `date -I`.avi | mplayer -

to record audio:

arecord -D plughw:1,0 -c 1 -f cd -v file.wav

stream using mjpg-streamer

Check the more detailed post on compiling MJPG-Streamer from Source on Ubuntu 11.10.

Automatically Capture an Image Every Minute (using cronjobs)

#!/bin/bash
# see http://mjpg-streamer.wiki.sourceforge.net/Serving+pictures+of+a+webcam+via+HTTP+server

# start webcam-streaming-server
#mjpg_streamer -i "input_uvc.so -d /dev/video0 -y -f 25 -r 1600x1200" -o "output_http.so -w /home/philipp/Downloads/mjpg-streamer/mjpg-streamer/mjpg-streamer/www -p 8081" &
# but without a webroot:
mjpg_streamer -i "input_uvc.so -d /dev/video0 -y -f 25 -r 1600x1200" -o "output_http.so -p 8081" &

# define the new filename and path here, if the name should be constant use a constant here
NEW_FILENAME="/home/philipp/webcamSnapshots/snapshot-$(date +%F-%H-%M-%S-%N).jpg"

# delete file if it already exists
rm -f "$NEW_FILENAME"

## wait before taking the picture
sleep 1

# download a single JPEG from the local webcam server
wget -q -O "$NEW_FILENAME" http://localhost:8081/?action=snapshot

# stop the webserver
kill $!

Setup cron:

crontab -e

Then set up this cron job:

* * * * * /home/philipp/getWebcamShot.sh

A little more cron config:
https://help.ubuntu.com/community/CronHowto
The first star is the minute section, so having only a star there will execute every minute
And the other stars are from left to right minute hour dayofmonth month dayofweek (0=sunday for the dayofweek.)

get it to work with skype

http://nurey.blogspot.com/2008/11/i-bought-logitech-quickcam-pro-9000.html

at first there is that awful problem with pulseaudio in skype. just run killall pulseaudio before you start skype. Or do sudo apt-get remove --purge pulseaudio (another recent sound server) System/Preferences/Sessions, uncheck Pulse Audio System/Preferences/Sound, set everything to ALSA, set Sound Capture to USB Device OSS Skype/Options/Sound Devices, Sound In -> USB Device (plughw), Sound Out -> Default, Ringing -> Default

Now video is flickering. Very annoying. I have an ATI card with compiz running. Fix is to turn off "TexturedVideo" in xorg.conf: Section "Device" Identifier "Configured Video Device" Driver "fglrx" Option "TexturedVideo" "off" EndSection

motion detection system

http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome

$ sudo aptitude install motion

enable motion: change line "start_motion_daemon=no" to "start_motion_daemon=yes using sudo gedit /etc/default/motion"

change the configuration set the number of changed pixels needed to track from 1500 to (960 * 720) / (320 * 240) * 1500 = 9 * 1500 = 13500 /etc/motion/motion.conf http://www.lavrsen.dk/twiki/bin/view/Motion/ConfigOptionV4L2Palette (erst ab 3.2.10)

width 960
height 720
framerate 15
threshold 13500
target_dir /home/philipp/motion
on_motion_detected /home/philipp/motion/a_sendMail.sh "%Y-%m-%d %T"
v4l2_palette 2

make file /home/philipp/motion/a_sendMail.sh executable and fill with

#!/bin/bash

# Motion sample script to send an e-mail at start of an event.
# Replaces the former 'mail' option.
# Just define this script as 'on_event_start'-script in motion.conf like that:
# on_event_start send_mail "%Y-%m-%d %T"

#change to suit your needs:
#location of 'mail' binary
MAIL="/usr/bin/mail"
#Destination e-mail address
TO="root@localhost"
#Subject of the e-mail
SUBJECT="Motion detected"

#Don't change anything below this line
echo -e "This is an automated message generated by motion.\n\nMotion detected: $1\n\n" | $MAIL -s "$SUBJECT" $TO

then restart:

$ sudo /etc/init.d/motion restart

or try tuning mode (to optimise thresholds etc.): http://www.lavrsen.dk/twiki/bin/view/Motion/TuningMotion

$ sudo /etc/init.d/motion stop
$ sudo motion -s

also nice: http://www.lavrsen.dk/twiki/bin/view/Motion/RelatedProjects
for example if you want to use it as a surveillance camera: set up cron to run {{pkill -STOP motion}} in the evening and {{pkill -CONT motion}} in the morning

just two notes: make jpegs images from a mpeg video: http://www.lavrsen.dk/twiki/bin/view/Motion/FrequentlyAskedQuestions#How_do_I_break_an_MPEG_movie_int

transcode -i <movie-file> -y jpg -F 75 -o <output-filename-prefix>

make mpeg video from jpg images: http://www.lavrsen.dk/twiki/bin/view/Motion/FrequentlyAskedQuestions#How_do_I_create_mpegs_from_jpeg

mencoder "mf://${FOLDER}/*.jpg" -ovc lavc -o motion${DATER}.avi

streaming using the ASUS Router WL500G Premium v1

Seems not to work with the dd-wrt firmware yet. What I tried to get it to work with dd-wrt:

  • enable jffs (192.168.1.1 -> Administration -> JFFS2 Support)
  • enable USB (Services → Services → USB support):
    • Core USB Support Enable
    • USB 1.1 Support (UHCI) Disable
    • USB 1.1 Support (OHCI) Enable
    • USB 2.0 Support Enable
    • USB Storage Support Enable
    • ext2 / ext3 File System Support Enable
    • FAT File System Support Disable
    • USB Printer Support Disable
  • ssh root@192.168.1.1

getting the button of the Logitech Quickcam Pro 9000 to work

cat /proc/bus/input/devices

reveals

I: Bus=0003 Vendor=046d Product=0990 Version=0008
N: Name="UVC Camera (046d:0990)"
P: Phys=usb-0000:00:1d.7-6
S: Sysfs=/devices/pci0000:00/0000:00:1d.7/usb1/1-6/1-6:1.0/input/input8
U: Uniq=
H: Handlers=event7 
B: EV=3
B: KEY=1 0 0 0 0

so on event 7 you see some activity:

philipp@lion:~$ sudo cat /dev/input/event7
'H$J�
      (H$J�B(H$J�
)H$J*�*H$Jw�    *H$Jw�
                                 +H$JJ, +H$J�^
                                                         -H$J�-H$J�.H$J�.H$J��.H$J�.H$J�E
/H$J�b/H$J/H$J�/H$J�,   0H$J�{1H$J4�2H$J2H$J
�3H$J��3H$J^3H$Je�
4H$J2d4H$J3X4H$J�  3H$Jh
                         4H$J��

or

philipp@lion:~$ sudo od -x /dev/input/event7
0000000 4ada 4a24 0000 0000 ab97 000c 0000 0000
0000020 0001 0100 0001 0000 4ada 4a24 0000 0000
0000040 9f95 000e 0000 0000 0001 0100 0000 0000
0000060 4adb 4a24 0000 0000 77de 0005 0000 0000
0000100 0001 0100 0001 0000 4adb 4a24 0000 0000
0000120 6bde 0007 0000 0000 0001 0100 0000 0000
0000140 4adb 4a24 0000 0000 d6e9 000a 0000 0000
0000160 0001 0100 0001 0000 4adb 4a24 0000 0000
0000200 4de5 000c 0000 0000 0001 0100 0000 0000

to register some action with the button:

not found much but as an example you could run this (found here)

#!/bin/bash
rm -f ~/button.1
mkfifo ~/button.1
exec 9<> ~/button.1

# /dev/input/event2 is keyboard events on my system
sudo od -x /dev/input/event7 &

while read event <&9
do
echo ".." $event
done

a more professional way using this C-Code:

evdev-key-btn-test.c

cd ~/Downoads
wget http://www.cynapses.org/tmp/lomoco/evdev-key-btn-test.c
gcc -o evdev-key-btn-test evdev-key-btn-test.c

then a sudo ./evdev-key-btn-test /dev/input/event7 reveals:

sudo ./evdev-key-btn-test /dev/input/event7
Supported Keys:
  Key  0x100  (Button 0)
Buttons/Keys:   1

Supported Relative axes:

approach using gizmo deamon

http://gizmod.wiki.sourceforge.net/

see http://patchwork.kernel.org/patch/1903/
about gizmo: allows scripting of input events through Python scripts; It also provides built in support for the Griffin PowerMate USB dial (including visualizing system events, and music on its LED), as well as remote controls, keyboard with fancy buttons, and more!

sudo apt-get install gizmod
sudo apt-get install cheese

Connect the webcam and run gizmod at debug mode as superuser:

sudo gizmod -g

When button is pressed, gizmod shows:

onEvent: Standard -- /dev/input/event7 | [EV_KEY] <BTN_0> c: 0x100 v: 0x1

and when button is released, gizmod shows:

onEvent: Standard -- /dev/input/event7 | [EV_KEY] <BTN_0> c: 0x100 v: 0x0

press [Ctrl]-[C] to abort the operation.

So the output before give you 0x100 and 0x1 / 0x0 as button codes. now save the following file as /etc/gizmod/modules.d/010-Snapshot-Cheese.py:

#*************************************************************************
#*** GizmoDaemon Config Script
#*** Snapshot Cheese config

############################
# Imports
from GizmoDaemon import *
from GizmoScriptRunningApplication import *
import subprocess

ENABLED = True
VERSION_NEEDED = 3.2
INTERESTED_CLASSES = [GizmoEventClass.Standard]
INTERESTED_APPLICATION = "cheese"

############################
# SnapshotCheese Class definition
class SnapshotCheese(GizmoScriptRunningApplication):

    """
    Snapshot Cheese Event Mapping
    """

    ############################
    # Public Functions
    def onDeviceEvent(self, Event, Gizmo = None):

        """
        Called from Base Class' onEvent method.
        See GizmodDispatcher.onEvent documention for an explanation of this
        function
        """

        # process the key
        if (Event.Code == 0x100) and (Event.Value == 0x0):
            Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_SPACE)
            return True
        else:
            # unmatched event, keep processing
            return False

    ############################
    # Private Functions
    def __init__(self):

        """ 
        Default Constructor
        """

        GizmoScriptRunningApplication.__init__(self, ENABLED, VERSION_NEEDED, INTERESTED_CLASSES, INTERESTED_APPLICATION)

        ############################
        ### SnapshotCheese class end

# register the user script
SnapshotCheese()

now run gizmod in normal mode:

sudo gizmod

open cheese, uncheck countdown option and try the snapshot button!

change settings using v4l2ucp

http://sourceforge.net/projects/v4l2ucp/

sudo aptitude install v4l2ucp

change settings using guvcview

http://guvcview.berlios.de/

sudo apt-get install guvcview

video conferences on the net using TokBox

http://www.TokBox.com
using Flash inside a webbrowser

Resources

Comments