This series is written by a representative of the latter group, which is comprised mostly of what might be called "productivity users" (perhaps "tinkerly productivity users?"). Though my lack of training precludes me from writing code or improving anyone else's, I can, nonetheless, try and figure out creative ways of utilizing open source programs. And again, because of my lack of expertise, though I may be capable of deploying open source programs in creative ways, my modest technical acumen hinders me from utilizing those programs in what may be the most optimal ways. The open-source character, then, of this series, consists in my presentation to the community of open source users and programmers of my own crude and halting attempts at accomplishing computing tasks, in the hope that those who are more knowledgeable than me can offer advice, alternatives, and corrections. The desired end result is the discovery, through a communal process, of optimal and/or alternate ways of accomplishing the sorts of tasks that I and other open source productivity users need to perform.

Wednesday, January 11, 2012

First installment: A crude imitation of khanacademy's video lectures using GNU/Linux

The following offers a description--prefaced by a narrative about whence came my inspiration--of a rather kludgy GNU/Linux solution I cobbled together for enhancing my on-line lectures with a video element. I am far from being technically adept as a GNU/Linux user, having only lately in my 11 years of GNU/Linux use become reasonably proficient at administering my own small stock of GNU/Linux machines and my small LAN. Despite a lack of anything that could really pass as expertise in this field, I want to offer this description for two reasons: 1) it may be of help to others who are equally inexpert as I am and who wish to do something like what I've done; and 2) perhaps those who are more technically adept will weigh in and offer corrections, point out alternative applications, make suggestions for improving what I've come up with, or all of the above. It is with these caveats that I offer a description of my humble and rather unsophisticated attempts.

Perhaps you've seen some of the wonderful learning material khanacademy offers? Since I've done a bit of on-line instruction I was eager to see, once I'd heard about the site, what's being done there. I was quite pleased by what I saw and immediately saw in it an answer to a need I've perceived in my own on-line teaching endeavors; namely, how to incorporate into my on-line lectures some sort of video component.

To date, I've simply been recording lectures for my on-line course as audio files and posting the results on my course web site. I found this somewhat dissatisfying, being myself, as are many others, one who learns perhaps best with visual aids. I'd thought about how I might introduce some video element into my lectures but thus far had only considered filming myself looking into a camera and delivering a lecture. Handsome though I am, I could not see how that would result in any very meaningful enhancement to the lecture. The khanacademy method, which involves writing on a sort of virtual blackboard/whiteboard during lecture delivery, on the other hand, seemed to me a very good way of enhancing on-line lectures with video--video content that should surely enhance and augment the lectures.

A presentation program such as Power Point or OpenOffice/LibreOffice's Impress would certainly be an option for incorporating video into on-line lectures, many readers may now be thinking to themselves. That's undoubtedly true and does remain an area for me to explore further.

In terms of presentation programs, I actually have more experience with a more obscure, less polished presentation program called Magicpoint than I do with either of the more popular ones just named. The latest stable release of this program is a few years old, but it does appear the developer continues working on it as he is still, up to Jan. of 2012, releasing snapshots. As I mentioned, I consider myself still very much in the exploratory stage of enhancing my lectures with video so I undoubtedly will explore in the future the use of presentation programs for doing this. But for the moment I am quite enamored of the approach taken in the khanacademy lecture videos: being able to write or print to the screen, in a sort of chalkboard fashion, while delivering an on-line lecture, may offer the possibility of greater spontaneity and thus of more effectively commanding the student's interest during the lecture.

On seeing but a few minutes of the first lecture I accessed at khanacademy, I felt I'd found my answer--incorporating a sort of chalkboard as the video element to accompany the audio. But being a GNU/Linux user on the one hand, and something of a hardware trash-picker on the other, I wasn't sure I could pull this off. I did, as you'll see, come up with a solution that approximates--sufficiently for my current needs, in any case--the video component of the khanacademy lectures.

According to wikipedia, in addition to a screen capture program and a graphics tablet--a hardware item I do not own--khanacademy uses a freeware program called Smoothdraw for making their lecture videos (see for a fuller description of how they make their videos). One would assume that likely some video converting software, for conversion to flash, may also be employed by khanacademy. Thus, 4 basic components are required for producing these sorts of video lectures: a graphics tablet, a graphics program, a screen capture program, and possibly a video file conversion program.

In my initial tests to imitate this under GNU/Linux, I decided I would forego the graphics tablet and just use the hardware I already have--a mouse and keyboard. Should I continue to meet with success, I could later acquire a tablet so as to approximate more closely the results produced by the khanacademy. This also saved me some possible hiccups in trying to get the graphics tablet working under GNU/Linux and within the graphics program with which I'd be using it. Having attempted in the past to draw freehand and write using a mouse, I knew this meant I'd be typing to my chalkboard rather than writing by hand. Mouse use would be restricted to adding emphasis, e.g., underlining typed words, perhaps drawing an occassional simple figure like an arrow or "x," and the like.

