For the past few weeks I've been exploring different methods of creating videos. There are two specific things I want to do with videos in my course:
- Create videos of tasks being performed on the desktop (screencap videos), primarily to create tutorials to help students use Excel, browse my course website, and other such things.
- Create animated mini-lectures on key topics, probably based on PowerPoint (or OpenOffice Impress) slides. These will ideally be less than 5 minutes each and contain a combination of text, images, and animations.
The predominant free open source video capture solution for Linux seems to be xvidcap. The program is completely free; it can be downloaded from xvidcap's Sourceforge page. They even have a .deb file that installs in seconds on Ubuntu; to install it all you have to do is download the .deb file and then double-click on it in the file browser (Nautilus), which will bring up a dialog that installs the program.
Using xvidcap is fairly straightforward; it has a small control panel and a little red box. Once you hit record on the control panel, xvidcap records everything that occurs in that little red box. The box can be resized to fit whatever you want to record using the eyedropper tool, which allows you to either click and drag to move the box or click into a program window to have the box sized to fit that program's window. The box is attached to the bottom of the control panel by default, but can be undocked from the control panel by hitting the lock button.
Screenshot of xvidcap; the program records everything that occurs in the red box.
The preferences are accessed by right-clicking on the filename (to bring up the main menu) and then clicking "preferences." Xvidcap can either save a series of screencaps to a directory (what xvidcap calls single-frame recording, which lacks audio) or can record a full-motion video with audio (multi-frame recording). The preferences window allows you to set all sorts of preferences - you can choose your output file format, video and audio codecs, video and audio quality, and frame-rate. Choosing wisely here is key, as too high a quality or framerate will result in videos with skipped frames (which will look and sound bad) or files that are unplayable on most computers (e.g., Microsoft Windows doesn't have DIVX codecs installed by default). As a minor note, some codec and framerate combinations are not possible, which unfortunately is often reported to you solely in the form of a program crash (but it's easy to reopen).
Screenshot of xvidcap's multi-frame capture preferences.
My computer is old enough that I needed to lower the video quality and reduce the framerate as low as possible (7.5fps for the Microsoft DIVX 2 or MPEG DIVX codecs) to enable 700x700 video recordings without frame skippage. Reducing the size of the recording window does enable me to make higher-quality recordings, but there's only so small you can resize something before you lose important details.
Once you've got the options set, recording a video is about as easy as hitting the record button. When you're done recording, xvidcap will pop up a little screen summarizing the video that you just captured; pay attention to the framerate - if it's significantly lower than what you were hoping for, you will probably have to re-record the video (lowering the quality or recording area size). Practice recording with various settings to see what works best on your machine.
As a final note, if you're recording directly to flash video you may want to make note of the movie dimensions, as you may need that information to properly embed the video in a webpage.
Microphones and audio
Xvidcap will record audio along with your video; all you need is a working microphone and xvidcap takes care of the rest. This allows for easy narration of videos, something I plan to do regularly.
I'm using a Sennheiser PC 150 stereo headset with noise canceling microphone; it's probably not the best microphone out there, but it seems to work well. Setting up the microphone in Ubuntu was easy, if non-intuitive. I had to open the volume control (by right-clicking on the speaker in the task bar), go to the preferences in that control (edit/preferences), put a checkmark by all the microphone options ("microphone", "Mic boost", and "mic select"), unmute the microphone on the capture tab, and then turn on the "Mic boost +20db" option in the switches tab. As I said: easy, but not intuitive.
Choosing video codecs and creating Flash video files
Xvidcap has a number of codec options, and I'm still trying to figure out which codecs work best; here's what I've found so far (with very limited testing only only a couple of computers):
- The MPEG 4 DIVX and general AVI file (DIVX, mpeg) work well for me on Linux, but don't seem to play well on Windows or Mac computers by default (they need DIVX codecs)
- The Microsoft DIVX 2 and Microsfot avi file format seems to works well on Linux, Windows, and Macs.
- The mp2 audio codec seems to work well on Linux and Windows, but not Mac. Unfortunately, I can't seem to get the mp3 codec to work with the Microsoft DIVX 2 codec.
- Flash videos (.flv, what YouTube uses) work very well cross platform, but require a flash player to play.
- Create the flash files directly from xvidcap
- Create the movies using another codec and then convert them to flash files
Converting from the DIVX MPEG4 codec to flash files was relatively easy using mencoder (a component of mplayer). The command line to convert the files I eventually settled on (thanks to the mplayer manual) was:
mencoder inputfile.mpeg -o outputfile.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_framesThis conversion step also allows you to scale the size of the video to whatever you want; simply add the flag -vf scale=YYY:-2 to the command line and the movie will be scaled to YYY pixels wide (proportionally scaling the vertical dimension).
Flash movie files have timing information in them that helps flash players play them; mencoder apparently does not include this information. However, the program flvtool2 can add this information (I found this thanks to DRM's excellent post). There is no flvtool2 package for Ubuntu, but downloading and installing it was relatively easy1. Once you've got flvtool2 installed, all you need to do to add the timing information is:
flvtool2 -U inputfile.flvFlvtool2 can also be used to do a number of other things, including adding timestamps to the video for thumbnails (so users can skip through the video to specific timepoints).
Putting a flash video on the web
To actually play a flv file in a webpage you need a flash file on the webpage that will play the movie. While Adobe Flash can create these for you (for the low low price of $699 for Flash Pro 8), the entire point of this exercise has been to create videos using free open source tools. That's where FlowPlayer comes in.
FlowPlayer is a free open-source flash video player that can be easily added to a website; all you have to do is upload a few files to the server (as a user; no need to be root or actually install anything), insert FlowPlayer's quickstart HTML code into the HTML page of your choice, and you've got flash videos embedded into your webpage.
For a sample of how this looks, I've created three short videos and posted them here. Sorry, but you won't be hearing my voice in any of those videos, you'll just hear some music recorded by putting my microphone in front of a speaker (translation: badly recorded music)2.
And, here's an example of one of those sample videos embedded into this page:
Exciting, isn't it?
It seems like xvidcap will be able to produce satisfactory video tutorials that focus on how to use programs and websites, and the videos produced will be easy to distribute in a variety of formats, including flash videos on the web. However, I have no idea if xvidcap will be able to easily create videos of slide-based presentations (using OpenOffice Impress); figuring out how to create videos of slide-based content will have to be the subject of another post.
1: To install flvtool2 just unzip into a directory and follow the instructions in the readme.txt (which basically say to run "ruby setup.rb config", "ruby setup.rb setup", and "sudo ruby setup.rb install"). You may have to install ruby first; Ruby can be installed via Ubuntu's standard interface.
2: I can't very well be a pseudonymous blogger and have my voice plastered all over the internets, now can I?