V0id ?????:
Hi.
For my project I have to convert audio from different sources to one
common format: sample rate, sample format, channels number. And I'm
confused a bit with API as there several functions to do so.
In my project I'm trying to do something like that:
const int RATE = 44100;
const int CHANNELS = 2;
ReSampleContext *resampleCtx;
*resampleCtx = av_audio_resample_init(CHANNELS, stream->codec->channels,
RATE, stream->codec->sample_rate,
SAMPLE_FMT_S16, stream->codec->sample_fmt,
16, 10, 1, 0.8);
----------decoding audio to outBuf----------
//assuming outBuf filled with SAMPLE_FMT_S16 samples
int rslt = audio_resample(resampleCtx, (short*) outResampledBuf, (short*)
outBuf, outBufSize/2);
----------sending outResampledBuf to sound devise which is opened in
44100/2/s16le mode---
audio_resample_close(resampleCtx);
But audio plays with a lot of clicks and cracks. In this case source has
48000 sample rate, but same is true when upsampling from 44100 to 48000.
Can somebody tell my what am I doing wrong?
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Hi!
Function audio_resample receive and return number of samples. One sample
include all audio information at one time. In your case it means that
last param for audio_resample must be outBufSize/4 (if outBufSize
measures in bytes). I use the same code with good quality of a sound as
a result.
Regards, Anatoliy.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user