记录生活中用到的ffplay和aplay命令
1. ffplay
利用音频过滤器可以实现倍速播放或慢速播放
ffplay later.mp3 -af atempo=2.0
atempo过滤器的范围是[0.5, 2]之间,如果要实现4倍速播放,可以用两个atempo过滤器
ffplay later.mp3 -af atempo=2.0,atempo=2.0 -nodisp
滤镜链使用";“分隔,滤镜链中滤镜使用”,"分隔
二倍速播放16kHz 单声道,16bit 样本pcm录音
ffplay -ar 16000 -channels 1 -f s16le -i recog.pcm -af atempo=2.0
播放44100采样率,2 channel,16bit样本
ffplay -ar 44100 -channels 2 -f s16le -i later.pcm
淡入淡出效果命令
ffmpeg -i later.mp3 -af "volume='if(lt(t,10),0.2,min(0.2+(t-10)/10*(1-0.2),1))':eval=frame" xxx.wav
ffmpeg -i later.mp3 -af "afade=t=in:ss=0:d=15,afade=t=out:st=30:d=15,volume=volume=0.3" -t 60 xxx.wav
ffplay later.mp3 -af "afade=t=in:ss=0:d=15,afade=t=out:st=30:d=15,volume=volume=0.3"
提升log级别为最高
ffplay -v 56 "嘻嘻嘻.m4a"
2. aplay播放命令
播放PCM原始数据
aplay -t raw -r 44100 -f S16_LE -c 2 decoder.raw
调试过程中dump音频数据代码
if(1) {
FILE *fp1 = fopen("./decoder.raw", "a+");
if(fp1 != NULL) {
fwrite((char *)audio, 1, frames * channels * 2 , fp1);
fclose(fp1);
}
}