[Libav-user] hello i need help in using swreample lib.

Stefano Sabatini stefasab at gmail.com
Fri Nov 30 23:47:17 CET 2012


On date Friday 2012-11-30 21:51:18 +0200, Rafi Fisher encoded:
> hello
> 
>    i try to trancode audio frames decoded from mp2 file into wav file.
> 
>    so from what i understand
> 
>       my input buffer should be the:    *uint8_t *data *field in the*AVFrame
> * structure
> 
>        my output buffer should be  allocated  using :
> 

>         int* av_samples_alloc*(uint8_t **audio_data, int *linesize, int
> nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align);
> 
>         what size should i put in* nb_samples* parameter ?

It depends, I suppose it will be the number of decoded samples.

> 
>          then i understand i should call :
> 
>              int *swr_convert*(struct SwrContext *s, uint8_t **out, int
> out_count, const uint8_t **in , int in_count);
> 
>              and pass* AVFrame data* filed as input buffer & the allocated
> samples buffer as the output buffer.
> 
>              how do i calculate the* in_count & the out_count*. parameters.

It should be big enough to contain the samples after conversion samples.

Check this code:
http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/155151

[...]


More information about the Libav-user mailing list