FFmpeg在libswresample模块提供提供音频转换函数,以前使用的libavresample模块已经过时。根据官方文档说明:libswresample提供深度优化的音频重采样、声道布局转换与格式转换。音频重采样过程是先建立原始音频信号,然后重新采样。重采样分为上采样和下采样,其中上采样需要插值,下采样需要抽取。从高采样率到低采样率转换是一种有损过程,FFmpeg提供若干选项和算法进行重采样。
1、libswresample模块介绍
FFmpeg关于libswresample模块介绍,包括重采样、格式转换与声道布局转换,具体文档可查看:https://ffmpeg.org/libswresample.html。具体描述如下:
The libswresample library performs highly optimized audio resampling, rematrixing and sample format conversion operations.
Specifically, this library performs the following conversions:
Resampling: is the process of changing the audio rate, for example from a high sample rate of 44100Hz to 8000Hz.
Audio conversion from high to low sample rate is a