Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

I have been doing some screencasting over the past year or so. Some of it directly, some it scraping recordings out of things like Elluminate or other web conferencing tools. It's been a somewhat long process to come up with something that works well for me, so I thought it was worth sharing.

I've tried all the tools that should make screencasting easy in Ubuntu (RecordMyDesktop, Istanbul, Cankiri, and XVidCap), and I've found them all lacking (to say the least). If they work at all, they are still beset by a host of problems: unreliable recordings, crashing in the middle of recordings, unsynced video and audio, using way too much CPU/memory/disk while recording, restrictive file format choices, etc. If you find one that works well or think one of the ones I mentioned has been updated to deal with its challenges let me know.

So, being a long-time Linux hacker, I took to the command line and sought to assemble a set of tools that actually worked and then develop a script to rule them all. Some of the goals I have in the process:

  • Low use of resources during the recording. Frequently I am recording something that requires a lot of resources itself, and I want to minimize how much it fights with the recording.
  • Separate video and audio streams. I might want to use just the audio stream and I don't want to have to go to the trouble to split them back apart later.
  • Keep all the intermediate artifacts. I want the intermediate video and audio recordings to stick around and I'll delete them when I'm sure I don't need them. Some of the "easy tools" would crash not during the recording, but during the post-processing and would lose or corrupt the sources in the process.
  • Timed recording. Sometimes I want to start a longish recording and walk away (or go to bed), but I don't want it to record the entire time until I get back to the computer. This is especially useful when scraping long recordings out of another platform.
  • Direct support for PulseAudio. When I'm scraping recordings, I don't want to record an audio input, I want to record the audio output that goes with the recording. PulseAudio makes that easy since through the "PulseAudio Volume Chooser" I can select the Monitor of Internal Audio as the default audio source.
  • Final output of the recording process should be in a format that is easily editable with a variety of tools. I tend to use Avidemux for simple cleanup of recordings, but the format should be mainstream enough that any editing tool should work.
  • Final output of the entire process should be an H.264 file in MP4 format that will easily play through current versions of Adobe Flash and be compatible with a simple video player like FlowPlayer so that the videos can be posted directly to websites.

The Script

Okay, with all that in place and lots of experimenting, I built this script:

screencast.sh

I keep it in a directory where I want all the source files for the screencast to show up when I'm done. The script does require a few tools be installed:

  • grep, head, sed - standard Linux utilities (installed by default)
  • xdpyinfo - display information utility for X (installed by default)
  • ffmpeg - record video and assemble media (install package 'ffmpeg')
  • pacat, parec - PulseAudio play and record tools (install package 'pulseaudio-utils')
  • sox - audio processing (install package 'sox')

So, to make this script work, you need to install the following additional packages: ffmpeg, pulseaudio-utils, sox, ubuntu-restricted-extras (for all the codecs). You should also install pavucontrol which gives you the PulseAudio controls I mentioned earlier.

Recording The Screencast

With the required utilities installed and the script ready to go, you should run a short test recording to make sure you are getting appropriate video results and the right audio stream.

There are some command line options for the script to adjust the area of the screen to capture, the frame-rate to capture, and to set up a timed recording. You can also set the basename for all the artifacts, or just let it use 'capture' as the default. "./screencast.sh -h" will show you the syntax.

If you run a timed recording, it will finish when the time has expired. If you are running an open-ended recording (the default), just go back to the terminal window where you have the script running and hit Enter to stop the recording. When you end the recording, it will do some immediate post-processing.

The initial recording will leave behind four files:

  • capture.mpeg - This is the raw video feed
  • capture.raw - This is the raw audio feed
  • capture.wav - This is the filtered and normalized audio feed
  • capture.avi - This is the combined audio and video file using mpeg2 video and mp2 audio

Check out the .avi file to see if you are getting a good recording. If this looks the way you want and you have no further need of the separate feeds, you can delete everything except this file and reclaim a lot of that disk space.

If you aren't getting the right audio stream, go run the "PulseAudio Volume Control" (it should be in the "Sound & Video" menu) and go to the "Input Devices" tab. Change the "Show" choice at the bottom of the window to "All Input Devices" and now you can adjust the selections accordingly. For the device you want to capture, you should click the "Set as fallback" button (the green circle/checkmark thing) and now that should be the source your next recording will use. With the recording in-progress, you should be able to go to the "Recording" tab and see a parec process listed and you can make changes to that specific stream if you want. However, if you stop and start over you'll have to make those changes again every time.

Once you have a successful test that is capturing the right video and audio, you should be ready to go and make your recording.

The recordings do still use a fairly large amount of disk space. An hour long recording of a large resolution screen with a high frame rate can generate upwards of 10GB in artifacts, so make sure you have plenty of free space available for your recordings. This amount of space is a tradeoff I am willing to make in order to keep CPU use low during recordings and in order to retain all the intermediate artifacts of the recording process.

Now you can use the capture.avi file as source for your favorite video editor.

Editing The Screencast

ToDo.

Final Post-Production on The Screencast

ToDo.

  • No labels