2011-05-09

Screencasts

I've spent most of today learning how to do screencasts on my laptop. A screencast is a short recording of a computer's screen, generally made to explain how to do something. We want to show everyone how awesome PageKite is, so I have to learn how to make screencasts.

Here's a summary of what I've learned so far...

Creating a screencast

Fittingly enough, I found a screencast demonstrating how to make screencasts on Youtube. After watching it just long enough to discover the name of the software I needed, I turned it off: I needed a program named Desktop Recorder (actually, recordmydesktop).

$ sudo apt-get install recordmydesktop

That pretty much does what it says on the tin: you run it, and it makes a video of all the activity on your screen. It will also record audio, allowing you to talk about all the clever things you are doing. Perfect!

Next up, was deciding what to put on the screen. I figured it would be easier to just run programs with the elements I wanted present than it would be to learn how to do enough video editing to combine many things into one video. So I set out to put everything I wanted on the screen.

I wanted a clock:

$ xclock -update 1

And I wanted my face:

$ mplayer driver=v4l2:width=320:height=240 -vo xv tv://

And I wanted both to stay visible all the time, in a particular places on the screen, without any ugly window decorations. These demands complicated things, but after a fair bit of searching I discovered a solution in devilspie:

$ sudo apt-get install devilspie
$ cd 
$ mkdir -p .devilspie && cd .devilspie
$ cat >xclock.ds
(if
   (is (application_name) "xclock")
   (begin
      (undecorate)
      (above)
      (geometry "140x140-0+0")
   )
)
$ devilspie &

(Omitted: I also created a similar file for mplayer and wasted lots of time tweaking the geometry and location of the two programs.)

Now all I needed to do was maximize a terminal, maximize a browser and decide what to demonstrate. So I made something up and created my first screencast! Then I created my second one, and my third, and my fourth... and deleted them all.

After about 50 tries, I ended up with a .ogv file that I was reasonably happy with. But I'm probably going to end up deleting it too.

Polishing the audio

The only thing I was really unhappy with in the screencast, aside from the fact that my hair was kinda dirty, was the amount of hissing background noise in the audio track.

So I went and took a bath, and then figured out how to use sox and ffmpeg to reduce background noise.

First I recorded some silence (actually, hissing) as a reference point, creating a file named noise.wav. Then I used that to create a noise profile for sox:

$ sox noise.wav -n noiseprof noise.prof

Then I used ffmpeg and sox to clean up the audio:

$ ffmpeg -i screencast.ogv -acodec copy -vn tmp.ogg
$ sox tmp.ogg tmp-clean.ogg noisered noise.prof 0.1 
$ ffmpeg -i screencast.ogv -i tmp-clean.ogg \
         -map 0:1 -map 1:0 -acodec copy -vcodec copy \
         screencast-clean.ogv

Much better!

Finally, I wasted a fair bit of time figuring out how to add the Benny Hill theme as a background soundtrack.

I'll leave that as an exercise for the reader, but give you the hint that it involved ffmpeg, sox -m, and a Firefox plugin named DownloadHelper...

Tags: tech, pagekite


Recent posts

...