[Libav-user] Converting audio sample buffer format

Paul B Mahol onemda at gmail.com
Tue Feb 26 19:51:26 CET 2013

On 2/26/13, Brad O'Hearne <brado at bighillsoftware.com> wrote:
> On Feb 26, 2013, at 4:39 AM, Rene J.V. Bertin <rjvbertin at gmail.com> wrote:
>> On Feb 26, 2013, at 02:54, Brad O'Hearne wrote:
>>> - Linear PCM, 24 bit little-endian signed integer, 2 channels, 44100 Hz
>> You realise that your earlier message mentioned 32 bit float capture
>> data?
> Rene - thank you for your attention to detail. You are correct -- the sample
> format I mentioned above was a sleep-deprived copy/paste mistake. The proper
> sample format was as I originally stated:
> - Linear PCM, 32 bit little-endian floating point, 2 channels, 44100 Hz
> Thanks again for the good catch! So back to the issue at hand -- I've done a
> fair amount of reading on audio formats and structure, but I'm still not
> completely clear on the layout of these buffers depending on #of bits,
> channels, whether they are interleaved, and sample rate, alignment, and
> endianness (though with the other info this may be clear). I'm sure there
> are a few simple principles at work -- but if there's someone that has a
> good grasp of how these layouts work, I'll give it the college try to
> convert the sample format myself.
> Having said that, if anyone has any idea or suggestions for how to fix the
> original issue (which I've traced as far as the swri_realloc_audio call
> inside of swr_convert).
> Thanks everyone's help and discussion thus far -- it is greatly appreciated.

Planar is used if sample_fmt is set to planar one - in this case for
every channel, channel samples are stored in separate buffer eg.
p->data[X] where X is channel number.

Interleaved use only p->data[0] and every channel sample comes one
after another.

Samples are always considered to be in native endiannes (you need to
do swapping on your own)

> Cheers,
> Brad
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

More information about the Libav-user mailing list