Linux.com

Feature: Graphics & Multimedia

Five fun ways to use a Linux webcam

By Razvan T. Coloja on February 12, 2008 (9:00:00 PM)

Share    Print    Comments   

So you just set up a Linux-compatible webcam. You've tested it with Kopete, and you can send images on MSN and Yahoo! Now what? Here are some fun things you can try.

Record yourself

One of the simplest ways you can record webcam videos is with mencoder. Using the Video4Linux driver, mencoder can take input from the webcam and save it in an uncompressed AVI file. Use the following command line to record an AVI with a resolution of 320x240 pixels.

mencoder tv:// -tv driver=v4l:width=320:height=240:device=/dev/video0 -nosound -ovc lavc -o wcrecording.avi

Substitute /dev/video0 with the device node used by your USB webcam. Since my low-budget webcam doesn't have a microphone, I use the -nosound option to skip audio recording.

If you'd rather use a GUI to do the recording, try Video4Linux Grab. It can encode DivX and XviD files of the webcam input in real time using V4L. You can choose any other video and audio codec available on your system and use the GUI to select an aspect ratio.

Make a video stream

If you have the Apache Web server installed on your machine, you can use the webcam to make a video stream and display it on a Web page. The easiest way to accomplish this is by using webcam-server. In Ubuntu you can install the application with sudo apt-get install webcam-server. Start up the server with the binary name of the utility and point your browser to http://localhost:8888 to configure it.

Webcam-server has some options you can use to change the display mode of the stream and offer your visitors some additional info. For example, you can display the date, frame rate, and number of viewers by using webcam-server -c "%d/%m/%Y %H:%M:%S - serving %%v viewers at %%f FPS". You can make webcam-server listen on another port if the default 8888 doesn't suit you by using the -p attribute. Among other things, you can flip the displayed image, adjust the gamma level, set the image capture size, and specify colors for the foreground and background of the caption text.

Monitor your house

You'd be amazed how easy it is to turn an old Linux box and a cheap webcam into a powerful video surveillance system. Maybe the best and most complex open source tool for this is ZoneMinder. Once you set it up, it gives you a Web interface through which you can monitor every corner of your house in real time. It also allows you to record movement when it occurs. You can hook up as many webcams as you like and name them according to their position or purpose. From ZoneMinder's Web interface you can choose a function for each of them: monitor, motion detection, or recording. You can even set up hotspots in the frame of view so that whatever enters the defined hotspot is instantly recorded by the respective webcam.

ZoneMinder records in JPEG format and uses FFMpeg or mpeg_encode to merge and transform the image files into a single video file. You can email the resulting MPEG file to yourself or uploaded it somewhere via FTP.

The application has tons of options that allow you to configure the server in whatever way you choose; from bandwidth usage limits to JPEG quality or multiple camera view modes, almost anything is possible. You'll need good hardware and plenty of CPU power if you plan to constantly record from several cameras, but ZoneMinder is a great open source alternative to similar commercial products.

Reduce you image to ASCII

By using HasciiCam in conjunction with an ordinary webcam, you can stream a text representation of the camera input in various ways. For example, you can set up a Web page that reloads every second or so. That consumes less bandwidth than an actual image, though of course it's not exactly high-resolution, but it is fun to watch. HasciiCam also lets you output single frames into text files to create ASCII images.

Morph yourself

If you really want to have fun with your webcam, try Cheese, a face-morphing application written for GNOME that supports both altering still images and live recordings. It can flip you, saturate you, turn you into the Incredible Hulk, or distort your face in several scary ways, then output the result as a file. The effect diversity is not that large, but you can nevertheless create some pretty funny videos with this toy.

Razvan T. Coloja has published more than 150 Linux and IT-related articles in print and online magazines. He is an editor for a Romanian magazine and one of the maintainers and editors of www.mylro.org, a Romanian Linux/OSS portal and community.

Share    Print    Comments   

Comments

on Five fun ways to use a Linux webcam

Note: Comments are owned by the poster. We are not responsible for their content.

Five fun ways to use a Linux webcam

Posted by: Anonymous [ip: 70.153.158.67] on February 13, 2008 02:19 AM
An alternative to ZoneMinder is Motion: http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome I've had luck with it in the past.

