FFMPEG H264压缩预设是否会影响视频质量?

FFMPEG H264压缩预设是否会影响视频质量?,ffmpeg,Ffmpeg,我肯定不是FFMPEG专家,但根据: 预设是提供特定编码速度与压缩比的选项集合。较慢的预设将提供更好的压缩(压缩是每个文件大小的质量)。一般用法是使用您有耐心的最慢预设。按速度降序排列的当前预设值为:超快、超快、极快、更快、快速、中等、慢速、极速、安慰剂 因此,据我所知,ffmpeg预设不应影响输出视频的质量,而应仅确定压缩比/输出文件大小。因此,假设相同的质量设置(我将使用-crf 24),例如快的预设的文件应大于慢的预设的文件。这将是使用较慢的预设的唯一原因-以获得较小的文件大小 事实证明并

我肯定不是FFMPEG专家,但根据:

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

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

事实证明并非如此。我使用不同的预设对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
preset的最小文件大小!例如:

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

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

如果有帮助,这里有一个
git diff
slow
veryfast
。即使你只考虑<代码> REF值,你也可以看到<代码> VelyFAST/<代码>的质量如何。

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


是的,根据所使用的预设,质量可能略有不同,但不应太大。以下是关于#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值的较慢预设将提高每比特率的质量,但可能使质量和比特率更高或更低。

感谢这一点-非常有用的阅读。现在似乎更清楚了,虽然我必须进行实验,看看“不太多”意味着什么。@LordNeckbeard我应该修改什么以减少转换失败的机会,它是随机发生的,有时不会happen@LordNeckbeard没有人能给我真正的建议,更糟糕的是,我不知道该去哪里调查。尝试了不同的服务器,不同的ubuntu,最新版本,不同的设置,谷歌搜索到1001页。现在我在评论中
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.