[Libav-user] AC3 -> LPCM -> MPEG2 PES

Andrey Utkin andrey.krieger.utkin at gmail.com
Fri Feb 24 15:12:28 CET 2012

2012/2/24 Pavel Sokolov <pavel at sokolov.me>:
> Hi All!
> I need to get LPCM data from ac3, to add it later to MPEG2 PES packet.
> I'm using "avcodec_decode_audio4" to decode ac3 packet.
> In which format the resulting AVFrame structure stores data?

The decoded audio data format can be checked in AVFrame.format, and
also AVCodecContext.sample_fmt. For audio, check it with enum
AVSampleFormat. Sample rate is in AVCodecContext.sample_rate.

> Is it in LPCM
> format or something else format?

The most widely used is AV_SAMPLE_FMT_S16, which stands for signed
16bit samples. So the answer is practically yes.

Andrey Utkin

More information about the Libav-user mailing list