old-www/HOWTO/Webcam-HOWTO/framegrabbers.html

508 lines
9.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Framegrabbing Applications</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="The Webcam HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Accessing the Video Device"
HREF="dev-intro.html"><LINK
REL="NEXT"
TITLE="Troubleshooting"
HREF="troubleshooting.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Webcam HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="dev-intro.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="troubleshooting.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="FRAMEGRABBERS"
></A
>4. Framegrabbing Applications</H1
><P
></P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="COMMAND"
></A
>4.1. Command Line Programs</H2
><P
>As implied by the title these do not require the X Window System to operate your camera and capture images.</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="STREAMER"
></A
>4.1.1. Streamer</H3
><P
> Streamer is a versatile program that allows a capture from a
webcam or video device using only the command line.
It may be offered in your Linux distribution's Xawtv package, or may need to be fetched separately as in Debian. You can find it and more information at <A
HREF="http://www.bytesex.org/xawtv"
TARGET="_top"
>Gerd Knorr's Xawtv homepage</A
>. </P
><P
>To take a standard JPEG picture from the command line where
the camera is accessed through <TT
CLASS="FILENAME"
>/dev/video0</TT
>: </P
><P
>
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
> $ streamer -c /dev/video0 -b 16 -o outfile.jpeg</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
> ...where <B
CLASS="COMMAND"
>-b</B
> is the number of colors (in bpp,
whether 15, 16, 24 or 32) and <B
CLASS="COMMAND"
>-o</B
> is the output
filename that will be dropped into the current directory (specify
<B
CLASS="COMMAND"
> -o </B
><TT
CLASS="FILENAME"
>/path/outfile.jpg</TT
> to place
it elsewhere). If you are going to capture multiple images be sure to append the output file name with zeros, as streamer can name the capture files in sequence, i.e., <B
CLASS="COMMAND"
>-o </B
><TT
CLASS="FILENAME"
>outfile000.jpeg</TT
> becomes <TT
CLASS="FILENAME"
>outfile001.jpeg</TT
>, <TT
CLASS="FILENAME"
>outfile002.jpeg</TT
>, and so on.</P
><P
> To make an .avi file: </P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
> $ streamer -q -c /dev/video0 -f rgb24 -r 3 -t 00:30:00 -o /home/jhs/outfile.avi</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
> ...where <B
CLASS="COMMAND"
>-q</B
> is for 'quiet' execution (no message
output), <B
CLASS="COMMAND"
>-f</B
> is 'format' (rgb24 is TrueColor avi),
<B
CLASS="COMMAND"
>-r</B
> is the frames per second and <B
CLASS="COMMAND"
>-t</B
>
is the time of recording (30 minutes).
Streamer can capture raw and <SPAN
CLASS="TRADEMARK"
>Quicktime</SPAN
>&#8482;
(non-Sorensen) formats and can capture audio as well.
See <B
CLASS="COMMAND"
>streamer --help</B
> for more information. </P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="CAME"
></A
>4.1.2. camE</H3
><P
> CamE is a command-line program that works in daemon mode to
capture frames from your v4l device for archive or upload (to a webserver,
for example) via ftp or scp.
You can overlay other graphics, timestamp the frames, or add other dynamic
text all by altering the appropriate line in the configuration file.
See <A
HREF="http://linuxbrit.co.uk/camE/"
TARGET="_top"
>the camE homepage</A
>
for more information. </P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="MOTION"
></A
>4.1.3. Motion</H3
><P
> Motion is a brilliant program that is able to monitor the video
signal from one or several webcams.
It can record periodic snapshots, and when motion is detected, record an
mpeg and/or perform another action such as sending an email or executing
a command.
It can track and graphically mark the motion it detects, feed files via an
http server to your website, stream them to another application and more.
The number
of command line options may be intimidating; there is however, a <A
HREF="http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuide"
TARGET="_top"
>Wiki
available online</A
> that outlines the various command and
configuration file options nicely.
The motion homepage can be found <A
HREF="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome"
TARGET="_top"
>here</A
>.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="WEBCAM"
></A
>4.1.4. Webcam</H3
><P
>Webcam is an automated command line tool for operating a webcam that is also available from
<A
HREF="http://www.bytesex.org/xawtv"
TARGET="_top"
>the Xawtv homepage</A
>. It is excellent for automated operation such as from a cron job, as it requires no
command line options, only a previously edited configuration file (usually <TT
CLASS="FILENAME"
>~/.webcamrc</TT
>). It is similar to camE above in that one can captures images and upload them to a Web-Server via ftp or ssh.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="SANE"
></A
>4.1.5. SANE</H3
><P
> SANE, or Scanner Access Now Easy, supports access of v4l devices including webcams in later versions.
If you are familiar with using a photographic scanner device in Linux,
you may be interested in using SANE for image capture, especially since
a few devices double as both scanners and digital cameras.
See the relevant sections of the Scanner-HOWTO <A
HREF="http://tldp.org/HOWTO/Scanner-HOWTO/sane.html#getting-SANE"
TARGET="_top"
>here</A
>.</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="GUI"
></A
>4.2. GUI(Grapical User Interface)-Based Programs</H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="XAWTV"
></A
>4.2.1. Xawtv</H3
><P
> Xawtv is an X-based program for accessing video devices
in Linux including TV tuning devices and webcams.
The home page is at <A
HREF="http://bytesex.org/xawtv"
TARGET="_top"
>http://bytesex.org/xawtv</A
>.&#13;</P
><P
> When you first try out your webcam, and you think things are
configured right, use the -hwscan option: </P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
> $ xawtv -hwscan This is xawtv-3.72, running on Linux/i686 (2.4.21) looking for available devices
/dev/v4l/video0: OK [ -device /dev/v4l/video0 ] type : v4l name : BT878(Hauppauge (bt878)) flags: overlay capture tuner
/dev/v4l/video1: OK [ -device /dev/v4l/video1 ] type : v4l name : IBM USB Camera flags: capture</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
> ...so now you can see the available devices (your output may
differ substantially).
Try opening an xterm and running xawtv, grabbing from your webcam video
device: </P
><P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
> $ xawtv -c /dev/video1 This is xawtv-3.72, running on Linux/i686 (2.4.21)</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
> ...and (hopefully) your camera will begin capturing to a window
on your desktop.
You may see some error messages in your xterm if things don't work that
can be helpful to diagnose configuration problems.
If you aren't interested in all that, and things work for you, launch
from your window manager's menu next time.
You can read about more xawtv options with <B
CLASS="COMMAND"
>man xawtv</B
>.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="GQCAM"
></A
>4.2.2. Gqcam</H3
><P
> <A
HREF="http://cse.unl.edu/~cluening/gqcam/"
TARGET="_top"
>Gqcam</A
>
is a graphical GTK+-based application originally written to access
Connectix QuickCams but now supports nearly all Video4Linux compatible
webcam devices.
It has an intuitive interface that makes viewing, taking snapshots,
and configuring webcam settings blissfully easy.
It is highly recommended for those who only want to take a picture here and there without editing a
configuration file or using the command line. </P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="CAMORAMA"
></A
>4.2.3. Camorama</H3
><P
>Camorama is a graphical GTK+2.0-based application very similar to gqcam written for the Gnome2 desktop. The home page is <A
HREF="http://camorama.fixedgear.org/"
TARGET="_top"
>here</A
>.</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="GNOMEMEETING"
></A
>4.2.4. GnomeMeeting</H3
><P
>GnomeMeeting is a VOIP/IP-Telephony application for the Gnome2 desktop that also supports videoconferencing with a webcam. The homepage can be found at <A
HREF="http://www.gnomemeeting.org/"
TARGET="_top"
>gnomemeeting.org</A
>.</P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="dev-intro.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="troubleshooting.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Accessing the Video Device</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Troubleshooting</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>