#

Five fun ways to use a Linux webcam

Posted by: Anonymous [ip: 195.6.25.114] on February 13, 2008 11:40 AM
Motion is great great tool
i used it form 3 years now

#

Five fun ways to use a Linux webcam

Posted by: Anonymous [ip: 138.246.7.108] on February 13, 2008 01:51 PM
recording works also with ffmpeg

#

Five fun ways to use a Linux webcam

Posted by: Anonymous [ip: 206.113.192.12] on February 13, 2008 08:20 PM
How about not skipping that 1st part, hotdog.

Just exactly (and I do mean exactly) what webcams work with Linux? Exactly what can I buy, and what needs avoiding?

#

List of devices and drivers

Posted by: Anonymous [ip: 70.51.80.20] on February 13, 2008 08:59 PM

Five fun ways to use a Linux webcam

Posted by: Anonymous [ip: 79.113.56.133] on February 13, 2008 08:26 PM
How about you Google it?
How about you tell me exactly (and I do mean exactly) how many webcam brands are out there?

#

Five fun ways to use a Linux webcam

Posted by: Anonymous [ip: 67.172.157.164] on February 14, 2008 04:05 AM
This is seriously an awesome article, thanks so much especially for the Record yourself section!! I have been looking for a simple way to do that, but was having trouble identifying what to do it with. The mplayer command works great! Thanks! (For those looking for an inexpensive Linux compatible webcam off the shelf, I have a Logitech Quickcam Communicate STX for $50 w/ mic. It uses the Spca5xx driver (http://mxhaard.free.fr/spca5xx.html))

#

Five fun ways to use a Linux webcam

Posted by: Anonymous [ip: 69.12.251.243] on February 14, 2008 06:36 AM
Tokbox is fun with a webcam.

#

I just bought

Posted by: Anonymous [ip: 216.48.59.163] on February 14, 2008 04:48 PM
Logitech Quick Cam Pro 9000 and it uses the UVC driver. This driver is required by all new camcorders that want the "vista" logo on them. This is actually good news since its one universal driver and it has a mac and Linux port already. I just had to plug this camcorder in and was able to use the camcorder and mic with skype and cheese right off the bat.

#

Five fun ways to use a Linux webcam

Posted by: Anonymous [ip: 208.47.135.227] on February 14, 2008 06:52 PM
They forgot to mention a program called motion. motion can be used to follow a moving object with cameras such as the Logitech Orbit.
http://motion.sf.net/
I see someone else already left one comment on motion but a second won't hurt

#

I also liked this text

Posted by: Anonymous [ip: 89.247.217.94] on February 19, 2008 12:06 AM
I haven't installed any of the apps mentioned in this article, but I when I come across an app I like and want to store the name for later, I put apt:/ in Konqueror and query my packages with it. If you're using a Debian based distro like Sidux, Ubuntu or, well, Debian, it's possible to do this with kio-apt. See http://packages.debian.org/sid/kio-apt The great part is that it's possible to store these searches as bookmarks in the browser.

#

Five fun ways to use a Linux webcam

Posted by: cranium1200 on February 20, 2008 07:46 AM
Yup that was a good knowledge for me and its worth indeed. So i am concerned about our security thats our datas, files etc could be hacked when we are connecting with other users. Does anyone know the best open source projects for Pro activation alerts which alerts our anti virus updates and all. thanks in advance for all your replies.
Thanks
Cranium1200

#

Five fun ways to use a Linux webcam

Posted by: Anonymous [ip: 85.216.56.202] on February 21, 2008 09:31 AM
For some reason, services like Tokbox don't work with the current flash player release. Tokbox just crashes Firefox as soon as it tries to access the microphone. Any ideas?

#

Five fun ways to use a Linux webcam

Posted by: Anonymous [ip: 12.169.163.241] on February 28, 2008 03:27 AM
Flash does not support v4l2, which virtually all modern webcams require. It's hard to beat Adobe for sheer lameness. So if you want to use any kind of Flash streaming, you have to use an old cam that need v4l. v4l is deprecated, but still available.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya