Screencasting and Youtube Compliant Encoding
This article will guide you through the process of setting up the screencapture software recordmydesktop, record a screencast and convert it to a Youtube ready format for release to the public. The video converter used will be mencoder, already in the package repositories for a wide range of Linux distributions. Because the recording software is currently not available as a package for the distribution used in this article (Ubuntu Edgy Eft) it will feature a section on how to grab the latest source code and build it yourself.
The article will follow the steps required to get the recording software up and running and how to convert the output to a format suitable for uploading to Youtube. The subject of linear video editing will not be touched on but most (if not all) the video editing application available for Linux such as LiVES and Kino probably support the open Theora format as both the input and output format.
Recordmydesktop
Recordmydesktop is a small capturing utility written in C by John Varouhakis and it is avaiable under the terms of the GNU GPL v2 license at http://recordmydesktop.sourceforge.net (latest version is 0.3.2 to this date).
The utility is like any other good tool written with the UNIX philosophy in mind; it does one thing and it does it well. That one thing is recording a linux desktop session (both audio and video) into an Ogg-Theora-Vorbis file (by default called ‘out.ogg‘).
Building recordmydesktop From Source
Under the download section on the project homepage you will find a link to the source code package for the command line utility that will be used in the upcoming paragraphs for building and installing recordmydesktop.
Make sure that your system has a working set of build tools for the compiling. On Ubuntu the meta-package build-essential contains all the necessary tools:
sudo apt-get install build-essential
Once you have obtained the file and installed the build tools you can unpack it using the command:
tar xvzf recordmydesktop-0.3.2.tar.gz
That will decompress and output the content of the tar-archive resulting in a directory called recordmydesktop-0.3.2. Before entering it and starting the build process we must make sure that all dependencies required to compile the program is available as development files on the system.
The required dependencies for building recordmydesktop are:
- libvorbis-dev- The Vorbis General Audio Compression Codec (development files)
- libtheora-dev - The Theora Video Compression Codec (development files)
- libogg-dev - Ogg Bitstream Library Development
- libasound2-dev - ALSA library development files
- libice-dev - X11 Inter-Client Exchange library (development headers)
- libsm-dev - X11 Inter-Client Exchange library (development headers)
- libxext-dev - X11 miscellaneous extensions library (development headers)
- libxdamage-dev - X11 damaged region extension library (development headers)
- libxfixes-dev - X11 miscellaneous ‘fixes’ extension library (development headers)
All of those libraries are installable via apt:
sudo apt-get install libvorbis-dev libtheora-dev libogg-dev libasound2-dev libice-dev libsm-dev libxext-dev libxdamage-dev libxfixes-dev
After those development libraries are fully installed it is time to start the actual build process:
cd recordmydesktop-0.3.2 ./configure --prefix=/usr/local/ make sudo make install
This will install record desktop and all of its associated files within the /usr/local file hierarchy that is the standardized place to install user-built programs on a Linux system. The output directory for the binaries (/usr/local/bin) is most likely in your $PATH already which makes the newly installed program executable via the console using the command recordmydesktop.
Capturing a Screencast
For the most common captures (capturing the whole screen) simply using the command recordmydesktop without any additional parameters will start a capture and once the capture is ended (CTRL + C) the program will go on with encoding the capture and save it to a file called ‘out.ogg‘. If that output file already exists it will append an integer to the end of the filename (like ‘out.ogg.2‘) to make it unique.
Looking through the manpage for the utility is a good idea since it gives a in-depth overview of the capabilities and features of the program such as capturing only a specified area of the screen (for recording a screencast of just one window) along with various quality affecting parameters.
All in all the program is easy to use and works very well even for capturing heavy graphics effects like the ones provided by Beryl and Compiz and the default video quality is both size-efficient and sufficient enough for pleasant viewing.
Converting the Video File
The Youtube video requirements (or rather, recommendations) are listed below:
Videos saved with the following settings convert the best:
* MPEG4 (Divx, Xvid) format
* 320×240 resolution
* MP3 audio
* 30 frames per second framerate
Unless you have a director’s account (unlikely) your videos are required to be less than 10 minutes long, so keep that in mind when capturing.
Using the converter software mencoder (part of the mplayer suite but packaged induvidually) it is easy to convert the output of the screen capturing to a suitable format for Youtube. Below are two commands that can be used, the first one will convert and scale a video keeping the audio track while the second command will only convert the video track leaving out the sound completely:
# With sound mencoder out.ogg -oac mp3lame -ovc lavc -ofps 30 -vop scale=320:240 -o out.mpg # Without sound mencoder out.ogg -nosound -ovc lavc -ofps 30 -vop scale=320:240 -o out.mpg
This will output a MPEG-4 video file in the format 320×240 and 30 FPS (Frames Per Second). Youtube can process it just fine and the result is quite good even with sudden window movements and heavy effects like the 3D cube of Beryl/Compiz/XGL.
January 28th, 2007 at 7:55 pm
Nice nice. Pretty neat little thing. A few things I’ve noticed so far though:
Firstly, Arch users: you can install this straight from the Arch repositories. Just “pacman -S recordmydesktop” will work fine.
Secondly, I’m still having some issues with recording. Well, the recording apparently works, but I’m getting no actual output (when trying to play the .ogg file). I might be missing something here. I’m trying to encode it into mpeg right now (using the command provided above with mencoder)
Finally, if you get a weird error from the second mencoder command, just take the space out from between “lavc” and “-ofps” and it should run fine.
January 30th, 2007 at 4:49 am
[…] A result of the article http://nlindblad.org/2007/01/28/screencasting-and-youtube-compliant-encoding/ […]
January 30th, 2007 at 5:01 am
[…] A result of the article http://nlindblad.org/2007/01/28/screencasting-and-youtube-compliant-encoding/ […]
March 2nd, 2007 at 7:42 am
[…] video yang saya upload tidak bisa diconvert oleh youtube. Setelah liat sana sini, dapet petunjuk di sini. Ternyata video yang diupload supaya bisa dimunculin di youtube perlu memenuhi […]
May 1st, 2007 at 6:16 pm
[…] search on Google, spurred by my realization that Blip.tv uses a Java applet to serve .ogg files, led me to this page. The page contains instructions on using mencoder to convert .ogg files into mpeg […]
May 8th, 2007 at 2:34 pm
Thanks for that bit of mencoder magic - it worked just as stated.
May 9th, 2007 at 11:13 pm
@dswain: I was getting the same here, try playing the file with “mplayer -vo x11 “, that worked for me here.
August 14th, 2007 at 8:46 am
I couldn’t understand some parts of this article las Lindblad Organisation, but I guess I just need to check some more resources regarding this, because it sounds interesting.