Ian Ward

CKAN contributor/tech lead
Urwid author
PyRF contributor
Speedometer author

Contributing to Open Source
IASA E-Summit, 2014-05-16
Urwid Applications
Urwid Intro
Unfortunate Python
Django 1.1

Moving to Python 3
Article Tags


Ian Ward's email:
first name at this domain

wardi on OFTC, freenode and github

Locations of visitors to this page

Creating High-Resolution Screencasts with vnc2swf

Posted on 2008-07-05.

This article covers the process I used to create the screencast of Bart's first Kernel Walkthrough.

This is a list of the software you will need:

Most of these packages may be installed in recent versions of Debian or Ubuntu with the following command:

sudo apt-get install x11vnc pyvnc2swf alsa-utils audacity ffmpeg

Lame is available from unofficial apt-sources and Flowplayer must be downloaded from sourceforge.

I used a separate machine for recording, connected via ethernet cable to the target machine. The microphone must be connected to the recording machine. I used a USB headset for the recording which appears as "card 1, subdevice 0" when I listed my recording devices by running arecord -l. ALSA refers to this device as hw:1,0. To monitor the recording level while recording you need to create a "dsnoop" ALSA device. This device may be created by putting the following lines in a file called .asoundrc in your home directory:

pcm.dsnooped {
    type dsnoop
    ipc_key 234884
    slave {
        pcm "hw:1,0"
        channels 2
        rate 44100
        period_time 0
        period_size 1024
        buffer_size 8192

The fist line says we are creating a new ALSA PCM device called dsnooped. The ipc_key setting is not special, it just must be unique. The period_time, period_size and buffer_size settings were ones I found that worked well on my system.

Audacity Meter Toolbar

Launch audacity and point it at the new dsnooped device, then click on the meter toolbar to start monitoring the levels. Use a mixer program like Gnome's Volume Control to adjust the recording volume so that it is as loud as possible without clipping. I used aumix on the command line:

aumix -d /dev/mixer1

Before starting the recording switch the target machine to a suitable resolution. 800x600 is the maximum I would recommend for the video to fit within most people's web browser windows. Start your VNC server on the target machine:

x11vnc -viewonly -loop

The -loop option will let you reconnect without restarting the server. Use a command like this to start recording:

vnc2swf -n -o tutorial.swf -N -S "arecord -f cd -t wav voice.wav -D dsnooped -c 1"

This starts recording the video from the VNC server on the target machine at The video is stored in a file called tutorial.swf and the audio is stored in a file called voice.wav. Interrupt the command with CTRL-C when you are done recording.

Open the voice.wav file in audacity to clean up the audio and make a note of what time offsets you clip and the beginning and end. The video is recorded at 12 frames/second, so multiply the offsets by 12 to obtain the frame numbers for clipping the video to match:

vnc2swf-edit -K 240 -f 1044-4572 -o tutorial.flv tutorial.swf

This creates a FLV file from our video recording with keyframes every 20 seconds (20 * 12 = 240) and with the start and end adjusted to 87 seconds and 381 seconds (87 * 12 = 1044, 381 * 12 = 4572). Next encode your edited audio to an MP3:

lame -b 112 -q 0 voice.wav voice.mp3

This creates a 112 kbit/s constant bitrate MP3 file. Variable bitrate files are not supported by the FLV format. Finally, attach the audio to the video file:

ffmpeg -i video.flv -i voice.mp3 -acodec copy -vcodec copy final.flv

The final.flv file is suitable for playing in embedded players like Flowplayer. Follow the instructions on the Flowplayer site for incorporating the player in your web page. Remember to adjust the size of the player in the Javascript or CSS so that the video plays at its original resolution. The Flowplayer skin I used had a panel 28 pixels high so I set the player's size to 800x628 for an 800x600 video. If the size is incorrect the video will appear blurry or uneven.

I left out setting up video streaming (allowing seeking to any point in the video) this time. I will post another article when I get that working too.

Tags: Software Video Linux Python