> I tried to resample the audio, and it really did the job. Still, one issue 
> remained: along with the voice, there's a very loud permanent noise (kind of 
> background crackles/hum).

Well, it seems that the problem wasn't in the parameters to 
av_audio_resample_init(), but in audio_resample(). In my program it looked like 
this:

unsigned char pcm[AVCODEC_MAX_AUDIO_FRAME_SIZE];
int cb = sizeof(pcm);
avcodec_decode_audio3(ctx_.get(), (short *)pcm, &cb, &packet_);
// <...>
unsigned char pcm2[AVCODEC_MAX_AUDIO_FRAME_SIZE];
audio_resample(resampleCtx, (short *)pcm2, (short *)pcm, cb / 4);

I assumed that "cb" is in bytes, and every sample is 4 bytes - thus passed cb/4 
to audio_resample(), and this resulted in crackles/hum.
If I change it to cb/2 -- everything sounds ok.


_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to