Broken pipe: Overrun occurred. 8 Step RecordMyDeskop Solution in Ubuntu/Kubuntu Karmic 9.10

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.

Related posts

HTML5 WebM and OGG / OGV video not working in Firefox

If you’re having trouble getting HTML5 video to work on your website in Firefox it might be because of a server issue. If when you check the FireBug console (in Firefox) you see something like one of the following lines: HTTP “Content-Type” of “text/plain” is not supported. Load of media resource http://www.example.com/path/to/your/videofile.webm failed. HTTP “Content-Type”

Agent: facebookexternalhit/1.1 externalhit_uatext.php In Web Logs

Many of my clients and business friends have asked my expert opinion on some “Facebook related thing” in their website logs. They were worried it might be a spammer, hacker or something with ill intent. They say something like this in their web logs: Agent: facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php) This is the Facebook’s website crawler. It’s safe!

Setting Up Custom Link Shortening With Bit.ly

Bit.ly allows you to have nice shortened links instead of hard to remember long links. For example, instead of linking to this post which would be http://www.piotrkrzyzek.com/setting-up-custom-link-shortening-with-bit-ly I could give you a shortened link like: http://cklph.com/ZqPrno.

As you can see, that is using a my own domain address (cklph.com) and not bit.ly. I’m going to show you exactly how you can have the same with your own short domain in a few steps. Other than the cost of the domain, it’s free!

  • http://pithyless.com Norbert Wójtowicz

    Thanks for the writeup – this will definitely come in handy.

    Just one small clarification, a hard drive seek time is over 3 ms, while today’s DRAM runs at say 300MHz (that is 3 ns/cycle). In other words, a million times (10^6) faster (not 100x).

    Also, that may not be a completely accurate picture, because it’s a little bit like comparing apples to oranges. The time spent between presenting DRAM with an address and actually being able to write data to it is about 30ns. But that’s still 10^5 times faster! :-)

    • http://www.piotrkrzyzek.com Piotr Krzyzek

      Thanks for the clarification Norbert. Though it only goes to prove my point a bit more, the difference between hard drives and DRAM is staggering. Now imagine if consumer level audio cards came with processors and ram like video cards. Imagine all the streams and ‘possible’ quality enhancements that could add.

      My theory these days is to avoid the hard drive at all possible costs. Most computers today come with a dual core CPU’s and video cards which are able of offload some of the work (see Nvidia’s CUDA). If there’s time, I’ll see if I can get recordMyDesktop connected with cuda to help ease up the CPU’s load since the graphics card is generally faster as number crunching.

  • Adam Marchetti

    Despite this page being a couple months old, I was actually able to get really good quality audio recording on my system following what you had said (despite that this is for Ubuntu, it worked on a manual compile for Slack 13. It is probably more cross platform than you realize…)

    Thanks a lot for the info!

    • http://www.piotrkrzyzek.com Piotr Krzyzek

      Awesome! I’m really glad to hear that this has helped you! Once you create your screencast, send a link here. I’m interested to see what kind of work you created. Plus I can also post a link to the video on the page if you want.

  • Icy

    Still can't remove the buffer overrun, sorry. This is even on a core i7 laptop with ATI 5870 Graphics. I'd love to use Windows for recording, but I have to limit it a lot in order to just get 30 fps.

  • http://www.PiotrKrzyzek.com Piotr Krzyzek

    Hm, yeah. Sorry about that. I've been reading up on the issue a bit lately and it's not yet solved. And it's not 100% a linux issue either. It's a problem with the recordItNow program. There was a forum post about this exact topic somewhere but I don't remember off hand. Sorry I can't be of more help.

    All I can suggest for now is that you try “RecordItNow”. Seems to work best out of all the linux recording programs.

  • http://www.wbitt.com Kamran Azeem

    Thanks for a lovely article.

    I don’t want to waste your time by any support question, but it seems I am unable to find an answer to my painful situation.

    I record a lot of (Linux Tutorial) CBTs. Previously I used Istanbul. But in Fedora 13 64bit, Istanbul delivered horrible results, probably because of my own mistake. Any way, I switched to gtk-recordmydesktop.
    The problem I am facing is, when the recording is complete, and encoding is complete, and I view the resulting ogv file, I see that after about 20 minutes of recording, audio disappears all of a sudden. I have tried to run this multiple times, keeping every un-necessary application turned off, and installing as much gstreamer-* stuff as I could. Still, I occasionally get the videos half silent after 20-25 minute mark. I am recording in gnome, using 1024×768, and 5 (five) frames per second, 11000 single channel audio. I have to redo my videos again and again, sometimes taking time to add a separate audio track recorded through audacity, which is a painful process in it’s self (the video editing and rendering). And worst on top of that is that pitivi video editor keeps crashing. There must be something horribly wrong with what I am doing / the settings in my OS. Can you help identifying this ?

    Thanks again.
    Regards,
    Kamran

    • http://www.piotrkrzyzek.com Piotr Krzyzek

      Wow man, That is a bit of a wild error! Yikes. Hmm …No sound after 20 or so minutes?

      Instanbul is old an out-dated as far as I know. The BEST solution right now is to use the program called “RecordItNow”. Yes it’s all one word (I think). It’s magically fixed a lot of the problems I used to have.

      As for the audio problem directly, without more information I can’t help you much. I’d first see if there are any errors or debugging messages. Run your recording program from the command line and see if it output anything suspicious. Also see if maybe your program as a logging option or a more verbose debugging option. Something like that would really help in diagnosing the problem.

      But if it’s always at the 20-ish minute mark, then it seems like one of two things:
      1) The software is actually faulty and was never made to handle larger videos like that.
      or 2) for some reason your audio is buffering overflowing and just never getting recorded. The buffers must be full….

      If I remember correctly, gtk-recordMyDesktop had a direct to disk option. Try enable writing directly to the disk instead of using memory. That ‘could’ solve the buffer issue, if it is a buffer issue.

      Good luck and let me know how it turns out!.

      –PK

  • http://www.wbitt.com Kamran Azeem

    Thanks man. First, my apologies for replying very late. I did try RecordItNow, but I could not get it to work even I compiled it. For some strange (merciful) reason, the weird 20+ minutes audio problem is not there in KDE. Previously I was using GNOME, (while being a dire fan of KDE).
    I could not find the “Record directly to disk” option in the gtk-recordmydesktop’s GUI. However, I have your suggestions constantly in mind, and am on a look out when I experience this problem again.

    Pitivi still crashes, OpenShot exits abnormally (crashes?) when I try to render a video. But I am living (crawling) through these. :)

  • http://www.wbitt.com Kamran Azeem

    You may want to remove the link to “Very serious problem”, which (accidentally) got attached to my message above. (And also remove “this” message).

  • http://fossgrafis.com Aditia

    thanks mate…i’ll try your suggestion soon enough :)