Wednesday, July 21, 2010

Recording and editing screencasts with recordMyDesktop and Audacity

RecordMyDesktop is a nice tool for screencasting. It allows you to record the computer’s screen and your voice. But what if you want a little more? In my case, I wanted to edit the audio track to include music and change volume on my voice in some places.

Before running recordMyDesktop and recording the video, make sure that you have enough disk space available in /tmp. If you don’t, choose a different working directory using the -workdir option.

This runs the recording after waiting for 5 seconds, and uses /home/kasi_sona/tmp as a temporary files directory.

recordmydesktop --delay 5 --workdir /home/kasi_sona/tmp

To stop the recording, you can use Ctrl + Left Alt + s.

When the video is recorded, it converts to Ogg (Vorbis and Theora). Before the conversion completes, you can go to the temporary files directory and copy the PCM audio file somewhere to edit it with Audacity (you can just make a hardlink using the ln command — a file is deleted only when the last hardlink is deleted).

Then edit the file with Audacity and export it to Ogg Vorbis (you can also select the quality — I like to use 7).

Okay. So, now we have two files. A video file (which includes the original audio track) and an audio file (which we want to use as the new audio track). So, we just want to replace an audio track. All is encoded already, the task seems very simple. And it is very simple, but before I found a solution, I tried a lot of programs (ffmpeg, mencoder, vlc) and none of them worked.

The program that brings a simple, beautiful solution, is called oggzmerge. It is a part of oggz-tools.

This merges out.ogv and voice_with_music.ogg to programming_an_image_hosting_application_with_django.ogg.

oggzmerge -o programming_an_image_hosting_application_with_django.ogg out.ogv voice_with_music.ogg

If you want to have two audio tracks in your video (the user can choose from them), this is the complete solution. For example, if you only included music in your audio track, this allows a user to choose whether he or she wants to hear the background music.

But what if you want to replace the old audio track with a new one? Then you will need to separate audio from video in your original video file. And here is how.

Get oggsplit.

svn checkout http://svn.xiph.org/trunk/ogg-tools/oggsplit/

Of course, you need Subversion for this.

cd oggsplit
./autogen.sh
make

Now split your original video file with oggsplit.

./oggsplit /moar/video/software/django/programming_an_image_hosting_application_with_django/out.ogv

In my case, it created 3 streams: out.c01.g01.ogv, out.c01.g02.ogv, out.c01.g03.ogv.

Move the video stream to your screencast directory and delete other streams.
mv out.c01.g02.ogv /moar/video/software/django/programming_an_image_hosting_application_with_django/only_video.ogv
rm out.c01*

Now go to your screencast’s directory and merge the audio track and the video track.

oggzmerge -o programming_an_image_hosting_application_with_django.ogg only_video.ogv voice_with_music.ogg

Great! Finally, let’s split the video into parts of the needed length. It is useful if you want to upload your screencast on YouTube, but it is longer than 10 minutes.

oggz-chop -o part1.ogg -s 0:0:0 -e 0:10:0 programming_an_image_hostin
g_application_with_django.ogg


Just like oggzmerge, oggz-chop is a part of oggz-tools.

So, here it is. Come on, go record a nice screencast!

Have fun!

No comments: