Creating Screencasts on Linux

Edit: I have updated and moved this guide to here: https://wiki.ubuntu.com/ScreencastTeam/RecordingScreencasts.

I recently created a couple of screencasts for the Ubuntu-UK LoCo team, of which I am a member. I’ve been tinkering with screencasting for nearly a year now but only recently has everything come together in such a way that I find it easy to make the screencasts. I’ve been asked to write a guide showing how I created the screencasts at quickones, and here it is. Before I go into the detail there’s some technical things I should outline up front. Various tools and utilities have been suggested to me over the last year and I have discounted many of them for a number of reasons. Hopefully this will explain what those reasons are so that you can understand why I used the tools I did. In a previous blog post I talked about screencasting in general – part 2 of that article is in the works. This post is more technical, showing how to actually do it for real.

Some arbitrary decisions I made early on in the process:-

  • Videos created should be made available in multiple formats (mpeg, ogg, mp4 etc) to make them accessible for any platform. All videos should be available in OGG/Vorbis/Theora with other formats being secondary priority.
  • Videos should be streamable using flash. Whilst flash is closed and is therefore evil it is deployed on a high proportion of Linux and non-Linux desktops.
  • In the future the videos should be distributable via CDROM and/or DVD. Ideally DVDs should play in a standard domestic DVD player.
  • Recordings should be full-screen 1024×768 showing the entire desktop so everything is visible with no resizing or moving of windows.
  • Duration should be only long enough to cover the demo and no additional fluff. I chose an arbitrary target of 5 minutes for short videos, 10 minutes for more detailed procedures, and 20 minutes for advanced topics.
  • Demonstrations should include a voice over to explain everything that happens in the video.
  • Videos should be freely downloadable and distributed via an open creative commons license.
  • Two-stage recording/encoding should be used if at all possible, that is the recording of the demonstration should be done, then after the recording is made the encoding should be done to convert the initial format to a more heavily compressed format.
  • Videos that show beginner-level tasks should be done on a basic install of Linux, not one that has already been heavily modified or has had additional software installed.
  • A title page should be shown at the start of the video depicting the title of the video, and an end page should also be shown, with a link to the home page.

These decisions led me to choose the following infrastructure to record the videos.

  • Ubuntu 6.10 (Edgy Eft) as the recording platform (because that’s what I run on my desktop).
  • A virtual machine under QEMU with the guest operating system running inside it as the platform being recorded.
  • xvidcap as the recording software.
  • avidemux and ffmpeg2theora as the re-encoding software.
  • Google video for hosting flash versions of the screencasts.
  • Archive.org as the host for the downloadable versions of the screencasts.

It’s also worth pointing out the tools I chose not to use and why:-

  • vncrec, vnc2swf, istanbul, recordmydesktop all record to formats that are not easily convertable to anything else. Whilst recording to OGG format is great, there’s precious little tools around to re-encode to other formats from OGG as the source. It’s also not sensible to try to transcode for a lossy format to another lossy format. So whilst the above tools are great at what they do, they don’t fit with my requirements.
  • YouTube uses a lower resolution for their flash rendering so the scaled video would be even less visible than it already is when made into a flash video.
  • Kino, pitivi and Diva are too immature or don’t provide the necessary features for video editing.

Add repositories

System –> Administration –> Software Sources
Tick “Community maintained Open Source software (universe)
Tick “Software restricted by copyright or legal issues (multiverse)”
Close
Reload

Install QEMU, avidemux, ffmpeg2theora, audacity on the host

$ sudo apt-get install qemu avidemux ffmpeg2theora audacity

Alternatively (preferably) qemu could be compiled from source. It’s not nearly as hard as it sounds. There’s a great guide to compiling QEMU on the Hampshire LUG wiki. Doing this means you can enable the (closed source) KQEMU module which dramatically improves performance of QEMU.

Install xvidcap

Home page: http://xvidcap.sf.net/

  • Download the .deb

Visit download page: http://sourceforge.net/project/showfiles.php?group_id=81535&package_id=83441
Download xvidcap_1.1.4_i386.deb from mirror.

$ wget -c http://kent.dl.sourceforge.net/sourceforge/xvidcap/xvidcap_1.1.4_i386.deb
  • Install the .deb
$ sudo dpkg -i xvidcap_1.1.4_i386.deb

Prepare emulation environment

  • Download necessary ISO images for installations to be performed
$ wget -c http://www.mirrorservice.org/sites/releases.ubuntu.com/edgy/ubuntu-6.10-desktop-i386.iso
  • Create hard disk image to install system into
$ qemu-img create -f qcow edgyimage.qcow 4G
  • Ensure QEMU kernel module is loaded (if you install from the repository this isn’t available)
sudo modprobe kqemu
sudo mknod /dev/kqemu c 250 0
sudo chmod 666 /dev/kqemu
  • Start QEMU with the installation CD (ISO) mounted and the hard disk image attached

The following command tells qemu to use edgyimage.qcow as the hard disk /dev/hda and the ISO image ubuntu-6.10-desktop-i386.iso as the CDROM on /dev/hdc. It will boot with 256MiB of RAM, the audio hardware enabled and the network setup so that the virtual machine is firewalled from your LAN.

$ qemu -hda edgyimage.qcow -cdrom ubuntu-6.10-desktop-i386.iso -boot d -m 256 -soundhw all -net nic -net user
  • Install Ubuntu Edgy inside the QEMU Virtual Machine as you would normally.
  • Update the Ubuntu Edgy install from the usual sources.
  • Backup the Edgy image to somewhere else, and rename it.
$ mv edgyimage.qcow edgygoldimage.qcow
  • Make it read-only so you don’t accidently mess it up
$ chmod -w edgygoldimage.qcow

Begin a recording session

  • Make a directory in which to store all this media
$ mkdir ~/VideoDemos/demoname
  • Start xvidcap

Applications –> Sound and Video –> Xvidcap Screen Capture

  • Set xvidcap recording options

Right click –> Preferences
General tab –> Switch off “Capture Mouse Pointer”

Multi-Frame tab –> Switch off “File format – auto” and choose “General AVI file (DIVX default) (mpeg)”. Switch off “Video Codec – auto” and choose “MPEG2 Video”. Switch off “Enable Audio”.

Click “OK”
Right click –> Save Preferences

Click the padlock to detach the selected area (red box) from the actual xvidcap window itself.

  • Copy QEMU image to a new file, which you then delete after you have finished recording.
$ cp edgygoldimage.qcow edgydemo.qcow
  • Start QEMU with the new image

This will start QEMU without a CDROM image, and so will boot off the hard disk image created earlier.

$ qemu -hda edgydemo.qcow -m 256 -soundhw all -net nic -net user
  • Start recording

In xvidcap click the pipette icon and then select the qemu window to select it for recording – do not subsequently move the qemu window.
Click the record icon to start recording.
Click the QEMU window to select it then press CTRL+ALT to set the focus inside the QEMU window – do not use ALT-TAB to get to QEMU because the ALT-TAB chooser will appear on the screen of the host and will be recorded by xvidcap.

  • Run through the demo

This is where you do whatever you want to record, inside the QEMU virtual machine.

  • Stop recording

When finished, press CTRL+ALT to detach the focus from QEMU then click the “Stop” button in xvidcap.

  • Rename the recorded video

$ mv ~/test-0000.mpeg ~/VideoDemos/demoname/YYYYMMDD-demoname_body.mpeg

  • Play the video to confirm it looks okay

It should play back in most video players. Alternatively you can play it back in the editor Avidemux.

  • Delete the QEMU image if the recording was okay.
    $ rm edgydemo.qcow

    Record the front and back pages

    • Within the already running QEMU VM download the ubuntu-uk-titles.odp and modify to suit.
    • Press F9 to make the presentation render full screen inside the QEMU VM
    • Record for ~10 seconds or however long an intro you think this video needs.
    • Rename the recorded video
      $ mv ~/test-0000.mpeg ~/VideoDemos/demoname/YYYYMMDD-demoname_front.mpeg
      • Press pagedown in the QEMU VM to show the second (end) slide.
      • Record for ~5 seconds - or however long outro you think this video needs.

      At this point you can shutdown the QEMU session to preserve CPU cycles. This is achieved by shutting down the OS running inside QEMU. It may shutdown completely or you may have to wait until the OS stops then just close the QEMU window.

      • Rename the recorded video
      $ mv ~/test-0000.mpeg ~/VideoDemos/demoname/YYYYMMDD-demoname_back.mpeg

      Add the front and back pages to the video

      • Open avidemux
      • File --> Open --> ~/VideoDemos/demoname/YYYYMMDD-demoname_front.mpeg
      • File --> Append --> ~/VideoDemos/demoname/YYYYMMDD-demoname_body.mpeg
      • File --> Append --> ~/VideoDemos/demoname/YYYYMMDD-demoname_back.mpeg
      • File --> Save --> ~/VideoDemos/demoname/YYYYMMDD-demoname_full_no_audio.mpeg

      Record the audio

      • Open audacity
      • Start recording "silence" for 10-20 seconds
      • Start playing the video and start talking a second or two later

      Clean up the audio

      Audacity has a simple "Noise removal" tool which gets rid of most of the nasty background noise. It's not perfect but for speech it's good enough.

      • In audacity select chunk of the "silence" at the beginning and choose Effect --> Noise Removal. Press "Get Noise Profile".
      • Select the portion of audio containing actual content then choose Effect --> Noise Removal. Press "Remove Noise".
      • Trim the audio using the mouse to select and delete. Note don't delete from the middle or your sync with the video will be "out". Instead replace any unwanted noise with silence.
      • File --> Export as WAV --> ~/VideoDemos/demoname/audiotrack.wav

      Create an audio-only file

      $ oggenc ~/VideoDemos/demoname/audiotrack.wav

      Add the audio track to the video track

      This will create the master MPEG video with an MPEG2 audio track. This is the best format for the master as it can then be converted using other free tools into other formats.

      • Open avidemux
      • File --> Open --> ~/VideoDemos/demoname/YYYYMMDD-demoname_full_no_audio.mpeg
      • Audio --> Main Track --> ~/VideoDemos/demoname/audiotrack.wav
      • Press the Audio - "Copy" drop down on the left and change it to "FFM MP2"
      • File --> Save --> ~/VideoDemos/demoname/YYYYMMDD-demoname_full_with_audio.mpeg

      Encode to OGG/Vorbis/Theora

      Convert the master MPEG2 video into a compressed OGG/Theora/Vorbis version.

      $ ffmpeg2theora ~/VideoDemos/demoname/YYYYMMDD-demoname_full_with_audio.mpeg

      Upload to Google Video

      Upload the full size MPEG video to Google video.

      A by-product of uploading to Google is that they produce an ipod compatible "mp4" version of your video. Download this and add it to your collection of media.

      Upload to hosting provider

      Upload to archive.org

      Backup everything

  • 6 thoughts on “Creating Screencasts on Linux”

    1. No, I have done nothing to xvidcap or my machine to make xvidcap faster. I use the mpeg2 codec for video and like you, no audio. I generally record 1024×768 at a target of 25fps, but it frequently drops to ~17-20fps. This is on a core2duo 6700 (2.6GHz). I’d suggest trying the mpeg2 codec, which you can always transcode to other formats later.

    2. Hi Alan,
      I show your fine screencasts and I wanted to produce my own ones. When I launch xvidcap trying to capture a small part of my screen (800×600) not even using qemu the computer slows down a lot and a get no more than 4 FPS. This happens on a Amd64 3000+ computer with nvidia gefoce 6800 as well as on a Macbook Pro Core 2 Duo !!! Do you use any trick to make xvidcap run faster ? (the commandline I used: xvidcap –mf –source shm –codec mpeg4 –format avi –audio no –file test.avi –fps 10 –gui yes –cap_geometry 800×600+200+155)

    Leave a Reply

    Additional comments powered by BackType