====== Webcam Usage with Linux ======
I have a webcam Philips ToU Cam Pro II PCVC 840K which can be easily used with Linux.
===== Installation =====
Installation is straightforward, there is pwc, a Kernel module which can be either compiled by oneself or, in case of Gentoo Linux, there's an ebuild for it.
emerge -av media-video/usb-pwc-re
===== Streaming =====
mplayer tv:// -vf-pre pp=hb:a/vb:a/dr:a/al:a,hqdn3d -tv \
driver=v4l:device=/dev/video0:width=640:height=480:noaudio
===== Single Picture =====
vidcat -d /dev/video0 -py -f png -o bild.png
===== Recording =====
mencoder tv:// -vf-pre pp=hb:a/vb:a/dr:a/al:a,hqdn3d -tv \
driver=v4l:device=/dev/video0:width=640:height=480:noaudio -ovc lavc -o webcam.avi
===== Uploading to a remote server =====
#!/bin/bash
#
# Taking a webcam picture and upload to remote server
# Use SSH Key authentication to avoid password prompts
# Roland Eckert
#
REMOTEUSER=johndoe
REMOTEHOST=example.com
PNAME="webcam_`date +%F_%H-%M-%S`.png"
SOURCEFOLDER="/tmp/webcam/`date +%Y-%m-%d`"
SOURCEFILE="$SOURCEFOLDER/$PNAME"
REMOTEFOLDER="/www/example.com/webcam/"
# test if folder exists
if [ ! -d ${SOURCEFOLDER} ]; then
mkdir -p ${SOURCEFOLDER}
fi
# set pwc settings
setpwc -d /dev/video0 -w auto -i 100 > /dev/null 2>&1
# take picture
vidcat -d /dev/video0 -py -f png -q 85 -s 640x480 -o $SOURCEFILE
# transfer picture
/usr/bin/rsync --quiet --archive --compress --checksum --no-blocking-io -r \
$SOURCEFOLDER $REMOTEUSER@$REMOTEHOST:$REMOTEFOLDER
# remove picture
rm $SOURCEFILE
===== Viewing webcam pictures =====
I use a script to generate thumbnails and for easy viewing, called Thumbnail AutoIndex/2.0 PHP, link see below.
===== Links =====
* [[http://www.p4c.philips.com/cgi-bin/dcbint/cpindex.pl?ctn=PCVC840K/00&scy=DE&slg=DE&grp=MONITORS_PC_PERIPHERALS_GR_DE_CONSUMER&cat=PC_CAMERAS_CA_DE_CONSUMER&sct=WEBCAMS_SU_DE_CONSUMER |Philips PCVC840K/00]]
* http://www.saillard.org/linux/pwc/
* http://www.vanheusden.com/setpwc/ - setpwc, setting various aspects of the camera
* http://staff.xiaoka.com/smoku/stuff/ThAutoIndex/ - Thumbnail AutoIndex/2.0 PHP