You are not logged in.

#1 2011-11-02 17:18:13

awayand
Member
Registered: 2009-09-25
Posts: 398

ffmpeg sound delayed when recording screen

Again, apologies for opening multiple questions, but I feel these things are best addressed in separate threads:

I am using this command:

ffmpeg -f alsa -i hw:0 -f x11grab -s wxga -r 25 -i :0.0 -qscale 31 /tmp/out.mpg

I am trying to do a screencast and have noticed that even though I set the lowest quality, I still get a 1-2 second delay in audio into my feed. Does anyone know what I have to do to get rid of this delay?

Thanks!

Offline

#2 2011-11-07 23:14:47

awayand
Member
Registered: 2009-09-25
Posts: 398

Re: ffmpeg sound delayed when recording screen

bump

Offline

#3 2011-11-08 00:41:12

ChemBro
Member
Registered: 2008-10-22
Posts: 704

Re: ffmpeg sound delayed when recording screen

Do you have a constantly 1 - 2 second delay or will it increase, the longer you record? First: Dunno. Second: Probably a better pc will fix it. Or a better sound card. Or whatever. Looking for an answer to that, too.

Offline

#4 2011-11-08 13:24:48

stressat
Member
From: Romania
Registered: 2010-10-10
Posts: 73
Website

Re: ffmpeg sound delayed when recording screen

@awayand: did you tried with other parameters (see ffmpeg manual audio section)? I use ffmpeg with great results:
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1280x960 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.mpg
Or, simplest:
ffmpeg -f x11grab -s 1280x960 -r 30 -b 6500 -bt 712k -sameq output.mpg

Even audio- video capture on tty is ok (and i have an old PC...):
ffmpeg -f alsa -i pulse -f fbdev -r 30 -i /dev/fb0 output.mpg

Last edited by stressat (2011-11-08 13:31:37)

Offline

#5 2011-11-08 14:25:38

awayand
Member
Registered: 2009-09-25
Posts: 398

Re: ffmpeg sound delayed when recording screen

hi stressat, thanks for all that! I tried your examples, with the following results:

ffmpeg -f alsa -ac 2 -i hw:0 -f x11grab -r 30 -s wxga -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.mpg

playing back the above with "mplayer output.mpg" yields error:

[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback..

followed by squeaky noises out of the speaker. No idea why mplayer chooses OSS, after all I selected alsa? Also, as you can see, no video, even though I do have x264 installed. sad

Your second example:

ffmpeg -f x11grab -i :0.0 -s wxga -r 30 -b 6500 -bt 712k -sameq output.mpg

Playback shows only part of my screen, but bigger as if it had been switched to 640x480 before recording. Odd.

Didn't try fbdev as I want to record an X session. No idea why the video in the first example won't record, maybe I have to play with a different codec? I am using a fairly recent laptop, so I shouldn't have an issue (Aspire AS3810tg)

Thanks for your help so far! It is very much appreciated, even if I may not ever find the right settings...
I also took a peek inside /usr/lib/x264.h but that didn't enlighten me at all about what other options I could try passing to the library...

Offline

Board footer

Powered by FluxBB