[CentOS] Web Cam - No X

Mon Jan 9 12:20:26 UTC 2006
Tony <pthagonal at gmail.com>

On 1/9/06, Tom Brown <tom.brown at goodtechnology.com> wrote:

> > I'm using the camE package from Dag's repo with a QuickCam Pro 4000. I
> > do have X, although camE is purely being used to ftp the images to
> > another location. I can't really tell for sure whether the local X is
> > important to that setup, but I suspect not.
>
> OK thanks - how do you 'capture' the images?


Here's my /etc/camE.conf - this captures a frame every 5 seconds and ftps it
off to another server:

[ftp]
host = REMOTEHOST
user = USER
pass = PASS
dir = /home/webcam
file = webcam1.jpg
tmp = imageup1.jpg
local = 0
passive = 1

[grab]
device = /dev/video0
width = 640
height = 480
delay = 5
input = webcam
quality = 80
title_text = 1
text = %d-%m-%Y %H:%M:%S
ttf_dir = /usr/share/fonts/bitstream-vera/
text_font=VeraMoBd/7
title_font=VeraMoBd/8

framerate = 1
pwc_wb_mode = outdoor

# image settings (0-100) defaults are 50
colour = 60
brightness = 50
contrast = 50
hue = 50
whiteness = 50

(obviously REMOTEHOST, USER and PASS have been changed for my security!)

and also here's my modified /etc/init.d/camE script:

#!/bin/bash
#
# camE          This shell script enables the startup of camE
#
# Author:       Seth Vidal <skvidal at phy.duke.edu>
#               modified from the yum startup script by Tony
#
# chkconfig:    345 98 02
#
# description:  Enable startup of camE, a frame grabber & ftp tool
# processname:  camE
# config: /etc/camE.conf
#

# source function library
. /etc/rc.d/init.d/functions

lockfile=/var/lock/subsys/camE

RETVAL=0

start() {
        echo -n $"Enabling webcam: "
        /usr/local/bin/setpwc -x
        /usr/bin/camE -c /etc/camE.conf >/dev/null 2>/dev/null &
        touch "$lockfile" && success || failure
        RETVAL=$?
        echo
}

stop() {
        echo -n $"Disabling webcam: "
        killall /usr/bin/camE
        rm -f "$lockfile" && success || failure
        RETVAL=$?
        echo
}

restart() {
        stop
        start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|force-reload)
        restart
        ;;
  reload)
        ;;
  condrestart)
        [ -f "$lockfile" ] && restart
        ;;
  status)
        if [ -f $lockfile ]; then
                echo $"Webcam is enabled."
                RETVAL=0
        else
                echo $"Webcam is disabled."
                RETVAL=3
        fi
        ;;
  *)
        echo $"Usage: $0
{start|stop|status|restart|reload|force-reload|condrestart}"
        exit 1
esac

exit $RETVAL

You'll probably need to delete the setpwc line, since that's an extra tool
I've copied in as a binary from a previous incarnation of my box, and I'm
not quite sure where to get it from at the moment. It just resets the colour
balance of the webcam, and may not be relevant for your model anyhow.

After these 2 files are in place, it's just a service like any other, so use
'chkconfig camE on' and 'service camE start'. Keep an eye on your
/var/log/messages, if the camera is dropping frames regularly then the
logfile can get big.

--
Cheers,

Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20060109/94f09b67/attachment-0005.html>