当前位置: 首页 > 图灵资讯 > 技术篇> FFmpeg -strict -2 参数详解

FFmpeg -strict -2 参数详解

来源:图灵教育
时间:2023-05-23 09:22:32

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音频编码可以使用此参数。

-sameq 指相同的量级数,常被误用为“相同的画质”,因此被取消。不支持libfac库,官方推荐使用-qscale和-qmax代替ffmpeg,fac库音质一般。 还支持2套AAC音频编码,-acodec aac  在实验阶段,ffmpeg自制的AAC编码器需要打开“-strict experimental“参数,音质也不差。-acodec libvo_aacenc AAC编码器移植自安卓系统,比较成熟。

追问

我发现-qmax或qmax-qscale 以后需要填写一个数字。这个数字是什么意思?-sameq相同的量级是什么意思?谢谢你

追答

像xvid或x264这样的编码器对编码程度有定量级数。-sameq保持与输入时相同的等级,但如果编码再次损坏,画质肯定会下降,所以画质不一样。-qmax n 在声明变化级数编码时,最大级数整数n。 n值由具体编码决定,x264在[0,51]之间。0代表最好,51最差-qscale n x264在[0,51]之间,具有固定的量化级N编码。

追问

非常感谢!

参考地址:

http://trac.ffmpeg.org/wiki/Encode/AAC

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.

Example using -b:a

ffmpeg -i input.wav -c:a aac -b:a 160k output.m4a

Example using -q:a

ffmpeg -i input.wav -c:a aac -q:a 2 output.m4a

Effective range for -q:a is around 0.1-2. This VBR is experimental and likely to get even worse results than the CBR.