Though I cut corners, as it were, on the hardware end, I didn't need to cut corners in two other important areas--namely the screen capture program and the video conversion program. recordmydesktop does an excellent job of screen capture, while ffmpeg does the video conversion for me--in this case from the ogg theora output of recordmydesktop to the flash format. The encoding is quite resource-intensive and correspondingly time-consuming--taking over 2 hours to encode a 54-minute lecture on this old P4 2.6 with 1 GB of RAM. But the resulting video came out perfectly fine, despite the wait.

As for the graphics program I decided to start off using tuxpaint--a graphics program for children. It's not nearly as capable as Smoothdraw--for example, it is not possible in tuxpaint to simply scroll away the screen once it's been filled up with writing. But tuxpaint does have an eraser cursor that works to reasonably good effect. It is also a fairly lightweight program, which to me is always desireable, and especially apropos given the older hardware I'm using. There are undoubteldy better choices for graphics programs--programs that would work as well as or better than Smoothdraw for creating the sorts of effects seen in the khanacademy videos. But for an initial foray into this realm tuxpaint has worked well.

As to the particulars of how I am creating my lecture videos using this system, I first start tuxpaint at 1024x768 resolution (my display is set at 1280x1024): tuxpaint --1024x768 --nosound. I then fire up recordmydesktop, as follows: recordmydesktop -x 300 -y 200 --width 800 --height 600 --pause-shortcut Control+p --no-cursor ---v_quality 12 -o recordd-desktp-vid.ogv. After I've moved tuxpaint around on the screen so that just the drawing-board portion of the program is within the frame recordmydesktop creates, I begin recording my lecture, typing in text as needed. Then, as an additional step that may or may not be needed depending on what will be done with the output file, after recordmydesktop has finished encoding the lecture, ffmpeg can be run as follows: ffmpeg -i recordd-file.ogv -s vga convrtd-file.flv.

A few explanations on the switches I use when running these programs. As for tuxpaint, the --nosound option is imperative if you expect to use this program in conjunction with a lecture. The program makes all manner of sounds in regular use--all calculated to delight children, but which would obviously be out of place in a lecture for adults. As to recordmydesktop switches, I find control+p to be a more intuitive pause key sequence than the default (control Mod1 p): this, of course, allows me to pause the video as I deliver my lecture, then to resume it. The --no-cursor switch, as should be evident, causes the cursor to not be recorded in the video. Finally, since I do not need a very high-quality video in the final output, and since I want to decrease the file's size a bit, I use the --v_quality 12 switch (0 being the lowest possible video quality and 63 the highest).

This is a quick and dirty summary of how I've cobbled together, using a set of GNU/Linux utilities, a means of producing lecture videos that mimic crudely the final products seen on khanacademy's web site. As mentioned, I consider this an initial foray into this area. I hope to implement improvements and enhancements and, with feedback from readers who have more experience and/or expertise, to arrive at a much improved means of producing lecture-augmenting videos under GNU/Linux.

Here is a short demo video made using the kludge described above:

If you have pointers for how more effectively to create lecture videos using GNU/Linux, or can suggest improvements on the method I've developed, please offer your input!


  1. "By clicking presentation, the document becomes fullscreen, and the user can navigate through the pages just like a PowerPoint slideshow. When in presentation mode, a dial in the top right with a number in the center keeps track of the number of pages viewed."

    If I remember right you can draw whilst in presentation mode.

  2. Interesting possibility. Probably drags in a whole boatload of KDE libs/dependencies, though. I think I'll stick with Magicpoint.

  3. I'm not sure what you have in the way of hardware, but here's a good, inexpensive system for producing videos like those in Khan Academy:

    1. A Wacom Bamboo Touch digitizing tablet. These cost ca. $100 and allow for very precise drawing. Modern Linux kernels support this hardware nicely.

    2. Ardesia. This program essentially lays a virtual transparent layer (or several layers) onto the screen, and allows you to draw with lines and shapes in your choice of thickness, color, fill, etc.

    Alternative: Xournal or Jarnal. These programs allow mouse- or stylus-based annotation of pdfs (which you can make from your bitmap images). They'll also provide a blank screen for you to draw upon, and will let you change the line width and color.

    3. Kazam. This program records video and sound from your computer, either full-screen or from a selected region. It recognizes external microphones automatically; almost any usb microphone will yield better audio quality than the one that's built in to your computer.

    Addendum: I avoid slide presentation programs wherever possible; in my lectures, I generally just show bitmap images (using Geeqie). If I really want multiple images on the screen at the same time, then it's a simple matter to make such a montage using any paint program (I like Gimp). Or make a figure with LibreOffice Draw and then export it to a bitmap image. Or make the "slide" with Abiword, which has a presentation mode (change the "page" size to the proportion that the projector wants; e.g. a 10.24"x7.68" page has the same proportions as a 1024x768 projector).

    1. Thanks for the great ideas and suggestions. I'll start looking into the ones I've not yet studied. I have so far been able to try Kazam: it will not, for some reason, run on my heavily-modified Ubuntu system, even though it's installed. I'll need to take some time to diagnose that. I did acquire an older Wacom tablet but was able to experiment only briefly with it before starting the semester. I decided I'd be unable to use it this year since, under the WM I'm using, I noted that it sometimes wants to grab the application window and move it around, which really causes problem since I'm capturing a fairly small portion of the screen. But again, thanks, and I'll certainly follow up on your suggestions.