Screencasting on Debian: Kazam is good!

I’ve periodically done screencasting and screen recording over the last few years — mostly while running Ubuntu or Debian — and it’s been an evolving pain to find a piece of GNU/Linux screen recording software that actually works. The one I’ve had the most success with is gtk-RecordMyDesktop, but it’s confusing to configure, and can be quite picky with audio sources… sometimes making it impossible to capture audio at all. There are other alternatives — byzanz, istanbul — that tend to be just as buggy or worse.

My current use case is slightly complicated: I’m doing Google Hangouts sessions with people using the web app I’ve been working on, and I want to record the video of them using it, their audio, and my audio. Basically, I want to record my user testing sessions — so far, without success, at least for audio.

The one promising project the last time I tried was Kazam, but it was still too buggy for me to use successfully.  It looks like it’s in pretty good shape now… it lets me choose the window to record, and I can add audio from both sound from speakers and microphone, with human-readable pulldowns for which speaker device and which microphone device, and it worked successfully to record a Hangout. And, it has nice file format options (including VP8/webm, which is the best option for uploading to Wikimedia Commons).

Nice work, Kazam developers!

all IRC, all the time

For a while now, I’ve been chasing the holy grail of IRC: running my own low-power, always-on server that I can connect to from anywhere. After 6+ weeks of uptime, I’m ready to declare my current solution a success. I’m running quassel-core (and other things) on a mini stick computer, and I can connect to it from home or remotely, by desktop, laptop, or Android device (by wifi or data connection).

There are plenty of ways to do this, but it’s taken a while for me to work it out, so I wanted to write it up.

TL;DR: Get at least a dual-core ARM device that runs Linux, install quassel-core and create a PostegreSQL database for it, then use Quassel on your computers and Quasseldroid on Android devices to connect. Use an SSH tunnel to the device when you’re away from your home network.

First, the device to run it on. Just about any ARM device that can run Linux takes care of the low-power part — a rooted Android phone, a Raspberry Pi, or some other mini Android or Linux device. If you can get Debian or some other full distro running (whether natively or as a loop device inside Android), you can probably run quassel-core. But you probably want at least a dual-core device for decent performance. Here is what I’ve tried:

  • Droid Incredible (1 Ghz single core, CyanogenMod with Debian running in a chroot): This worked moderately well, but it was not completely reliable. Every week or so on average, I would have to manually restart it, and it would often have an annoying delay between sending/receiving messages and them appearing in my clients. (I suspect this is an i/o bottleneck.)
  • Raspberry Pi (on raspbmc): Terrible delay, often topping 5 or 10 seconds. While some have reported running quassel-core without issue, others have found it unusably laggy. Anecdotally, this is probably the result of slow SD cards (like the class 4 I was using); I was also using SQLite, and never tested if PostgreSQL would perform better. If you want to try it on an RPi, try a lean and clean distro on a reasonably speedy SD card.
  • MK808B (1.6 Ghz dual core rk3066, Android 4.1 running Debian via ‘Lil Debi): This worked quite well, even while simultaneously serving as a device for Netflix and other apps on my TV. The downside is that the network connection would become unresponsive pretty often. (The connection was more stable when I didn’t use any extraneous apps, and I expect that a device like this would do great with a native Linux distro… if you can it running and get the wifi working. Some of the many similar devices have wifi working on native Linux distros.)
  • GK802 (1.2 Ghz quad core Freescale i.MX6, running Debian with a 3.0.35 kernel): This is my current device, which has been great. They go for $65-70 right now (I got mine on sale for $60 from geekbuying.com). While there are faster and more efficient quad-core sticks with rk3188 processors for a little less money, some of which have working Linux distros, I went with this one because Freescale has a reputation for good documentation and for playing nicely with the free software world, and because — similar to a Raspberry Pi — the “internal” memory is a micro SD card, so you don’t have to worry as much about bricking it. There’s a nice little Debian installer I used to get up and running, and you can also run Ubuntu on it pretty easily. After pinning udev, I was able to upgrade to Jessie without too much trouble. The class 4 micro SD card I’m using is probably the main system bottleneck, but it’s been able to handle Quassel just fine. Update 2014-09-12: You can get a more up-to-date kernel now. See here, particularly the links in the comments. And if you run into trouble, visit #imx6-dev on freenode IRC.

