最近用到ffmpeg,需要把mp3转成aac,调用以下命令参数:
如果不加 -strict experimental ios端可能播放MP3音频失败
ffmpeg -i xxx.mp3 -acodec aac -strict experimental -ab 128k -ar 16k -ac 2 -y xxx.aac
参数定义:
ab :码率
ar :采样率
ac :声道
ios端无法播放mp3音频
FFmpeg -strict -2 参数详解
FFmpeg -strict -2 的这个参数好多说的不太正确 好多都是说 -strict strictness 跟标准的严格性 解释的和实际含义差别很大 这里详细说明下:
ffmpeg -re -i /Users/Downloads/RelaxingGuitarMusic.3gp -vcodec copy -acodec copy -strict -2 -f flvrtmp://192.168.10.61:1935/zbcs/room
ffmpeg -re -i /Users/Downloads/RelaxingGuitarMusic.3gp -vcodec copy -acodec copy -strict -2 -f flvrtmp://localhost:1935/zbcs/room
ffmpeg -re -i /Users/Downloads/RelaxingGuitarMusic.3gp -vcodec libx264 -acodec aac -strict -2 -f flvrtmp://192.168.10.61:1935/zbcs/room
Native FFmpeg AAC encoder ¶
The native FFmpeg AAC encoder. This is currently the second highest-quality AAC encoder available in FFmpeg and does not require an external library like the other AAC encoders described here. This is the default AAC encoder.
Note: -strict experimental (or -strict -2) was previously required for this encoder, but it is no longer experimental and these options are unnecessary since 5 December 2015.
-strict -2 之前是实验参数表示 aac音频编码 如果不使用aac音频编码使用使其的编码好像还需要导入第三方的音频编码库 比较麻烦 使用FFmpeg自带的aac音频编码要带上-strict -2 参数就可以了。带这个参数是为了使用aac音频编码。
https://zhidao.baidu.com/question/539258608.html -sameq 指相同的量级数,常被误用成“相同的画质”,所以被取消。官方推荐用-qscale和-qmax替代ffmpeg不支持libfaac库,faac库音质也一般。 另支持2套AAC音频编码,-acodec aac 是ffmpeg自制的AAC编码器,处在实验阶段,需要开启"-strict experimental"参数,音质也不差。-acodec libvo_aacenc 是移植自安卓系统的AAC编码器,比较成熟。