Screen casting in Linux is not what many can consider a fun nor easy experience. There are many issues with it, but one of the largest being a lack of any professional software in Linux.

In Linux … we have RecordMyDesktop and XVidCap. Both programs are, suffice it to say well behind the commercial competition. Though they can do the job well enough assuming you can get everything to work right. So lets get started into getting RecordMyDesktop to record sound perfectly for you!

We’ll get rid of the pesky “Broken pipe: Overrun occurred” which is the source of broken, choppy and incorrectly timed audio while recording. There aren’t too many setting which you have to change, and once you have it working I recommend tweaking the setting up to your quality standards. The fixing idea here goes back from my old computer repair days: start simple and then add on.

If you’re looking for the solution, skip past the next section of my analysis as to why the problem occurs.

Why the error occurs:

Now I cannot say with 100% certainty the exact reason, though I can tell you it is partially to do with the audio card (being low quality) and the speed of the hard drive on your computer, of course also a bit to do with your CPU speed. Though the CPU shouldn’t be an issue in this day-and-age.

The cpu does all the grunt work of handling the capturing, all while taking care of the rest of the system. So if your CPU can’t handle the work load (which shouldn’t be that much) it will start to ‘miss’ a frame here and there in-order to keep up with your recording demands (and the FPS, if it can). The Linux software does NOT get any help from the graphics card to help process the video (and audio) so it leaves the CPU with really a lot of work to do.

A low qualilty sound card CAN and does cause problems. Not only because of possible driver issues (which there are from time to time in Linux, especially Ubuntu …), but also that cheap cards are simply not made up well enough nor with quality parts. The cheap quality of the card prevents it from being utilized effectively, makes it generally record and output sound with horrid quality and Lord only knows how long it’ll last before it burns out and you have to replace it. Though, on laptops you generally will not have to do such a thing.

On a laptop, unless you got a extremely high end laptop with a name brand card with a high end audio card, be prepared to deal with lower quality sound … especially recording it. Low quality parts means more resistance, less heat efficiency and meh … just face it: laptop audio cards suck in general. Reverse engineering the audio drivers doesn’t help either.

Now,  you might be asking “how on earth could a hard drive effect recording?” Simple, a hard drive is one of the slowest recording mediums we have in a computer. A hard drive is, I think, 100x slower than ram. So, any work that has to be written to the HD you’re computer will have to wait for it to complete before anything else can happen. RecordMyDeskop has several options for controlling that, and I’ll show you how to tweak it, but the general settings prefer HD usage over CPU usage. If you have a SDD drive you probably won’t have any issues, but for the rest of us we need to watch out for the HD usage.

How to fix the dreaded “Broken pipe: Overrun occurred” issue and record with jitters:

As explain above, the broken pipe error is caused by a slew of error though is can be generalized as “system lag”. We’ll try to minimize any areas of system lag and hopefully you’ll be able to enjoy full 24 FPS recording with 100% quality audio.

Step 1) Turn of Composite Effect (eye candy). Things like Composite Effects (Compiz/Beryl/whatnot ..), animations, shadows all require more processing power. Eye candy is great and I love it, though for recording it is mostly a hindrance. If you are doing a presentation (PowerPoint/OOImpress style) then it’s just wasting CPU cycles.

To turn of alpha blending and all those pretty Linux effect, in Kubuntu open your Kmenu bar, go to System Settings. Click Desktop, and uncheck “Enable desktop effects”, then hit apply on the bottom right to save the settings. Your screen might flicker a bit and then the effects will be off.

Step 2) Change audio device to “plughw:0,0″. Assuming you have one sound card and it’s working correctly and what not, a partially confirmed work-around to issue is to change the usable audio device. For me, these first two tips helped the most. If you are using the commend line program recordmydesktop use the extra parameter like this:

recordmydesktop -device plughw:0,0

If you are using the gui version (gtk-recordmydesktop or qt-recordmydesktop) the setting is under Advanced and in the Sound tab. Change whatever is in there, probable “DEFAULT” to: plughw:0,0

Step 3) Using only 1 channel and a frequency of 22050. This is a minor thing really, or so I think. Though using only one channel (mono) to record will take less processing power  AND less space so it can be worth while to live with with recording in mono. Honestly, I don’t think anyone will care that you record in mono anyway. The frequency has a bit to do with quality; keeping the frequency at 22050 will give you good enough audio quality for a nominal performance and not all that much space usage.

Step 4) Disable “Zero Compression”. As the tooltip for this says: “Do not apply compression on the temporary files. If enabled, the program will need less processing power, in the expense of hard disk space.” That doesn’t sound bad actually, probably a good idea except that we are trying to decrease the hard drive usage. Thus, disabling it will give the hard drive less to write and thus hopefully speeding things up for us.

Step 5) Use a NON system disk for the “Working Directory” (not possible for everyone). What I mean by this is to use a another hard drive to use for the working directory. I do not mean just another partition, I mean a completely separate hard drive. Separating out the data usage and system use hard drives allows your system to happily keep working while all your data is being written elsewhere. If you write to the same hard drive, your system will have to wait for the data to be written before the system can read it’s next instructions thus causing system lag.Best to split your system and data drives :)

Step 6) Don’t use “Encode on the fly”. Your CPU has enough to worry about while recording, just encode afterwards. No big deal.

Step 7) Enable “Quick subsampling”. This will decrease CPU usage while recording, but it will also decrease the quality. Good for those of you with slow(er) processors. A decent trade of I think if your processor can’t handle it.

Final Step, Step 8) Decrease Video and Sound recording Quality setting. Go on, don’t be afraid to sacrafice quality for speed here. This part is completely up to you. The more you decrease these setting the faster things will go; just like decreasing quality in video games on a PC. Of course, the lower you go the worse the quality. It’s your choice for what the trade off benefits are. Go as high or as low as you want.

edit added this step, very logical step: Step 8.5)Decreasing the recording area. You probably do not need to record the whole desktop. IF you are recording a powerpoint type presentation, OpenOffice Impress does have a ‘windowed mode’ for the presentation. So your presentation shows up in the full presentation version, with animation and all, but it’s in a window. Then simply record that much smaller window instead of a full screen.

Bonus Step #9: Record the audio and video separately. This takes a bit more skill though it’s do-able and can produce cool results. One work around actually did it this way using a bash script. The bash script sound at this bug report, the script is called “recordSoundAndDesktop.sh” records video with recordMyDesktop and audio with arecord. Another way is to record only the video in gtk-/qt-/recordmydekstop while talking (to help you make sure you are showing the right things at the right time) and then record audio with Audacity. Or even record using audacity while recoding with recordMyDesktop which DOES work very well and there are no ‘bugs’ or jitters or breaks; sound issues at all using that method…. though of course you have to combine the audio and video afterwards.

Good luck with your screen casting. Let me know if this has worked for you and if you recorded something, let me and everyone here see your work! Leave your other solutions in the comments, or if there are any other issues also let me know. We’ll try to fix it all.