我需要转换音频流的格式。例如:假设音频流格式是 16 位小端,我想将其转换为 16 位大端。
我怎样才能做到这一点?
答案1
它应该是这样的:
$ ffmpeg -i input-file.wav -acodec pcm_f32le -ar 96000 output-file.wav
如果您使用 PCM,您会有很多选择,其他编解码器可能会受到某些配置文件的限制。
$ ffmpeg -formats 2>/dev/null | grep endian
DE f32be PCM 32 bit floating-point big-endian format
DE f32le PCM 32 bit floating-point little-endian format
DE f64be PCM 64 bit floating-point big-endian format
DE f64le PCM 64 bit floating-point little-endian format
DE s16be PCM signed 16 bit big-endian format
DE s16le PCM signed 16 bit little-endian format
DE s24be PCM signed 24 bit big-endian format
DE s24le PCM signed 24 bit little-endian format
DE s32be PCM signed 32 bit big-endian format
DE s32le PCM signed 32 bit little-endian format
DE u16be PCM unsigned 16 bit big-endian format
DE u16le PCM unsigned 16 bit little-endian format
DE u24be PCM unsigned 24 bit big-endian format
DE u24le PCM unsigned 24 bit little-endian format
DE u32be PCM unsigned 32 bit big-endian format
DE u32le PCM unsigned 32 bit little-endian format
$ ffmpeg -codecs 2>/dev/null | grep endian
D A D pcm_bluray PCM signed 16|20|24-bit big-endian for Blu-ray media
D A D pcm_dvd PCM signed 20|24-bit big-endian
D A D pcm_f32be PCM 32-bit floating point big-endian
D A D pcm_f32le PCM 32-bit floating point little-endian
D A D pcm_f64be PCM 64-bit floating point big-endian
D A D pcm_f64le PCM 64-bit floating point little-endian
D A D pcm_lxf PCM signed 20-bit little-endian planar
D A D pcm_s16be PCM signed 16-bit big-endian
D A D pcm_s16le PCM signed 16-bit little-endian
D A D pcm_s16le_planar PCM 16-bit little-endian planar
D A D pcm_s24be PCM signed 24-bit big-endian
D A D pcm_s24le PCM signed 24-bit little-endian
D A D pcm_s32be PCM signed 32-bit big-endian
D A D pcm_s32le PCM signed 32-bit little-endian
D A D pcm_u16be PCM unsigned 16-bit big-endian
D A D pcm_u16le PCM unsigned 16-bit little-endian
D A D pcm_u24be PCM unsigned 24-bit big-endian
D A D pcm_u24le PCM unsigned 24-bit little-endian
D A D pcm_u32be PCM unsigned 32-bit big-endian
D A D pcm_u32le PCM unsigned 32-bit little-endian