Record screencasts to animated GIF files

Since a few people have asked me how I recorded the Plasma HowTo screencasts, I decided to post a short HowTo here. And is there any better way to show this than with an animated GIF? I can almost hear you saying “of course not!”, so here we are:

A typical record session

I use byzanz to record my desktop. It works as a GNOME panel applet but can also be used from the command line.

Now back to the screencast above. I usually do the following steps:

  1. Open a terminal to run the command. My terminal emulator of choice is Yakuake, because it’s very easy to hide and unhide.
  2. I use the following command:

    byzanz-record --loop --cursor --delay=delay --duration=duration filename

    where delay is the time before it starts recording, duration the duration of the animation and filename the name of the output file. --loop specifies that the animation will loop and --cursor makes sure that it also captures the mouse cursor. As an example, the command in the screencast is

    byzanz-record --loop --delay=3 --duration=8 -c plasma_howto-throw-ball

    Note that I’ve written -c here instead of --cursor for some unknown reason. Enter byzanz-record --help to see all options.

  3. I have a timer beside me which I start when I execute the command. After 4 seconds (3 seconds of delay + 1 second when the mouse cursor is idle) I start to do whatever I want recorded.
    Now I set the delay to 1 second and start after a short delay (~ 1 second, no timer needed). Afterwards I edit the file with GIMP to make the first frame 1 second long.
  4. When the recording is done, I preview the file in Firefox to see if it looks good. I’m pretty strict – a small mistake and I redo the recording. For example, the ball screencast I did in the screencast is on the borderline – I accidentally moved the mouse cursor one or two pixels after I’m done.

Tips

Finally here are some tips and tricks:

  • I created a new user to do the recording. This has several benefits, one being that you can nuke the Plasma config files without hesitation to restore the settings to default. The command to do this is

    kquitapp plasma-desktop; rm $KDEHOME/share/config/plasma-desktop-appletsrc; plasma-desktop

    If the $KDEHOME environment variable isn’t set, try to replace it with ~/.kde4 or ~/.kde.

  • Disable Nepomuk/Strigi and other stuff that might pop up.
  • For me it didn’t work very well to record the screencast with Desktop Effects enabled. You can disable it temporary in System Settings -> Desktop Effects -> Suspend Compositing.
  • Configure the task manager to only show tasks from the current desktop. As you can see in my screencast, I keep a Dolphin and a Firefox window opened on my other virtual desktop to quickly preview the results.
  • Gwenview also works for viewing the GIF files. However, note that it’ll loop the animation even if they’re recorded without the --loop option. I warn you about this because I learned it the hard way.
  • Most people probably know this, but to run the same command again you just have to press the up arrow on your keyboard to go back in history in the terminal – no need to copy and paste the command over and over again. Just make sure that you don’t overwrite a screencast you’re satisfied with! (Yep, it happened to me).
  • As you might have noted, my filename (plasma_howto-throw-ball) doesn’t have the .gif extension. There’s actually a reason for this – to avoid overwriting good screencasts, I add the extension when I’m happy with the screencast. Then it doesn’t matter if I accidentally run the same command again without changing the output file name.
  • How to find out the duration beforehand? You can first do a test recording to get an approximate time. If the actual record is too long – which is better than too short – you can edit the GIF file in GIMP. The frames are shown as layers, and you can edit a layer name to change the duration of that frame.
Advertisement

14 Responses to “Record screencasts to animated GIF files”

  1. xxtjaxx Says:

    Have you thought about testing vlc to do the same job it had some gif encoding available i think.

  2. Hans Says:

    Nope, didn’t know that VLC was capable of that. It also sounds more troublesome – with byzanz it was just install (OK, I admit I would do fine without three quarter of its dependencies.. ;)) and go.

  3. Diederik van der Boor Says:

    I love the fact this is being picked up! By presenting videos to the world we can give a better impression of KDE.

    I do wonder, could you also provide the videos in a high quality? IMHO low framerates and 256 colors makes animations like http://userbase.kde.org/images.userbase/a/a4/Plasma_howto-panel-move.gif look flacky, and therefore not giving a good impression of the bling KDE brings. I think it’s important for the ‘new user perspective’ to give HQ video’s. 😉

  4. Hans Says:

    Yes. There’s been talk about including videos in a welcome plasmoid (e.g. in a feed). If the Plasma guys want screencasts for something like this, the animations will probably be encoded in ogg theora.

    I’ll try to engage the community in creating the screencasts, so stay tuned if you’re interested.

  5. lefty.crupps Says:

    Not a fault of the screen cast at all (looks nice, but why a .gif file rather than HTML5 .ogg video?), but I always wondered about that Ball plasmoid. When I think ‘throw a ball’ i think there should be some forward momentum for it. The ball just really allows one to drop it. I thought myne was broken until I saw the video…

    I agree that more KDE4 videocasts would be great, from everyone in the community!

  6. Hans Says:

    Because not everyone has a web browser that supports HTML 5 yet. The advantage of the GIF format is that almost everyone can watch them without any additional plugins.

    Yes, the BbalL plasmoid is broken for me too. Not only can’t I throw it, it doesn’t even show up on my regular setup (dual screens). Furthermore, if I lock my widgets the ball can’t move (bug 203666) – I remember that it could in 4.1-something.

    Well, the best thing to do is to fill a bug I guess, and hope that the maintainer fixes it.

  7. GoblinX Project » GoblinX Newsletter, Issue 216 (09/06/2009) Says:

    […] To: Use A Screensaver As Desktop Wallpaper Record screencasts to animated GIF files Graudit – Code Audit Tool Using Grep Normalizing Path Names with […]

  8. Kolia Says:

    Hello Hans,

    Just a question: how do you handle the size of the GIF? Are you resize it after the record with GIMP?

    Also what is your screen resolution?

    Thanks

    Kolia

  9. Hans Says:

    Hi Kolia,

    No, I don’t edit the GIF files at all. As mentioned, I use a different user to record the screencasts – I’ve set the resolution for that user to 640×480.

    I usually use dual screens with a total resolution of 2560×1024.

  10. Kolia Says:

    Thanks for the fast answer, I will try it asap 🙂

  11. Hans Says:

    Update February 23, 2010
    Updated the article with some minor changes and a tip about using GIMP to edit the output files.

  12. Plasma HowTo updated « Who Says Penguins Can't Fly? Says:

    […] you want to create your own animated GIF screencasts, I have written a small guide here (updated […]

  13. New Plasma HowTo version is up « Who Says Penguins Can't Fly? Says:

    […] program I used to record these (read more about it here), byzanz, has also been updated. The new version improves the quality in some parts, but […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: