基本示例
ffmpeg -i input.flac -sample_fmt s16 -ar 48000 output.flac
- 列出示例格式:
ffmpeg -sample_fmts
- 列出其他 flac 编码选项:
ffmpeg -h encoder=flac
是样本 https://ffmpeg.org/ffmpeg-filters.html#aresample过滤器示例
ffmpeg -i input.flac -af aresample=out_sample_fmt=s16:out_sample_rate=48000 output.flac
这两个示例都会产生相同的输出:您可以使用以下命令进行验证哈希混合器 https://ffmpeg.org/ffmpeg-formats.html#hash.
改变抖动方法
See the -dither_method option https://ffmpeg.org/ffmpeg-resampler.html了解可用的抖动方法和其他重采样选项的列表。例子:
ffmpeg -i input.flac -dither_method triangular_hp -sample_fmt s16 -ar 48000 output.flac
SoX 重采样器
FFmpeg 支持两种重采样器:默认的 swresample 库和外部SoX 重采样器 https://sourceforge.net/p/soxr/ (soxr).
要使用 soxr 您的ffmpeg
必须编译--enable-libsoxr
。然后用-resampler
option:
ffmpeg -i input.flac -resampler soxr -sample_fmt s16 -ar 48000 output.flac
或者使用是样本 https://ffmpeg.org/ffmpeg-filters.html#aresample过滤器来完成这一切:
ffmpeg -i input.flac -af aresample=resampler=soxr:out_sample_fmt=s16:out_sample_rate=48000 output.flac
更多信息
- FFmpeg 重采样器文档 https://ffmpeg.org/ffmpeg-resampler.html