Animated Screen Capture with Byzanz


Jarret W. Buse

Animated Screen Capture with Byzanz

Some readers may wish to create a presentation or video tutorial from their Linux workspace. The problem which some people may have is deciding which format to use for the output to allow for others to view it. An application called Byzanz allows for this ability with multiple output to animated GIF, flv, ogg, ogv or webm formats.

Before getting into the details of capturing the screen, let's look at the various formats available.

The animated Graphics interchange Format (GIF) file provides a single file containing multiple images which are displayed successively. Within the file are set time intervals which control the rate at which the images are displayed. The images shown produce an effect similar to that used in cartoon animation to provide movement. For any system which does not support animated GIF files, only the first frame of the set is displayed. The images are compressed in the file using LZW. Sound can be included in the GIF file as well. Most Web Browsers support animated GIF files.

The Flash Video (flv) format is for Adobe's Flash Player. Depending on the encoding used to create the file, a CODEC may be needed to allow the file to be played. When encoding the video, the encoding is lossy. Lossy encoding means that the amount of colors is reduced and the images are stored using zlib. Basically, in lossy images, information is lost and the quality is reduced to allow for smaller file size. Support to view an flv file requires the Adobe Flash Player plugin. Apple's iOS devices do not support Flash Player.

NOTE: A Codec is a device or program which encodes and decodes a stream of data. Streams of video and audio can be encoded into a single file which is then decoded to be viewed.

The ogg format uses a lossy video layer with a lossless audio layer. Lossless is opposite of lossy and means that the original data is intact. The video data is reduced for smaller size and the audio is not reduced. A text layer can also be used to provide subtitles. The ogv file format is similar to ogg, but uses better codecs.

WebM is a format used as part of HTML5. WebM has supporting tags to allow for embedding of a WebM file within the HTML code. WebM is natively supported by Firefox, Opera and Chrome. Internet Explorer and Safari require third-party programs to support WebM files. Apparently, Adobe is going to provide WebM support within its Flash Player, but this has yet to be implemented (at the time of this article being written).

Hopefully, you now have an idea of which graphic format you would use, but this can be managed later. To start, you need to install Byzanz.

A good place to download the Byzanz packages are from “”. You can also use Synaptic to download Byzanz for a Debian system. My suggestion is to download the required file from the website, especially for RPM systems.

Once installed, Byzanz is a command-line utility and is run from a terminal. The synatx to record a file is:

byzanz-record [options] filename

The filename can include the path to where the file should be saved. The extension of the filename determines which format to use. The extensions are:

  • flv – flv format
  • gif – gif format
  • ogg – ogg format
  • ogv – ogv format
  • webm – webm format
  • byzanz – debug file format (discussed later for playback)

The options are as follows:

  • -a (--audio) – audio will be recorded from default audio input device
  • -c (--cursor) – records the mouse cursor (default)
  • -d (--duration=seconds) – specifies how long Byzanz will record (default 10 seconds)
  • -e (--exec=command) – starts recording and runs the command. The recording will stop when the executed command ends
  • --delay=seconds – delay before starting the recording (default 1 second)
  • --display=display – display to record
  • -x (--x=pixel) – x coordinate of rectangle to record (top left corner)
  • -y (--y=pixel) – y coordinate of rectangle to record (top left corner)
  • -h (--height=pixels) – height of rectangle to record
  • -w (--width=pixels) – width of rectangle to record
  • -v (--verbose) – output more detail

For example, to record the whole screen for 15 seconds with no audio to an ogg file in the local folder called ScreenShot, the command would be:

byzanz-record --duration=15 ScreenShot.ogg

NOTE: If your screen resolution is set fairly high and you have a high resolution wallpaper, the colors can be distorted. When recording the desktop, make the wallpaper a single color and if possible, do not minimize all windows so the wallpaper is not visible.

When the x and y coordinates are specified without height and width, the top left of the captured box is the x and y coordinate. The bottom right corner of the animation is the bottom right of the screen. For a specific area, use x, y, height and width coordinates.

I could cause byzanz to record an application being run until it is closed. To do this, I ran the command “byzanz-record --exec=leafpad ScreenShot.gif”. The output is shown in Figure 1.

Figure 1.gif


NOTE: The recording quits when the application is closed; in this example it was leafpad.

If the output format is set to the byzanz format, then the format can be converted to other formats. To convert the files, use the “byzanz-playback” command.

The syntax for the “byzanz-playback” is:

byzanz-playback input_file output_file

The input file is the byzanz file with the byzanz extension. The output file is any file type listed as an output type for the “byzanz-recorder” command. In this manner, you can record one file and then convert it to all output types.

For example, if a file were made called “ScreenShot.byzanz” and you wanted a GIF file, you would use:

byzanz-playback ScreenShot.byzanz ScreenShot.gif

I would now have a GIF file called “ScreenShot.gif”. I would still have the byzanz file which could be used to create any other supported format as well.

Byzanz can be a powerful tool to make presentations or tutorials. I suggest a little practice with it before you start using it for important videos.


Members online

Latest posts