[Libav-user] Audio frames and resampling

Gonzalo Garramuño ggarra13 at gmail.com
Wed Mar 14 18:41:27 EET 2018

El 14/03/18 a las 09:03, Michael IV escribió:
> Hi.I have the following case:
> I am receiving audio stream which consist
>  of 2 channel float 32 (non planar) audio frames. Then I am trying to 
> convert those into
> AV_SAMPLE_FMT_FLTP in order to encode with AAC codec. The problem is 
> that I receive that data as packets of size different from what my 
> AVFrame has. AVFrame for
> this codec has 2 buffers,each 1024 samples,which is 4096 bytes per 
> channel (32bit sample size),right? So it looks like I have to fill the 
> frame with all 4096 bytes before pushing it into encoder?Is it 
> possible to submit 'custom' frames,with different amount of data from 
> what I am getting in codec context?

No.  You need to buffer the data.  Look at the av_audio_fifo* set of 
functions for a simple way of doing it.

Gonzalo Garramuño

More information about the Libav-user mailing list