[FFmpeg-user] [ffmpeg-user] How are audio frames decoded by libavcodec?

Quy Pham Sy phamsyquybk at gmail.com
Wed Nov 28 08:38:08 CET 2012

Here is how my process of decoding an audio stream using ffmpeg's libav*

[videofile]--> (read audio packets) --> [pkts queue] --> (decoder) -->
speaker's sample buffer

for some reason i need to insert a buffer after decoder

[videofile]--> (read audio packets) --> [pkts queue] --> (decoder) -->
[samples buffer] --> speaker's sample buffer

Audio samples in the samples buffer are LPCM 16bits. To save the pts of the
audio sample buffer i save pts of first samples. By that way, i can
calculate pts of any sample in the buffer.

Problem is that the calculation is correct only if the audio stream
contains contiguous audio samples. Do ffmpeg's decoded audio frames always
contain contiguous samples?

More information about the ffmpeg-user mailing list