[FFmpeg-user] Strange Audio Rate Issues

Brian Neltner neltnerb at MIT.EDU
Tue May 14 05:31:26 CEST 2013


I have tried adding -ar 44100 both before -i pulse, before -acodec
libmp3lame, and both simultaneously. Similarly with 48000. Also the same
issue with ac3 and pcm encoding (although pcm didn't like going into

Even stranger because whether I tell it that the input is at 48000,
44100, or 22050, it always pitch shifts down on playback despite
claiming to be at the chosen sample rate.

The only thing I can think of is that it has some hardcoded assumption
about the alsa sample rate that it's trying to then convert in software
without actually checking it on the hardware. I'm going to try to figure
out how to see what the default sample rate is in alsa or something, but
I'm totally unfamiliar with that system.


On Mon, 2013-05-13 at 00:43 -0400, Brian Neltner wrote:
> 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.
> Examples:
> 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,
> Brian
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

More information about the ffmpeg-user mailing list