[pulseaudio-discuss] Pacat latency/delay and audio capture issues

Elias Woods eliaswoods at gmail.com
Thu Jun 10 10:16:31 PDT 2010

I have noticed particularly weird behavior when using pacat in record
mode. It can be hard to describe in words so I made a video describing
the problem

(you may need to turn the audio up to hear the song playback)

I used the following command to produce this video:

pacat -r --channels=1 --rate=44100 --format=s16be | ffmpeg -f s16be -ac
1 -ar 44100 -i - -f x11grab -s 640x480 -r 30 -i $DISPLAY -itsoffset 1
-async 44100 -acodec libmp3lame -ab 96kbs -vcodec libx264 -crf 22
-maxrate 1M -bufsize 1M -vpre superfast -threads 0 -f asf data.asf

After messing around long enough I found the problem still occurs even
when not using pacat but using an alsa capture interface instead.

ffmpeg -f alsa -ac 1 -ar 44100 -i pulse -f x11grab -s 640x480 -r 30 -i
$DISPLAY -itsoffset 2 -async 44100 -acodec libmp3lame -ab 96kbs -vcodec
libx264 -crf 22 -maxrate 1M -bufsize 1M -vpre superfast -threads 0 -f
asf data.asf

Surprisingly I got a very similar result! I then thought maybe the issue
was with ffmpeg but when I run this command:

pacat -r --channels=1 --rate=44100 --format=s16be | pacat -p
--format=s16be --rate=44100 --channels=1

The same problem occurs. Someone could say "Don't seek then silly" but
this problem also happens to some wine applications and the effect is
quickly compounded. 

Here is a audio and video capture of an application in wine
(I do realize wine does not use pulse audio but it does use the alsa
pulse device)

If the latency/delay were constant then I would not have issues because
I could capture and delay a portion of the stream to align it but
because the delay changes over time I have no idea how to sync audio and
video together

The original purpose was to capture a screen and system audio without
delay or latency suitable in a live broadcast. If any of you know other
methods or tricks that would be greatly appreciated.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20100610/e277f5c0/attachment.pgp>

More information about the pulseaudio-discuss mailing list