ffmpeg 提取音视频文件中的音频: ffmpeg -i input.flv -vn -acodec aac audio.aac音频转码成pcm(G711A) ffmpeg -i audio.aac -f alaw auido.pcm播放pcm音频文件 ffplay -i audio.pcm -f alaw -ac 2 -ar 44100 备注: -f: 指定PCM格式 -ac: 指定通道数 -ar: 制定采样率 pcm音频只包含数据,没有数据头指定采样率、通道数、数据位数等,所以需要在转码之前指定这些参数.PCM支持的PCM格式如下:
$ffmpeg -formats |grep PCM
DE alaw PCM A-law
DE f32be PCM 32-bit floating-point big-endian
DE f32le PCM 32-bit floating-point little-endian
DE f64be PCM 64-bit floating-point big-endian
DE f64le PCM 64-bit floating-point little-endian
DE mulaw PCM mu-law
DE s16be PCM signed 16-bit big-endian
DE s16le PCM signed 16-bit little-endian
DE s24be PCM signed 24-bit big-endian
DE s24le PCM signed 24-bit little-endian
DE s32be PCM signed 32-bit big-endian
DE s32le PCM signed 32-bit little-endian
DE s8 PCM signed 8-bit
DE u16be PCM unsigned 16-bit big-endian
DE u16le PCM unsigned 16-bit little-endian
DE u24be PCM unsigned 24-bit big-endian
DE u24le PCM unsigned 24-bit little-endian
DE u32be PCM unsigned 32-bit big-endian
DE u32le PCM unsigned 32-bit little-endian
DE u8 PCM unsigned 8-bit
DE vidc PCM Archimedes VIDC
有时,我们通过ffprobe得到文件的PCM格式为fltp,但是从上述的format中并没有找到该格式,通过尝试, fltp对应的就是f32le格式.