[Libav-user] libswresample- audio

Sartre Salam gmxubuntu at yahoo.de
Mon Oct 15 14:42:27 CEST 2012


Hi, I need to resample audio data from 44,1KHz to 48KHz, 

I have read some examples and I decide to use libswresample
for this issue.
Some code for the resample is this:

SwrContext *ctx = NULL;

ctx = swr_alloc_set_opts(ctx,AV_CH_LAYOUT_STEREO,AV_SAMPLE_FMT_16,48000,
                                         AV_CH_LAYOUT_STEREO,AV_SAMPLE_FMT_16,44100,0,0);

if(swr_init(ctx) < 0)
     return -1;
.....
........

int  resample_samples = swr_convert(ctx,(uint8_t**)&pcmBuffer,resamplesize,
                                         (const uint8_t**)&pFrameRawInit->data[0],data_size,0,0);


fwrite(pcmBuffer,resample_samples,1,outfile);
......
.....
swr_free(&ctx);

When I play the pcm data in the with the new sample rate, I can here the sound with the
right speed, but there is another noise like a buzz. Has somebody an idea, how can I
resample correctly without another sounds, should I use a filter?, If so, where is an example.
I would be really helpfull. And sorry, I dont know if this is the right mailing list for this issue.


arctor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121015/cf91a0de/attachment.html>


More information about the Libav-user mailing list