[FFmpeg-user] ffmpeg not honoring requested sample rate when outputting opus to .ogg

Adam Langley ffmpeg.org at irisdesign.co.nz
Mon Aug 29 05:06:50 EEST 2016


I am capturing a live audio stream to Opus, and no matter what I choose for
the audio sample rate, I get 48khz in the output file.

This is my command line

./ffmpeg -f alsa -ar 16000 -i sysdefault:CARD=CODEC -f alsa -ar 16000 -i
sysdefault:CARD=CODEC_1 -filter_complex
join=inputs=2:channel_layout=stereo:map=0.1-FR\|1.0-FL,asetpts=expr=N/SR/TB
-ar 16000 -ab 64k -c:a opus -vbr off -compression_level 5 output.ogg

And this is what ffmpeg responds with:

Output #0, ogg, to 'output.ogg': Metadata: encoder : Lavf57.48.100 Stream
#0:0: Audio: opus (libopus), 16000 Hz, stereo, s16, delay 104, padding 0,
64 kb/s (default) Metadata: encoder : Lavc57.54.100 libopus

However, it appears that ffmpeg has lied, because when analysing the file
again, I get:

Input #0, ogg, from 'output.ogg': Duration: 00:00:03.21, start: 0.000000,
bitrate: 89 kb/s Stream #0:0: Audio: opus, 48000 Hz, stereo, s16, delay
156, padding 0 Metadata: ENCODER : Lavc57.54.100 libopus

I should also mention, that VLC also reports the file as being 48Khz - and
the file size is way too big to be 16khz - so I'm pretty confident that it
actually contains 48000 samples per second of data.... I decoded the file
to WAV, then used opusenc to compress it back to 16Khz, and it was way
smaller....
I have tried so many permutations of sample rate, simplifying down to a
single audio input etc etc - always with the same result.

Thanks,


More information about the ffmpeg-user mailing list