Showing posts with label webcam. Show all posts
Showing posts with label webcam. Show all posts

Tuesday, May 06, 2008

Logitech Quickcam Pro 4000 on Linux

This post is about using a Logitech Quickcam Pro 4000 on Linux (Fedora 8) to store snapshots and producing a movie.

# Install xawtv (xawtv-3.95-7.fc8)
> yum install xawtv

# Install mencoder (mencoder-1.0-0.90.rc2.lvn8 from the livna repository)
> yum install mencoder

The xawtv package contains tools which allow you to connect to the webcam, grab pictures and videos on the fly and also produce movies from the snaps.

# Check that the webcam is recognized and broadcasting:
> xawtv -c /dev/video0 &

/dev/video0 : the device (use xawtv -hwscan to see which one it is for you)

# You can grab pictures in two ways with xawtv: using webcam or using streamer.

# grab snapshots using streamer
> streamer -c /dev/video0 -j 85 -t 1200 -r 0.03 -o office-0000.jpeg

/dev/video0 : the device
85 : JPEG quality
1200 : number of snapshots to grab
0.03 : frames per second (here it's about 1 snap every 30 seconds)
office-0000.jpeg : output file with counter to accomodate 4 digits here

# grap snapshots using webcam
> webcam webcam.conf

All configuration is read from file. My webcam.conf is:

[grab]
device = /dev/video0
text = Atlanta GA - %Y-%m-%d %H:%M:%S
#infofile = infofile.txt
fg_red = 255
fg_green = 255
fg_blue = 255
width = 320
height = 240
delay = 30
wait = 0
#input = camera
brightness = 100
#norm = pal
rotate = 0
top = 0
left = 5
bottom = -1
right = -1
quality = 85
trigger = 0
once = 0
archive = office-%Y%m%d-%H%M%S.jpg

TODO Explanation to follow...

# make movie using mencoder (you can also use streamer but I didn't try it yet)
> mencoder "mf://${CURR_DATE}/*.jpg" -msglevel all=-1 -mf fps=12:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:trell:mbd=2:dc=10 -oac copy -o "movie_${CURR_DATE}.avi"

... to be continued