Search code examples
libav

Libavresample: convertion from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16P is not clear


after using "avresample_convert" to convert from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16P the sound is not clear (bad quality, some noises)

The sample rate is the same, I need to convert from the floating point planar format to the signed 16 bit planar format only.

How to convert audio format from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16P correctly?


Solution

  • I found the problem: If you try to convert AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16P you should use internal FIFO buffer and operate(pass to encoder) with exact 1152 audio samples per audio frame(in my case it was mpeg2).

    some useful infos, an audio frame contains xyz audio samples per channel:

    • aac: 1024
    • mpeg(layer1): 384
    • mpeg(layer2): 1152