Audio is out of sync

Help
2007-10-22
2013-06-03
  • 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...).

    Thanks,
    -Mihai

     
    • 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
      number.
      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].

      John.-

       
      • 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: http://ubuntuforums.org/showpost.php?p=2517087&postcount=189

        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: http://groups.google.com/group/showmedo/browse_thread/thread/ef43f06cf1748b45

        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!

         
        • 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: http://ubuntuforums.org/showpost.php?p=2517087&postcount=189

          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
          recordMyDesktop.
          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:
          http://recordmydesktop.iovar.org/rug/p1_3c.php

          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 ;).

          John.-

           
    • Hrotkó Gábor
      Hrotkó Gábor
      2008-03-06

      Hi!

      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?

      Thanx

      Roti

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

         
    • 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]
      Capabilities:

      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 http://dventurin.wordpress.com/2008/04/15/tip-recordmydesktop-e-audio-che-va-a-scatti/
      (the post is in italian but it has quite the same content of this post)

      my 2 cents

      enjoy
      Dam

       
    • 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  0.3.7.3-1        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.

       
    • 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?

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

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

      ln -s /usr/lib/libjack.so.0 /usr/lib/libjack.so

      Probably wrong in Ubuntu :-(

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

       
    • 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.

       
  • 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

     
  • 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
    2012-08-16

    Here's how I solved this problem:

    http://meta64.com/?id=13404