Recording desktop activity

scrot

Scrot is a command-line screen capture program. It requires a minimum of a target file, which can be in most standard graphic formats, including .png, .jpeg, and .tiff. It does not include .gif, most likely because of the boycott of the format that once existed.

The command includes several options for setting up the screen capture. By default, scrot captures the entire screen, but you can use -s or --select, then press Enter to select an area on the screen. Similarly, -u -r --focused selects the currently active window to capture.

You can set a delay before the shot is taken with -d SECONDS or --delay SECONDS, in case you have to set up something such as the active window, perhaps accompanying it with -c or --count SECONDS to provide a countdown to the moment of the shot (Figure 3). If you have multiple monitors, then using -m or --multidisp captures all of them in the single shot.

Figure 3: You can set a delay with a countdown before taking a screen capture with scrot.

Other options can control output; for example, you can use -b or --border to capture the window decorations and -t PERCENTAGE or --thumb PERCENTAGE to create a thumbnail shot. If you know that you will be editing or using the screen capture immediately, still another option is to use -e or --exec APPLICATION to open it in the application immediately after it is created, thereby streamlining your work flow by eliminating one step.

By default, scrot saves to a file with the naming format YYYY-MM-DD-HH-MM-SS_width_height_scrot.png. This name can be modified with special strings placed immediately after the basic command or immediately before the file name (Table 1). These special strings do not modify file name characteristics but extract them from the file, thus allowing you to see file characteristics without opening the file in a graphics editor. Note that the first three options only work when placed directly after the basic command.

Table 1

Special Strings for scrot File Names

String

Characteristic

$f

Image path/file name

$n

Image name

$s

Image size (bytes)

$p

Image pixel size

$w

Image width

$h

Image height

$t

Image format

cnee

The cnee tool records and replays activity in an X Window session – showing not so much events as they appear on the desktop but rather the technical details behind what is displayed. This orientation makes cnee ideal for automated testing.

In both recording and replaying, cnee can display across multiple monitors. By default, its output is saved to ./standard output – in other words, to the terminal, However, you may want to specify an output file instead with -f or --file FILE.

To begin recording with cnee, add the option --record or -rec after the basic command. You need to specify --mouse and --keyboard if you want to include their actions in the recording (Figure 4). If necessary, you can add -t or --time SECONDS to delay the start of the recording and save file space. To save even more space, use --first-last to record only the start and finish of each event. Another choice is to set the number of events to record with -etr or --events-to-record NUMBER or the time to record with -str or --seconds-to-record SECONDS.

Figure 4: Cnee shows information about the movements of a mouse across the screen.

You probably will not need any further options, but --speed-percent PERCENT sets the speed of playback and --replay-resolution RESOLUTION the resolution for playback.

recordMyDesktop

The recordmydesktop tool captures all activity on the desktop and stores the result for playback in an Ogg-Theora-Vorbis file (Figure 5). By default, this file is ./out.gov, but you can substitute another file name, so long as it has the proper extension.

Figure 5: recordMyDesktop records all desktop activity to a free file format.

At its simplest, recordMyDesktop requires only the basic command to start recording, and Ctrl+C to stop recording and save the file. However, in addition to the file name, you can fine-tune much of the recording.

To start, you set recordMyDesktop to record only events on part of the desktop. With the -x PIXELS and -y PIXELS options, you can define a region by its offset from the upper left corner, and with -width PIXELS and -y PIXELS, you can set the size of the region recorded. However, getting the exact positioning you want with these options will generally involve trial and error. Still, by combining these options with --follow-mouse, you can reduce the commands you need significantly.

Getting more complicated, you can also use -fps NUMBER to set the frame rate, with the higher number making the smoother recording. The number of sound channels is set with --channels NUMBER and the sound frequency with --freq NUMBER. If you want to add narration, --use-jack PORT will make recordMyDesktop aware of input from a microphone. Or, if such options seem too complicated, --no-sound can greatly eliminate many problem sources.

In much the same way, you can adjust the encoding of the recording with --on-the-fly-encoding, --v_quality NUMBER (0-63), or --v_bitrate NUMBER (45,000-2,000,000). However, if none of these options are meaningful for you, the more generalized option s_quality NUMBER (1-10) may be a surer alternative.

recordMyDesktop has no jurisdiction over playback, but it has no need to. Make a note of the file where its output is stored, and you can play it simply by running the file from the command line.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • recordMyDesktop

    A training video of a new application can really reduce the learning curve. The recordMyDesktop program is at an early stage of development but already stable enough for everyday use. We'll show you how to use the program to capture custom procedures in a desktop video.

  • Xnee

    Xnee, Gnee, Cnee, and Pnee – these strangely named tools record and play back mouse and keyboard actions.

  • Screencasters

    To make audiovisual content easy to understand, you can use screencast programs, of which Linux has a few.

  • Console Screenshots with Scrot

    Scrot helps users grab screenshots conveniently and quickly at the command line.

  • Screencasts on Linux Made Easy
comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News