2010-07-06

Slitaz -- webcam / fswevcam



fswebcam

fswebcam is a neat and simple webcam app. It captures images from a V4L1/V4L2 compatible device or file, averages them to reduce noise and draws a caption using the GD Graphics Library which also handles compressing the image to PNG or JPEG. The resulting image is saved to a file or sent to stdio where it can be piped to something like ncftpput or scp.

root@slitaz-3:~# ls ~/Images/*.jpg
/root/Images/20100706-22:05:00.jpg /root/Images/20100706-22:06:00.jpg
/root/Images/20100706-22:05:20.jpg /root/Images/20100706-22:06:20.jpg
/root/Images/20100706-22:05:40.jpg /root/Images/20100706-22:06:40.jpg
root@slitaz-3:~# tazpkg info fswebcam

Tazpkg information
================================================================================
Package : fswebcam
Version : 20070108
Category : misc
Short desc : Tiny and flexible webcam app
Maintainer : jozee@slitaz.org
Depends : libgd
Build deps : libgd-dev
Web site : http://www.firestorm.cx/fswebcam/
================================================================================

root@slitaz-3:~# cat /etc/fswebcam.conf
# Example configuration for fswebcam
# [2006-09-05: phil@firestorm.cx]

# USAGE: fswebcam -c /etc/fswebcam.conf
# Be very quiet...
#quiet

# Or be very loud?
verbose

# The image source - In this case we are capturing frames from a TV channel
device "v4l2:/dev/video0"
input 0
loop 20
skip 2 # Skip the first two frames.
frames 1
# And capture one.
#background
palette YUV420P
#palette YUYV
#palette MJPEG
#frequency 670.90
resolution 320x240
#resolution 768x576
set brightness=60%
set contrast=13%
# Scale the image down to half it's size.
#scale 384x288
top-banner
font "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"
title "Quick Webcam"
timestamp "%d-%m-%Y %H:%M:%S (%Z)"
jpeg 95
save /root/Images/"%Y%m%d-%H:%M:%S".jpg
# Load an overlay image. This is placed above everything, including the banner.
#overlay "/home/user/outline.png"

root@slitaz-3:~#

root@slitaz-3:~# fswebcam -c /etc/fswebcam.conf
>>> Next image due: 2010-07-06 22:05:00 (UTC)
--- Opening v4l2:/dev/video0...
>>> Using 'v4l2' source module.
/dev/video0 opened.
src_v4l2_get_capability,81: /dev/video0 information:
src_v4l2_get_capability,82: cap.driver: "STV06xx"
src_v4l2_get_capability,83: cap.card: "Camera"
src_v4l2_get_capability,84: cap.bus_info: "usb-0000:00:1a.0-2"
src_v4l2_get_capability,85: cap.capabilities=0x05000001
src_v4l2_get_capability,86: - VIDEO_CAPTURE
src_v4l2_get_capability,95: - READWRITE
src_v4l2_get_capability,97: - STREAMING
src_v4l2_set_input,173: /dev/video0: Input 0 information:
src_v4l2_set_input,174: name = "STV06xx"
src_v4l2_set_input,175: type = 00000002
src_v4l2_set_input,177: - CAMERA
src_v4l2_set_input,178: audioset = 00000000
src_v4l2_set_input,179: tuner = 00000000
src_v4l2_set_input,180: status = 00000000
Setting Brightness to 18 (58%).
Setting Contrast to 1 (6%).
src_v4l2_set_pix_format,530: Device offers the following V4L2 pixel formats:
src_v4l2_set_pix_format,542: 0: RGB3 (RGB3)
src_v4l2_set_pix_format,542: 1: BGR3 (BGR3)
src_v4l2_set_pix_format,542: 2: YU12 (YU12)
src_v4l2_set_pix_format,542: 3: YV12 (YV12)
Using palette YUV420P
src_v4l2_set_mmap,648: mmap information:
src_v4l2_set_mmap,649: frames=4
src_v4l2_set_mmap,694: 0 length=16777216
src_v4l2_set_mmap,694: 1 length=16777216
src_v4l2_set_mmap,694: 2 length=16777216
src_v4l2_set_mmap,694: 3 length=16777216
--- Capturing frame...
Skipping 2 frames...
Capturing 1 frames..
.
Captured 3 frames in 0.22 seconds. (13 fps)
--- Processing captured image...
Putting banner at the top.
Setting font to /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf.
Setting title "Quick Webcam".
Setting timestamp "%d-%m-%Y %H:%M:%S (%Z)".
Setting output format to JPEG, quality 95
Writing JPEG image to '/root/Images/20100706-22:05:00.jpg'.
>>> Next image due: 2010-07-06 22:05:20 (UTC)
--- Opening v4l2:/dev/video0...
>>> Using 'v4l2' source module.
/dev/video0 opened.
src_v4l2_get_capability,81: /dev/video0 information:
src_v4l2_get_capability,82: cap.driver: "STV06xx"
src_v4l2_get_capability,83: cap.card: "Camera"
src_v4l2_get_capability,84: cap.bus_info: "usb-0000:00:1a.0-2"
src_v4l2_get_capability,85: cap.capabilities=0x05000001
src_v4l2_get_capability,86: - VIDEO_CAPTURE
src_v4l2_get_capability,95: - READWRITE
src_v4l2_get_capability,97: - STREAMING
src_v4l2_set_input,173: /dev/video0: Input 0 information:
src_v4l2_set_input,174: name = "STV06xx"
src_v4l2_set_input,175: type = 00000002
src_v4l2_set_input,177: - CAMERA
src_v4l2_set_input,178: audioset = 00000000
src_v4l2_set_input,179: tuner = 00000000
src_v4l2_set_input,180: status = 00000000
Setting Brightness to 18 (58%).
Setting Contrast to 1 (6%).
src_v4l2_set_pix_format,530: Device offers the following V4L2 pixel formats:
src_v4l2_set_pix_format,542: 0: RGB3 (RGB3)
src_v4l2_set_pix_format,542: 1: BGR3 (BGR3)
src_v4l2_set_pix_format,542: 2: YU12 (YU12)
src_v4l2_set_pix_format,542: 3: YV12 (YV12)
Using palette YUV420P
src_v4l2_set_mmap,648: mmap information:
src_v4l2_set_mmap,649: frames=4
src_v4l2_set_mmap,694: 0 length=16777216
src_v4l2_set_mmap,694: 1 length=16777216
src_v4l2_set_mmap,694: 2 length=16777216
src_v4l2_set_mmap,694: 3 length=16777216
--- Capturing frame...
Skipping 2 frames...
Capturing 1 frames...

Captured 3 frames in 0.19 seconds. (15 fps)
--- Processing captured image...
Putting banner at the top.
Setting font to /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf.
Setting title "Quick Webcam".
Setting timestamp "%d-%m-%Y %H:%M:%S (%Z)".
Setting output format to JPEG, quality 95
Writing JPEG image to '/root/Images/20100706-22:05:20.jpg'.
>>> Next image due: 2010-07-06 22:05:40 (UTC)

[..]
Writing JPEG image to '/root/Images/20100706-22:06:40.jpg'.
>>> Next image due: 2010-07-06 22:07:00 (UTC)
^CCaught signal SIGINT
Received TERM signal... exiting.
root@slitaz-3:~#