Screencasts in Linux

A few times a year, I try and record a screencast for one of my open source projects, and I always waste the first 15-30 minutes re-learning how to do screencasts in Linux.

Using ffmpeg

After trying a variety of GUI programs (like gtk-recordMyDesktop) with various degrees of success, I’ve had the best results just running ffmpeg from the command line. Which, given this is Linux, I guess shouldn’t be too surprising.

For my own future reference, the magic incantation I’ve been using is:

ffmpeg
  -f alsa -ac 2 -ar 44100 -i pulse
  -f x11grab -r 15 -s 1920x1080 -i :0.0
  -qscale 4 output.flv

This records directly to Flash, which, yeah, yeah, isn’t HTML5, but means, for now, it just works in all browsers.

Two tips for getting high quality screencasts with ffmpeg are:

  1. Ensure you have a recent version of ffmpeg.

    I have had good luck with 0.10.4-6:0.10.4-0ubuntu0jon2~oneiric1, which, IIRC, is newer than the one in the default Ubuntu repos, which I was originally having quality issues with.

  2. Ensure your mic isn’t over-amplified.

    I was getting terrible sounding audio for a long time before I realized my mic was over-amplified. I’m not sure how it got that way; it seems like some applications take it upon themselves to adjust it.

    You can check your mic settings in Sound Settings > Input, where there is a slider. I find “Unamplified” is too low, but “100%” is way too high–you get a constant buzz throughout the screencast.

    Putting the slider at ~20% works best for me, but it should be easy to find the ideal setting for you by doing a few test screencasts.

Using FlowPlayer

FlowPlayer is a free Flash movie player that I admittedly struggled to setup. Especially in pages that are generated by jekyll, as FlowPlayer is very finicky about the HTML being exactly what it expected.

So, along with the regular setup instructions of including their JavaScript file/etc., my current incantation that works in a jekyll/Markdown page is:

<p>
  <a href="http://.../screencast.flv" style="display:block;width:520px;height:330px;margin-left:1em;" id="player"> </a>
  <script type="text/javascript"><!-- 
    flowplayer("player", "casts/flowplayer-3.2.7.swf", { clip: { autoPlay: false } });
  --></script>
</p>

The subtle but important thing to note here is the space before the closing </a> tag; this keeps jekyll from munging the HTML into something that the FlowPlayer JavaScript doesn’t like.

Good Luck

So, that is what works for me. YMMV. If you end up recording any screenshots of your programming projects with this, post a link in the comments, I’d enjoy checking it out.

comments powered by Disqus