<-- Projects
From time to time you find out quite funny things with Linux. For example that you Logitech Webcam is in fact a Phillips Webcam.
The A-Brand desktop accessory manufaturer Logitech just rebrands Phillips Webcams.
How to install the Logitech Quickcam 4000?
Since Kernel 2.6.20-rc3 the integrated driver works for me, so i suggest everyone to use it.
 
For Video:
"Device Drivers" --> "Multimedia devices" --> "Video for Linux" --> "Video Capture Adapters" --> "V4L USB devices" --> "USB Philips Cameras"
 
For Audio:
"Device Drivers" --> "Sound" --> "Advanced Linux Sound Architecture" --> "USB devices" --> "USB Audio/MIDI driver"
 
What to do with the webcam:
Get a nice preview:
mplayer tv:// -tv driver=v4l:device=/dev/video0:width=640:height=480:noaudio -x 800 -y 600 -vf-add pp=hb:a/vb:a,hqdn3d
 
Take a snapshot:
Streamer is included with xawtv
streamer -s 640x480 -c /dev/video0 -o webshot.ppm
 
Record raw video and audio:
mencoder tv:// -tv driver=v4l:device=/dev/video0:width=640:height=480:fps=10:adevice=hw.1:alsa:audiorate=44100:amode=1:forceaudio -ovc copy -oac copy -o 123.avi
 
Record mpeg4 video and mp3 audio:
mencoder tv:// -tv driver=v4l:device=/dev/video0:width=640:height=480:fps=10:adevice=hw.1:alsa:audiorate=44100:amode=1:forceaudio -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=600 -oac mp3lame -lameopts abr=96 -o 123.avi
 
Traditional Webcam:
Of course the webcam can also be used for its original function, to upload images to a webserver. Therefore i wrote a little shell script:
#!/bin/bash
#
# webcam.sh capture & upload by Daniel Leese
# don't forget 'modprobe pwc' if needed
# set date & time fromat to DATUM, used later for "subtitle"
DATUM=`date +'%d.%m.%Y %T'`
# aquire image from webcam
streamer -s 640x480 -c /dev/video1 -o webshot.ppm
# filter image and add "subtitle"
convert webshot.ppm -despeckle -pointsize 16 -draw "gravity southeast fill grey text 10,6 'Garten, Baden-Baden, $DATUM' " webshot.jpg
# copy image to server via ssh
scp /home/pagan/webshot.jpg USER@SERVER:.public_html/webshot.jpg
To run the script without user interference you need to have a trusted ssh connection. Now you can add the following line to the crontab for e.g. hourly updates of the image:
0 * * * * /root/webcam.sh
 
Time-lapse imaging:
Furthermore the webcam can be used for creating fast motion / time lapse movies. First you need to take several single pictures with a certain ammount of time between them (e.g. 10 seconds) to combine them later on to a movie. To take the pictures i have written the following shell script:
#!/bin/bash
#
# timelapse.sh by Daniel Leese
# stores the number of passes
iCount=0
# endless loop
while [ 0=0 ]
do
# set date & time fromat to DATUM, used later for "subtitle"
DATUM=`date +'%d.%m.%Y %T'`
# Format the file number to fixed characters like 0000000001, otherwise
# the resulting files would have the wrong order for mencoder
iFileNum=`printf "%010g\n" $iCount`
# aquire image from webcam
streamer -s 640x480 -c /dev/video0 -o webshot.ppm
# filter image and add "subtitle"
convert webshot.ppm -despeckle -font "Courier" -pointsize 16 -draw "gravity southeast fill grey text 10,6 'Title, $DATUM' " /path/filename$iFileNum.jpg
# Increment the file number
((iCount = iCount + 1))
# 10 seconds pause
sleep 10
done
After recording for the desired amount of time the resulting images can be compiled to a movie with mencoder using any codec (e.g. mjpeg, mpeg4, ...)
mencoder mf:// \*.jpg on:fps=25:type=jpeg -ovc lavc -lavcopts vcodec=mjpeg -o timelapse-25fps.avi
Additional Information:
Legal situation.
Many thanks Jouni Lohikoski for his guide.