[FFmpeg-user] Strange Audio Rate Issues

Brian Neltner neltnerb at MIT.EDU
Mon May 13 06:43:27 CEST 2013

Dear FFMPEG Users,

Apologies for the hopefully obvious question, but I've been struggling
with this for a few days and it's driving me nuts.

I'm trying to do a screen capture from my desktop with captured audio. I
am starting with the most trivial command I can generate to do this:

ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 15 -s 1920:1080 -i :0.0
-acodec libmp3lame output.mp4

The issue is that when I use this command to simultaneously do a screen
capture along with audio capture from my pulseaudio capture port set to
monitor it does not record at the proper audio rate, but claims it did.


Video: https://www.dropbox.com/s/13hwuxd2p725re6/output.mp4
Audio: https://www.dropbox.com/s/vc15pvpvg74aj3q/output.mp3

The video clearly shows that the mp4 audio sample rate is 48000Hz, and
shows clearly that sox is generating a 440Hz tone at 48000Hz sample
rate. The audio file is directly outputting from sox into a file, and
accurately represents what I hear through my speakers.

As you can see, the mp4 file (same issue with avi, FWIW) has a frequency
shifted sine wave from 440Hz and drifts out of audio sync rapidly. You
can clearly see the levels on the mixer showing that it's not playing
when it should be (along with watching the play command).

This makes no sense to me; I've tried multiple audio codecs, multiple
output formats (avi and mp4), multiple manual audio rates, I tried
manually setting the video frame rate, but it all ends up the same.
Obviously, this makes recording a screen capture with correctly
synhronized audio in less constructed cases impossible.

Can anyone explain to me what is going on?

I am using ffmpeg version 0.10.6-6:0.10.6-0ubuntu0jon1

Best regards,

More information about the ffmpeg-user mailing list