August 17, 2004

Today's Linux screen capture technology

Author: Rob Reilly

"I'd like you to help me find out about video screen captures," said one of my editors a while back. "Sure, let me see what's available," I replied. He pointed me to a couple of Web sites to get me started, and here I am a few weeks later ready to share my findings. I'll discuss ways that you can make video clips in Linux, talk about their applications and shortcomings. I'll also cover suitable ways to view your masterpieces once they're recorded.

Video screen captures are useful for jobs like application training, computer instruction, or product demos. An example would be the little one-minute video I set up for my wife. She kept forgetting how to start up Mozilla Mail on her Windows 98 machine. I captured the mouse clicks and screen changes (in real time) as I ran through the process, saving it to a Macromedia Flash file. I then created a little Web page on one of my Apache servers, that described how to start Mozilla Mail and included a link to the Flash file. Instead of asking me how to do it, she can now just click on the video tutorial.

vncrec and vnc2swf

vncrec and vnc2swf are two small programs that run on X11-based Linux machines in conjunction with the popular Virtual Network Computing (VNC) family of remote servers and viewers.

Vncrec produces a native movie file format that can be played back by using the -p option. This setup would work well if you wanted to distribute the video clips along with the vncrec program itself to other Linux users. Vncrec files can also be converted into movie formats like animated GIF, AVI, and MPEG by using such programs as mpeg2enc.

Vnc2swf produces Macromedia Flash formatted movies that can be embedded in a web page. Although the format and player have some licensing restrictions, the players (plug-ins for browsers) are available for a wide variety of platforms, such as Windows, Macs, Linux and Solaris desktops. Here are the links for the file format and player license.

To use the VNC based capturing techniques, you'll need a server machine, perhaps a network connected Windows 98 or Linux desktop, a vncserver program, available from or and a network connected Linux capture machine. The Flash Video Screen Captures With vnc2swf story details the vnc2swf capture process. For example, a vncserver program and the Windows application you want to capture could be started on your Windows machine. A virtual desktop could then be started on the Linux capturing machine, using either vncrec or vnc2swf, where keystrokes/mouse moves are recorded. You could then run through how to use the application, in real time, then simply exit vncrec or vnc2swf to capture your little movie clip.

Capturing how something works on a Linux system is done slightly differently. All that's needed is to start a vncserver program, available in your distribution or from the sources listed above and then the vncrec or vnc2swf program on your Linux capture machine. From there it's simply a matter of running through your process and doing your job. When done, exit the vncxxx program and there's your movie.

There's even a Mac OS version of vncserver.

The VNC-style techniques also work well because you don't need a lot of video or computing horsepower to do your capture. That goes for the server (capturee) and the client (capturer) machines. This is a real plus because some of your clients might need instructional videos created from older machines. Vncrec and vnc2swf give high quality videos with very minimal hardware requirements. Try them and I think you'll like the results.


The other category of video capture program that I found was called xvidcap. It also goes by the name gvidcap, with minor differences in the graphical interface.

Xvidcap is a standalone program that grabs video from your choice of location on the screen. It produces MPEG files that can be viewed using the standard Linux Mplayer program. You can also use Xine if you have the correct video codec installed.

Xvidcap is straightforward to use. Start the program and adjust the red on-screen box to outline your area of capture. Hit the red record button on the menu bar and recording will start. The number of frames captured, frame rate and other settings can be adjusted by left clicking on the file button.

To stop recording, hit the solid square stop button. The MPEG file will be saved in your local directory. Using the default window size, about 150x75 pixels and capturing about 10 seconds worth of video produced a file size of only 28KB. Naturally, you'll probably want to do full screen captures. For that you'll need a decent Pentium 3 or 4 machine with lots of memory. My old 300 MHz, 256 MB laptop was wheezing, but it did work for the above example.

Application Of The Technology

The way you'll use the video is somewhat related to how the video is produced and the file format that is created.

The Flash file created by vncrec and vnc2swf can be dropped right into a Web page and will run on a Flash plug-in equipped browser. Obviously, videos built in Flash would be great for distribution over the Web or from internal servers inside your company. Pay special attention to matching up the window geometry -- making sure the display window is the proper size -- otherwise the image quality in the browser will be poor.

MPEG files, on the other hand, can be viewed via a standalone viewer such as Mplayer. They would be suitable for distribution on a CD, perhaps along with an MPEG player program to view them.


Adding sound to both Flash and MPEG formats seemed to be a challenge; I had very limited success. One of the local Linux super gurus said that he did live audio capture with vnc2swf using named pipes, lame and fifo. He pointed out that it wasn't easy and had a three second delay. When this guy says something in Linux is tricky, it's tricky.

On a better note, I did successfully mate a prerecorded mp3 file to a Flash demo clip using the -soundfile option; it worked without a hitch.

For training videos and demos, an acceptable way to dub in live commentary would be to script the audio on the first pass through your application, using one of the audio recorders available on Linux. Then once the audio has been recorded to an mp3 file, go back through the demo while listening to the mp3 file and at the same time capture the video using vnc2swf. It might take a couple of times to get the hang of it. When you can sync the audio dialog with your mouse movements, use the -soundfile option. Not the best, but it might work for you.

Sound with xvidcap (producing an MPEG file) seemed to be in roughly the same shape as vnc2swf. My editor worked away on trying to get sound capture to work while recording a video with one of his guru friends, and after a week was pretty frustrated. Apparently capturing screen video with xvidcap wasn't too bad, but doing the additional processing of on-the-fly audio required more juice than his Celeron Linux system could put out, even with a gigabyte of RAM. Perhaps it's possible to do post-processing of audio, like what I described for vnc2swf, using some type of an editor that works with MPEG.

Wrap Up

Overall my exploration into the world of video screen capturing under Linux tells me that the video side is fairly mature and that the audio side has a ways to go. If you keep the clips to one or two minutes in length, then demos and tutorials will be productive and useful even without dialog.

Here are a few additional sites that would be helpful:

Dan Washko's video capture page
Flash video screen captures with vnc2swf
SWF Tools home page

Rob Reilly (aka: Dr. Torque) is a professional technology writer and consultant whose articles appear in various Linux media outlets. He offers professional writing and seminar services on Linux desktop applications, portable computing and presentation technology. He's always interested in covering cool Linux stories. Send him a note or visit his Web site at