Skip to content

Recording screen demos on (Ubuntu) Linux

You may well have recently read my glee at getting a decent screen recording solution for Linux running and working, and this tutorial on how to get it to work for you has been brewing for a while now.

However, this solution is not just for Linux. It’s actually cross-platform and works across the big three main operating systems and should work on other Unix systems with little changes. Don’t worry, the Windows tutorial is coming up soon!

(Quick note – there are a couple of issues that I haven’t ironed out yet in this tutorial, but I wanted to get it out on my site sooner rather than later. They don’t affect installation, but I can’t seem to get recording in Ubuntu yet. It’s still worth running through the install, however, and rest assured I am working on the problems and will get them fixed as soon as I can!) All fixed!

This is also the first tutorial to be brought to you courtesy of my fresh new Ubuntu installation, just for doing tutorials (so I don’t have to uninstall and reinstall everything from my main machine where it’s working nicely, and of course for Ubuntu specific stuff).

OK, let’s go!

Prerequisites

First of all, there’s some stuff that we need and stuff that I recommend we have in order to do this:

Required:

  • Python (should be installed already)
  • pygame
  • A VNC server and viewer (I recommend TightVNC, but anything will do)
  • You need the Universe and Multiverse repositories enabled, see here for details

Recommended:

  • pymedia
  • Audacity with lame MP3 library (to convert .wav to .mp3 for audio support)

Setting up

OK, today I’m going to be quite Ubuntu-specific, but if you’re on anything else, I’m sure you can use a similar package management program to find and install the required stuff. I’ll also try and avoid the command line wherever possible :).

First of all, let’s get pygame. Click Applications > Add/Remove to start the package manager. If you are told the list is out of date, go ahead and click Reload and wait until it’s finished. Click Advanced and enter your password when prompted.

Click Search and search for pygame. Click on the tick box for python-pygame and choose Mark for installation. Accept the next dialogue box asking you to install other required stuff.

Do the same thing for Audacity. Run a search for audacity and mark it for installation – it may already be installed depending on your set up. Don’t install it again if it is.

Exactly the same for lame. Search and then choose to install the result with the name as just ‘lame‘.

The same process applies for TightVNC. A search for tightvnc yields multiple results. We want the packages tightvncserver and xtightvncviewer.

Now, click Apply on the toolbar and wait while the relevant packages are downloaded and installed. When that finishes, close down all the related windows.

Setting up your virtual environment

Browse to your home folder and go into the folder .vnc (it’s hidden, so go to View > Show Hidden Files to see it). Open up the file xstartup in your favourite text editor. Replace everything in that file with one of these:

To run Gnome in your virtual recording environment:

 #!/bin/sh
gnome-session &
metacity --replace &
nautilus -n &
gnome-panel &

(Note that this is a terrible way of doing it, and to get your theme to work properly, you need to go to System > Preferences > Theme before you start recording. If anyone knows a better way of doing this, please let me know!)

For KDE:

 #!/bin/sh
startkde &

Next, open up a terminal (be glad we haven’t used it already). Type the command:

$ vncserver -geometry 800x600

What this will do is create a new ‘virtual’ desktop of 800×600 size which we can have inside a window on our real desktop where we will be recording the screen. The first time you run this, you will be asked for a password. Remember this as you’ll need it every time we run a screen demo.

OK, so now that your virtual session is running, we need to load it in a window so we can interact with our virtual desktop. To do this, go back to the terminal and run the following:

$ xtightvncviewer localhost:1

Enter the password you set earlier, and you will get a window with your virtual recording desktop inside. Cool! Have a play around.

When we’re finished with our virtual desktop, we need to close it down. Close the viewer window, then run this command:

$ vncserver -kill localhost:1

This shuts down our virtual screen and puts it away.

Setting up pyvnc2swf

Finally, we need to get pyvnc2swf and install it into your system. Download the latest .tar.gz of the Python version from the site (I’ll assume you’ve saved it to the desktop).

Right-click the new file and choose Extract here. At this point I suggest you move the new folder it creates to a good location. If you have a bin folder for storing programs, put it there. If not, create a folder called bin in your home folder and copy this new pyvnc2swf-x.y.z folder inside the bin folder.

Performing your first recording session

I won’t go into too much depth here, it’s already been quite a long tutorial so I’ll save some cool stuff like audio, file formats and editing for later.

Basically, to start recording, do this from your terminal.

$ vncserver -geometry 800x600
$ xtightvncviewer localhost:1 [[at this point open a new terminal window]] $ ~/bin/pyvnc2swf-0.8.2/vnc2swf.py localhost:1

In the window that appears, choose Save As to find a location to save your output file. Then hit Start to start recording. Do your stuff! Then hit Stop when you’re finished and you will find two new files, one with an .swf extension (this is the Flash file) and the .html file is suitable for loading into your web browser to view your handywork (obviously you’ll need Flash Player in your browser).

If you’re getting a connection refused error when clicking Start, so am I, and I’m working on it, but I thought rather than delay the publication of this tutorial (again), I’ll update it when I find the solution and hope it works for some people.

Works now – the fix is to tell vnc2swf.py to connect to localhost:1 not nothing (i.e. localhost:0).

Closing pyvnc2swf is sometimes buggy and doesn’t work. If this happens, go back to the terminal where you started it and hit Ctrl+C.

That’s it for this time, but I’ll be back with some audio and editing tips for Ubuntu and the complete guide (again) for Windows XP.

Enjoy!

Like this post?

If you would like to support the time and effort I have put into my tutorials and writing, please consider making a donation.

One Comment

  1. Doug wrote:

    You have great tutorials. I haven’t tried this one yet but will get to it. Thanks for taking the time to post these tutorials as I don’t know how to do much with my computer except to browse the web and read emails. Again, many thanks

    Monday, February 25, 2008 at 17:06 | Permalink | Using Mozilla Firefox Mozilla Firefox 2.0.0.12 on Ubuntu Linux Ubuntu Linux

One Trackback/Pingback

  1. […] Recording screen demos on (Ubuntu) Linux […]

Post a Comment

On some sites, you must be logged in to post a comment. This is not the case on this site.
Your email address is not made public or shared. Required fields are marked with *.
*
*
*

Posting a comment signifies you accept the privacy policy.
Please note — usually your comment will appear straight away but sometimes it will be held for approval (this is due to the spam filter). If your comment is waiting to be approved, please don’t post it again! It will appear eventually.