Audio is out of sync

  • Mihai Bazon

    Mihai Bazon - 2007-10-22

    First off, congratulations for this great tool!  The recording quality and size is better than of any other tool I've tried.

    I finally managed to set the proper controls on my sound card so that I get audio, but however, it's badly out of sync.  When playing the recorded stream, audio ends much sooner.  Is there a known workaround to this? (tried Googling and browsing these forums but I couldn't find one...).


    • John Varouhakis

      John Varouhakis - 2007-10-22

      You didn't mention a version so I'm assuming that you use the latest.

      >> I finally managed to set the proper controls on my sound
      >> card so that I get audio, but however, it's badly out of sync.
      >> When playing the recorded stream, audio ends much sooner.

      It sounds like there are many buffer underruns. run
      recordMyDesktop on the commandline. You will probably see
      many "broken pipe: Underrun occurred." messages.

      Here's what I'm thinking as probable causes/solutions:

      1) recordMyDesktop is driving your CPU usage too high.
      In this case all that can be done is lower the capture
      settings (fps, capture area, disable cache compression, etc.)
      and try again.

      2) You have some onboard chipset for audio. By default
      recordMyDesktop uses the hardware plugin for ALSA, which means that
      it queries the device for natively supported samplerate and channels
      These chipsets usually have a narrow range of capabilities and might
      not support the default audio settings of recordMyDesktop
      (1 channel@22050 Hz), forcing something higher, which can cause more
      buffer drops.

      To check this scenario, run recordMyDesktop on the commandline
      and see the output. It should print something like:

      Recording on device hw:0,0 is set to:
      1 channels at 22050Hz

      If the numbers are higher, that might be causing the trouble.

      You can obtain the default audio settings in any sound card,
      by using the software plugin for a device.
      This means changing your sound device from hw:0,0 to plughw:0,0
      ( -device option, in the commandline and
      Advanced->Sound tab ->[Device field], in gtk/qt-recordMyDesktop)

      As a last solution, you can try increasing the buffer-size used
      by the soundcard for capturing. This generally guarantees to lower
      the number of underruns, but it will also increase the latency
      (though compared to a multitude of drops, the final result might
      come up better).

      To achieve this, use the -buffer-size option in the commandline,
      followed a 2^N number. -buffer-size 4096 is the default.
      Try with 8192 and maybe 16384.
      This setting is not visible in the interface but you can add the
      commandline option on the Advanced->Misc tab ->[Extra Options field].


      • Mihai Bazon

        Mihai Bazon - 2007-10-23

        Thanks for your reply.  Unfortunately, none of these worked. :-(

        Version: recordMyDesktop v0.3.6.  I use Debian unstable/testing and got rMD from there.

        Indeed, I see many "buffer overrun" messages in the console.  I tried with a pretty large buffer:

          recordmydesktop -device plughw:0,0 -buffer-size 262144

        but it didn't seem to improve.

        I have an onboard sound card handled by snd-hda-intel.  The machine is decently fast (2GHz Core Duo, 2GB RAM).  CPU usage is quite low while capturing.  I have an ATI video card but I'm using the 'vesa' driver because it can properly suspend/resume.  But the video capture is great, anyway, my only problem is sound. :)

        I found a similar report on the Ubuntu forums:

        The guy says that a/v sync is OK when 'encode on the fly' is enabled, but for me this doesn't seem to be the case either....

        This might be an interesting thread too:

        Someone says he had to patch ffmpeg in order to get proper a/v sync; I think rMD has nothing to do with ffmpeg? (but I thought that the problem might be similar.. just guessing here).

        Well anyway. I hope you will be able to fix this in a future version. :D  Thanks again for your great work!

        • John Varouhakis

          John Varouhakis - 2007-10-23

          I'm on Debian testing too, but I haven't ever seen something similar.

          It's probably some issue with the settings that are used to open
          the sound card (according to Capt. Obvious :).

          >> I found a similar report on the Ubuntu forums:

          Not sure but that might have been on an earlier version
          of recordMyDesktop, so I don't think it relates to your problem.

          Also recordMyDesktop doesn't use ffmpeg, or link to it, in any way.

          Perhaps you could try to do the audio capture through Jack. It
          offers more settings on how the sound card is opened than
          You need to install the jackd package for that.

          Then you can try to start the jackd daemon with different settings
          and backends (i.e. OSS and ALSA ) and see if some of them works.
          The jackd manpage lists the available options for every backend.

          To record with jack select the alsa_pcm:capture_1 and
          alsa_pcm:capture_2 ports (or oss:capture_1 and
          oss:capture_2 if you try with OSS).

          There are a few instructions about enabling jack capturing here:

          In any case, I'll look closer into this issue before the next
          release, but to be honest, there's little chance for a problem I
          can't reproduce myself, to be solved.
          Thanks for your positive feedback and for bringing up this problem
          and sorry if I haven't been very helpfull.

          Happy screencasting ;).


    • Hrotkó Gábor

      Hrotkó Gábor - 2008-03-06


      I have the same problem. Audio is strange, jumping, and out of sync, even with only some "broken pipe: Underrun occurred." messages.
      I tried every advice you gave (buffer sizes, jackd ...), but the only solution I found was: record the sound separately with gnome-sound recorder, and attach it later to the video with avidemux  :-(

      Is there a hope to have it fixed? Or just find the wrong component in this game?



      • John Varouhakis

        John Varouhakis - 2008-03-06

        Have you tried changing the device to plughw:0,0 ?

    • Nobody/Anonymous

      Hi all

      I'm on a thinkpad T61 with this sound card:
      damko@smoke:~$ lspci -v |grep -A 10 Audio
      00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)
      Subsystem: Lenovo Lenovo Thinkpad T61
      Flags: bus master, fast devsel, latency 0, IRQ 21
      Memory at fe220000 (64-bit, non-prefetchable) [size=16K]

      I'm really a newbie in audio and video related softwares but I had the same trouble. The sound ended a lot earlier than video and even more I had a lot of interruptions during the speech.
      Using recordmydesktop in the shell in this way: (but I tried hundreds of combinations)

      recordmydesktop -windowid 0x4a001ae --quick-subsampling -fps 15 -channels 1 -freq 22050 -buffer-size 16384 -device plughw:0,0 -s_quality 10 -v_quality 10

      I got "Broken pipe: Overrun occurred." for each interruption

      I solved using jack and switching settings on oss rather then alsa. Above all the most important setting for jack is "Audio : capture only". Now my screencast have a quite good sound

      May be I'm saying something stupid now but it seems that alsa mixes the channels capture and playback.(don't smile ;-) )

      Anyway I thought it could be useful for u to check my settings: u can see some screenshots on my blog at
      (the post is in italian but it has quite the same content of this post)

      my 2 cents


    • Nobody/Anonymous

      I see the same problem in Debian sid, with an intel hda card, and a fairly powerful machine. I too see overruns, not underruns.

      fheinz@lauren:~$ dpkg -l recordmydesktop
      ii  recordmydesktop        Captures audio-video data of a Linux desktop ses

      I tried using plughw:0,0 and also a buffer size of 32000. Things did go better, but I still had overruns every few seconds. To make matters worse, not even jackd seems to work properly: it endlessly complains of a series of "xruns of at least $n$ms". In no case do I see the machine eating up much processor time.

      Funny thing is: the no-frills gnome sound recorder can record audio perfectly on this same machine.

    • Nobody/Anonymous

      The same here:

      (K)Ubuntu 8.04 (and 8.10) - sound is out of sync with many overruns.

      But sound works fine in Ubuntu 7.04 from LiveCD :-(

      Any ideas right now?

    • Nobody/Anonymous

      Me again (write Post from 2008-08-07)...

      I get it sync! With Jackd. There was just a problem with I have to make a symlink:

      ln -s /usr/lib/ /usr/lib/

      Probably wrong in Ubuntu :-(

      Now everything is fine - many thanks for that program!!!

    • Nobody/Anonymous

      I have this problem too. I tried to use jack but jack -d alsa gives this error:

      the playback device "hw:0" is already in use

      Disabling the sound in kde fixes it, but then there's no sound in any application :(

      I have no problem recording audio with the gnome sound recorder so I guess there must be something wrong with the audio recording in recordmydesktop.

    • yvonne

      yvonne - 2009-01-23

      recording at 48000 without jack works for me. good jack tip thanks! I'll try it.

    • yvonne

      yvonne - 2009-01-23

      "the playback device "hw:0" is already in use "

      this problem for me was to kill with system monitor an instance still running of firefox even when close. Maybe some other program running?

      also starting jack first important.

    • Lucio Valentin

      Lucio Valentin - 2016-02-01

      I try reduce my fps from 20 to 10 and my audio sync is ok, with --on-the-fly-encoding. When I remove --on-the-fly-encoding option I have some sprite problems, but the audio is ok.

  • Peter

    Peter - 2009-11-18

    Same problem here but
    -device plughw:0,0
    helped! Thanks!

    recordmydesktop -width 800 -height 640 -v_quality 20 -s_quality 10 -delay 3 -fps 10 -overwrite -device plughw:0,0 -o timefinder-v4-screencast.ogv

  • Nobody/Anonymous

    My MacbookPro4,1 runs a 64bit Karmic Koala

    If I type in a terminal:

        ffmpeg -f alsa -i plughw:0 -f x11grab -s 1440x900 -r 24 -b 100k -bf 2 -g 300 -i :0.0 -ar 22050 -ab 128k -acodec libmp3lame -vcodec libxvid -aspect 1.6 -sameq MyScreencast.avi

    …it records my Screen and captures sound via built-in microphone.
    Possibly, you need to change the screen size (mine is 1440x900) and the alsa device (for me, plughw:0 is good)

    To stop recording, just hit "q".

    The screencast is saved as a xvid-avi-video-file named MyScreencast.avi.
    sound and video are in sync, there are no "running pictures" or any splitted sound.

  • Anonymous

    Anonymous - 2012-08-16

    Here's how I solved this problem:

  • romikforest

    romikforest - 2016-05-06

    I have problem with audio/video synchronization on Ubuntu Studio 16.04 recordMyDesktop v0.3.8.1.
    Nothing helps


Log in to post a comment.