Kasperian Moving Parts

kinda like Batman, but with a wife and 3 kids

Screencasting in Linux!

| 9 Comments

I’m excited. I love learning stuff, I really do. I just did  a 12-minute screencast for work, and I think I’ve finally figured out how to get everything to fit together nicely. I’d never done a screencast before–not on any platform–but being that I needed to showcase some development work that I’ve done for the next release of VMware Workstation/Player, and being that I’m working from home for the time being, I needed to get this all working in Linux, and as I said, I think I’ve finally figured it out, woot!

For starters, I used qt-recordMyDesktop to capture the full-screen (1600×1200 resolution) video. I wanted to use it to also capture the audio portion of the screencast at the same time, but when I tried doing so, the audio was really choppy and out of sync. I mostly blame pulseaudio, but also the fact that I did this all on my puny little laptop, and I think that the system just wasn’t able to keep up with me, recording a nested Xephyr session with 4 fake Xinerama monitors (thanks again for that beauty, Lubos!), at 1600×1200 resolution. So I told qt-RecordMyDesktop to not capture audio and what I ended up with was a beautiful 1600×1200 Ogg/Theora .ogv file. We’ll call it demo-video.ogv.

Next, I recorded my voice, doing a monologue of what was happening in the screencast, using my laptop’s internal mic (not the greatest quality, but I don’t have a real microphone, *sigh*), and audacity (oh, and this is nice… audacity doesn’t work with pulseaudio whatsoever). This I saved in mp3 format. We’ll call it demo-audio.mp3.

The next magical trick, obviously, would be to combine the audio and video files into a single movie file, right? Well, all of the questions/answers that Google found me (even though I searched for “mencoder combine audio video”) were examples using ffmpeg. So I gave it a shot. And I’m sure there must be a way to do it, but for the life of me, I couldn’t get ffmpeg to combine my 80-meg demo-video.ogv file and my 10-meg demo-audio.mp3 file in a high quality and problem-free output file. The closest I think I got was this: “ffmpeg -sameq -i demo-video.ogv -i demo-audio.mp3 demo_full.mp4”, but that combined my 80-meg video and 10-meg audio file into a 350-meg mp4 file. Zoinks, Shaggie!! That’ll never do!

I finally stumbled upon the “-audiofile” parameter to mencoder and there was much rejoicing in Agrabah (not to mention Massachusetts). What I ended up with is this little mencoder incantation that seems to work beautifully. And, the resultant file is only 62 megs (80m + 10m == 62m !?!), so I’m sure there’s some loss of quality in there somewhere, but for the life of me, I can’t see it. Here’s what I used:

mencoder -sws 9 -vf pullup,softskip,scale=1600:1200,harddup,unsharp=l3x3:0.7 -oac faac -faacopts br=128:mpeg=4:object=2:raw -channels 2 -srate 48000 -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=libfaac:abitrate=128:vbitrate=1000 -of lavf demo-video.ogv -audiofile demo-audio.mp3 -o demo_full.mp4

So, there you have it. Screencasting, done 100% in Linux. I wish I could show you the results, because I’m pretty darned please with them, but sadly, I cannot (nor do I have a spot to stick 62 megs of mp4 =;P).

I hope this helps some other poor soul, ’cause I couldn’t find much in the way of tutorials for doing this. I’d be very interested to hear what others think of this, as well as any other suggestions for doing screencasting in Linux. I know Aaron’s been doing something along these lines, and I’d be curious to see how this compares to his method. Also, any improvements to my mencoder line (yeah, I’m sure some stuff in there might be redundant or weird), or finding out what the ffmpeg equivalent of my mencoder line is would be greatly appreciated.

Author: Jason 'vanRijn' Kasper

My name is Jason 'vanRijn' Kasper. I am the ring leader of the amazing Kasper family. I am unashamedly a Christian Nerd. These are our stories....

9 Comments

Leave a Reply

Required fields are marked *.


 

This site uses Akismet to reduce spam. Learn how your comment data is processed.