[opusdec] Why is the output GstBuffer size 3840 instead of 4096 bytes with S16LE/2/48000 output format?

Tim Müller tim at centricular.com
Wed Apr 22 03:48:00 PDT 2015


On Wed, 2015-04-22 at 01:17 -0700, Arjen Veenhuizen wrote:

Hi,

> Using GIT HEAD, I am working with 16 bit, 2 channel, interleaved, little
> endian PCM audio (S16LE).
> When generating a single buffer with the following pipeline, 
> 
> I get an output file of exactly 4096 bytes, which is to be expected ((2
> [channels] * 16 [bits per sample] * 1024 [samples per buffer]) / 8  = 4096
> bytes)
> 
> But, when I use opusdec to decode an "audio/x-opus,rate=48000,channels=2"
> stream, I only get 3840 bytes/GstBuffer
> See also the lower branch of the following pipeline:
> http://postimg.org/image/t4h3bvl37/full/ 
> As you can see in that picture, the raw format after the opusdec element is
> supposed to be "audio/x-raw, layout=interleaved, format=S16LE, rate=48000,
> channels=2" as well. It looks to me as if the opusdec is only putting 960
> samples in a single GstBuffer.
> 
> For my application to work, I really need the correct sized (4096 byte)
> GstBuffers. What am I doing wrong?

I think it depends on how it's been encoded. If you look at

 gst-inspect-1.0 opusenc

you'll see there's a "frame-size" property, which defaults to 20ms,
which is what 960/48000 samples is. You can make it shorter, but there's
no preset in the GStreamer wrapper for the exact number of samples you
want.

Cheers
 -Tim
-- 
Tim Müller, Centricular Ltd - http://www.centricular.com



More information about the gstreamer-devel mailing list