Freitag, 11. Dezember 2015

Screencast an X11 window by keyboard events

Recently I had the requirement to generate a screen cast of a keyboard interaction. There are many full featured application for Windows or Linux to generate screen casts, but they generate often big MPEG files, because they capture 30 or 60 screens per second and use lossy compression algorithms to minimize the file size. This is fine for video games and OBS does a pretty fine job, I have used it recently myself to capture a Diablo III PTR 2.4 session. But all this is not necessary, if one wants to capture keyboard interactions.

Keyboard interaction is triggered by pressing any keys. On Linux running a X11 server xinput can be used to capture keyboard events. And the standard X11 tool xwd can capture a window. And the ImageMagic can be used to combine several images into an animated GIF. This makes it possible to illustrate a keyboard interaction by pretty small GIF images.

I wrote a simple tool called xscreencast, which implements the above idea. It is hosted on GitHub. I have used it to illustrate the difference of the cursor color of a terminal window and Emacs on Stackexchange. This are the screen casts generated by the Perl script.

This is the terminal.

And this is Emacs.

Keine Kommentare: