Record Your Desktop into Animated GIF via Linux Command

Looking for a command line tool to record your Linux desktop into animated GIF, FLV, OGG, or WEBM? Try byzanz-record.

Byzanz is a small and efficient screencast creator to record a rectangle area to an animated GIF, Flash. It consists of two different tools: byzanz-record, and byzanz-playback.

I use Peek to record animated GIF. It’s great, but can not record the top panel in Gnome desktop. So I use byzanz-record instead when trying to record anything in the top-bar.

byzanz-record command examples:

1. To record a 15 seconds GIF of a rectangle area at top-left, you can run:

byzanz-record --duration=15 --x=0 --y=0 --width=1000 --height=600 output.gif

Here the flags include:

  • --duration=15, specify duration of animation to 15s. Remove the flag will record 10s GIF by default.
  • --x=0, --y=0, specify the x,y coordinates of the upper-left corner of the rectangle area.
  • --width=1000 --height=600, specify the width and height of the rectangle area.
  • output.gif, specify the output file. You can also use output.flv, output.ogg, output.webm.
All the following examples are running on 1600x900 screen resolution. You may change --x and --y value if you have another resolution.

2. You can include cursor by adding --cursor flag. For instance, record a 10 seconds WEBM of 700×400 rectangle in center of the screen:

byzanz-record --cursor --x=450 --y=250 --width=700 --height=400 output.webm

3. And record audio with --audio flag. For example, record 12 seconds FLV of top-center 700×400 rectangle including the cursor:

byzanz-record --audio --cursor --duration=12 --x=450 --y=0 --width=700 --height=400 output.flv

4. The command by default start recording with 1 second delay. You can change the value via --delay flag. For instance, record 10 seconds GIF of top-right corner 700×400 rectangle area with 5s start delay:

byzanz-record --delay=5 --x=900 --y=0 --width=700 --height=400 output.gif

5. Add you can use --exec instead of --duration to record given COMMAND and record until the command exits.

For instance, record the whole screen while running “sudo apt update” command:

byzanz-record --display=:1 --exec="sudo apt update" record-exec.gif

You may also specify the display to record using --display flag. And get display value via echo $DISPLAY command.

How to Install byzanz in Linux

The tool is available in most Linux repositories. Just open terminal and select a run to command in your Linux Distro.

  • For Ubuntu, Debian, Linux Mint based systems, run command:
    sudo apt install byzanz
  • For Fedora based systems, run command:
    sudo dnf install byzanz
  • For Arch Linux, Manjaro, run command:
    sudo pacman -S byzanz

And for more about the command line screen recorder, run man byzanz in terminal.

Merilyn Ne
Hi, I'm Merilyn Ne, a geek who has been working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.