9

我绝对不是 FFMPEG 专家,但根据这个文件

预设是一组选项,可提供一定的编码速度与压缩比。较慢的预设将提供更好的压缩(压缩是每个文件大小的质量)。一般用法是使用您有耐心的最慢预设。当前按速度降序排列的预设是:超快、超快、非常快、更快、快、中、慢、慢、非常慢、安慰剂。

所以据我了解,ffmpeg预设不应该影响输出视频的质量,而应该只决定压缩比/输出文件大小。因此,假设相同的质量设置(我将使用),例如,预设-crf 24文件应该比预设文件更大。这将是使用较慢预设的唯一原因 - 以获得更小的文件大小。fasterslower

事实证明并非如此。我使用不同的预设对来自handycam的高清流进行编码,其他一切都是一样的:

ffmpeg -y -i "$fname" -vf yadif=1,scale=-1:720 -acodec aac -ab 128k -ac 2 -strict experimental -vcodec libx264 -vpre slow -threads 2 -crf 24 "$outp"

令人惊讶的是,我得到了最小的veryfast预设文件大小!例如:

  • slower: 输出比特率 3500kbps, 编码速度 17 fps, 文件大小 29MB
  • veryfast: 输出比特率 3050kbps, 编码速度 34 fps, 文件大小 25MB

我认为这不是应该的。现在我想知道,这是因为veryfast预设的编码质量较差吗?或者在我的情况下slower,由于某种原因使用根本没有意义?

4

2 回答 2

15

是的,质量可能会因使用的预设而略有不同,但应该不会很大。这是关于#x264 的讨论的摘录。一位 x264 开发人员提供的答案与您的类似问题:

verb3k | Do different presets have an effect on quality when used with CRF?
@Dark_Shikari | verb3k: yes, but not too much.
@Dark_Shikari | a 0th-order approximation is that they have no effect.
@Dark_Shikari | The main reason there's a difference is because the preset affects how x264 itself measures quality
@Dark_Shikari | that is, it uses better, more accurate methods of measuring quality
@Dark_Shikari | obviously, this will affect the definition of what -crf does!
@Dark_Shikari | It's just not too much, so we can mostly ignore it.
@Dark_Shikari | specifically, there are three big things that can affect the definition of quality
@Dark_Shikari | 1) AQ being on/off
@Dark_Shikari | jump: ultrafast to superfast
@Dark_Shikari | 2) mbtree being on/off
@Dark_Shikari | jump: superfast to veryfast
@Dark_Shikari | 3) psy-rd being on/off
@Dark_Shikari | jump: faster to fast
@Dark_Shikari | above fast there are no more big jumps.

这意味着具有相同 CRF 值的较慢预设将提高每比特率的质量,但可能会使质量和比特率更高更低。

于 2013-01-13T21:47:11.423 回答
5

如果有帮助,这里是git difffrom slowerto veryfast。即使您只考虑ref价值,您也可以看到veryfast质量如何降低。

ref
In short, this value is the number of previous frames each P-frame can use
as references.

来源

--- a/slower
+++ b/veryfast
@@ -1,20 +1,20 @@
 cabac=1
-ref=8
+ref=1
 deblock=1:0:0
-analyse=0x3:0x133
-me=umh
-subme=9
+analyse=0x3:0x113
+me=hex
+subme=2
 psy=1
 psy_rd=1.00:0.00
-mixed_ref=1
+mixed_ref=0
 me_range=16
 chroma_me=1
-trellis=2
+trellis=0
 8x8dct=1
 cqm=0
 deadzone=21,11
 fast_pskip=1
-chroma_qp_offset=-2
+chroma_qp_offset=0
 threads=12
 lookahead_threads=2
 sliced_threads=0
@@ -25,17 +25,17 @@ bluray_compat=0
 constrained_intra=0
 bframes=3
 b_pyramid=2
-b_adapt=2
+b_adapt=1
 b_bias=0
-direct=3
+direct=1
 weightb=1
 open_gop=0
-weightp=2
+weightp=1
 keyint=250
 keyint_min=23
 scenecut=40
 intra_refresh=0
-rc_lookahead=60
+rc_lookahead=10
 rc=crf
 mbtree=1
 crf=23.0
于 2013-01-13T18:12:56.393 回答