Byzanz 0.2.0

I wanted to do something “easy”. And with that I mean hack on code that doesn’t need reviews by other people or tests or API/ABI stability. But I wanted to do something useful. And I found something: I dug out Byzanz, the desktop to GIF recorder tool I wrote almost 4 years ago.

The first thing that stood out to me was the ugly functions this code uses. Functions like gdk_drawable_copy_to_image() or gnome_vfs_xfer_uri() are really not to be used if you want maintainable code. So I replaced GDK with Cairo functions and gnome-vfs with gvfs. It looks much nicer now and is more powerful, too. So if you still have code that uses outdated libraries, make the code use modern ones. It’s worth it.
This whole process comes at a bit of a cost though: Byzanz absolutely requires bugfixes that are only in the (so far) unreleased git master trees of Cairo, Gtk and GStreamer. So for now Byzanz is the most demanding application available on the GNOME desktop!

Next I realised that I learned a lot about coding in the last 4 years. My code looked really ugly back then. So I made it not use bad things like nesting main loops (do NOT ever use gtk_dialog_run()), follows conventions (like gio async functions handling) and refactored it to have a sane structure. While doing that I easily got rid of all the bugs people complained about. That was fun.

Then I made sure to document the goals that guided my design of Byzanz. From the README:

  • purpose
    Byzanz records animations for presentation in a web browser. If something doesn’t fit this goal, it should not be part of Byzanz.

  • correctness
    When Byzanz provides a feature, it does this correctly. In particular, it does not crash or corrupt data.

  • simplicity
    The user interface and programming code are simple and easy to understand and don’t contain any unecessary features.
    Byzanz does not attempt to be smarter than you are.

  • unobtrusiveness
    Byzanz does not interfere with the task you are recording, neither by keeping a large settings window around nor by consuming all your CPU during a recording.

Those goals are a really useful thing, because they ensured I didn’t add features, just because I could. For example, I’d really like to add visual clues about key presses or mouse clicks. But I couldn’t find a way to make this work simple and unobtrusive. And making people fiddle with settings before a recording to enable or disable the feature is bad.

But I added a feature: Byzanz can now not only record GIF images, but also to Theora or Flash video. The web has changed in the last 5 years and supports video formats now, so it’s only following Byzanz’s design goals to add these formats. Fwiw, I only added Flash video because it’s the only lossless format. So if you wanna do post-processing in Pitivi (like add text bubbles), you wanna use the Flash format.
I also updated the UI: It asks for the filename before starting the recording, so it can save animations to your FTP while you record. And I added a bunch of niceties like remembering the last filename. Repeating a recording that doesn’t look quite right is 3 clicks: Click record button in panel, return (to select the same file), return (to confirm overwriting). Nifty that.

So, if you have a jhbuild: Get the shiny new Byzanz 0.2.0.


#1 Michael on 08.30.09 at 22:53

Very nice, but too bad for me, this requires git version of the various component. I think you should maybe blog again in some time, once the various bits have landed in the distribution ( I was planning to update the mandriva rpm, without success ).

#2 Christian Kellner on 08.30.09 at 23:44

Self-Reference missing alert. I mean. Where is the ogg/flash/gif video of the new version. Eh? ;-)

#3 Dave on 08.31.09 at 12:49

The latest Theora includes support for Variable Frame Rate. It’s a bit of a hack based on detecting if two frames are identical and noting that fact. So while you technically still have a constant rate of Frames, some of them can be no-ops. I imagine this would be very useful for screencasts where nothing is happening a lot of the time.

Theora will detect duplicate frames itself and so this improvement in bitrate and decode performance will just happen under the covers, but if you are aware of the duplication ahead of time you can feed this info to the encoder and save it some work.

Are you aware of anything that would allow Byzanz to provide this info to Theora, based on its knowledge of whether the screen has updated or not?

#4 Dylan on 08.31.09 at 17:15

Hope you find a way to include key/mouse events. Maybe a record first, tweak later approach will be less obtrusive. That is, store key presses and mouse clicks in a separate file, and merge them afterwards based on timestamp, like subtitles. As a matter of fact, just storing the events in a file format that can be read by Gnome Subtitles would be very useful, because that would allow you to tweak/annotate the recording afterwards.

#5 otte on 09.01.09 at 09:12

Michael: yeah, it’s a bit bad that it requires git master of all packages – but I wanted to get a release out.

Christian: Dude, it’s so easy, you can record your screenshots yourself! (Yes, Byzanz needs a webpage but I’m lazy.)

Dave: Yeah, Theora proper has some interesting capabilities that I might want to exploit, like 4:4:4 YUV input and variable frame rate. But considering I’m doing this from GStreamer and relying on its colorspace conversion etc plugins, it’s kinda hard to use theora directly. Maybe I should hack the GStreamer plugin instead…

Dylan: I’d like to hear from people that actually do screen recordings for how they post-process their recordings. At that point, it should be kinda trivial to extend Byzanz and GStreamer (and Pitivi?) to use a format that provides all the needed information (and tools?) to make the recordings awesome. But I haven’t really heard of people doing recordings.

#6 Peter Lund on 09.01.09 at 09:33

“Byzanz does not attempt to do be smarter than you are. ”

“to do be” ? ;)

#7 otte on 09.01.09 at 10:59


#8 Pablo Rodríguez on 10.11.09 at 10:02

Sorry, my system is too old to check this (openSUSE-11.1), but do you plan to support sound recording in Byzanz?

#9 otte on 10.11.09 at 10:34

The biggest problem with sound support is having a simple user interface for doing sound recording, in particular because the (default) GIF format does not support it.

So unless I can come up with a good solution to that (and it has to work, too – but I guess microphones are not the headache they were last I tried), I might look into it.

Of course, if you want to try, go ahead and send patches. :)