Second, quassel-core and the database. You’ll probably want the latest version, so on Debian you’ll probably want to use Testing (currently, “Jessie”). For the database, you should definitely use PostgreSQL instead of SQLite. SQLite will work well at first, but as the database grows it will take longer and longer for clients to connect and receive the backlog. Eventually, when my SQLite database hit about 180mb on my MK808B, it wouldn’t connect at all. With six weeks of Postgres so far, I’ve seen no degraded performance as the database grows. Unlike with SQLite, though, you’ll need to do some command line work before you can set up the client.

Third, the clients. The desktop Quassel client is available on just about any system, and you’ll need to use it at least to set up your database initially. Quasseldroid is the Android client, which I like a lot. There’s also iQuassel for iOS, which I haven’t tried. Even on a modest Android device, you can pull tens of thousands of backlog messages in a few seconds.

Fourth, remote connections. There are many ways you could connect remotely to your quassel-core, but the one I’ve been using is just to SSH into the device, so that I can restrict password logins and use only ssh keys. On my Ubuntu laptop, I do a socks proxy for the Quassel port, like this:

ssh -D 4242 root@<my-server-ip-address>

On (rooted) Android devices, I use SSH Tunnel by Max Lv, which lets you route individual apps through SSH. In that case, I tunnel the Quasseldroid app to the Quassel port on my server, and then set up the connection within Quasseldroid to “localhost”.

If you don’t have root, or you use iOS, or you just want a simpler setup, you could just allow connections from the Internet straight to your Quassel port.

All this may seem pretty complicated, but once you get it set up it’s extremely usable. (Any questions about the details, just ask.)

Use a spare Android phone as an always-on IRC connection.

I ordered a Raspberry Pi (which should arrive in a few weeks), and my first project was going to be to set it up as an always-IRC connection using quassel. I use IRC regularly, usually from my desktop, but I don’t like leaving my 200w computer running all the time. (The electricity cost adds up quickly!) . If not for IRC, I’d set it to hibernate after 10 or 15 minutes of inactivity. Then I realized, why wait until I get the Pi? I’ve got my old Android phone (a Droid Incredible), which could serve just as well. Now I’ve got a quassel-core that I can leave on all the time, which runs on about 2 watts! It’s pretty easy, if you’ve got a rooted android phone you aren’t using.

First, install a standard Linux distro on the phone. I did this using Debian Kit, which let me put Ubuntu 12.04 on without much hassle. Just follow the instructions.
Then, within your Linux terminal, run:

apt-get install quassel-core

That should get you everything you need. To start it, just run:

quasselcore

Then plug in your phone and turn off the screen, and it’s ready to set up as your always-on IRC connection. (You need to be connected to your wifi network, and the phone should be set not to sleep, so that it maintains the connection.) You probably also want to follow these instructions to set up SSL, especially if you run an open wifi network at home. They worked for me verbatim; just run this before starting up quassel-core:

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout ~/.config/quassel-irc.org/quasselCert.pem -out ~/.config/quassel-irc.org/quasselCert.pem

Find out the local IP address of that phone, and then you can run a quassel-client (not a quassel monolithic build, which combines the core and client into one program) on any or all of your computers on the same network. You’ll need to use one of the desktop clients (Linux, Windows, or Mac) to begin, and at the first connection it’ll let you set up an administrator account. Once you’ve created that account, you can also log in from other Android phones using Quasseldroid. (It can’t set up the initial account, though.)

After that, as long as quassel-core is running, you can use whatever computer you have handy to chat on IRC, everything that happens while you are offline gets synced each time you connect to the core. This is how IRC is supposed to work!

UPDATE: 2013-06-04

I used quassel-core on my Droid Incredible for almost six months. Most of the time it worked pretty well, but at times the lag (for my own messages to reach IRC, and for others to reach me) was a problem. I recently tried setting it up on my Raspberry Pi (running it in the background on a Raspbmc system), but I experienced the same severe lag as noted on the RPi forum (actually, worse in many cases).

I’m now running it on an MK808B Android stick (which I also use for Netflix and other media on my TV), using the same method as above. This dual-core Android stick has been really snappy with quassel; backlogs load very quickly (on both the desktop client and Quasseldroid) and there’s no noticeable lag.

One thing I didn’t note above is that with Debian Kit, dpkg may report a problem when quassel-core is installed, but it will still work. (I didn’t notice this during my first installation, although it may have happened. But I tried recently on several different Android devices with both Debian and Ubuntu installations, including using other methods than Debian Kit of running Linux, and I get an error every time.)