FFMPEG H264压缩预设是否会影响视频质量? [英] Do FFMPEG H264 compression presets affect the video quality?

查看:670
本文介绍了FFMPEG H264压缩预设是否会影响视频质量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我绝对不是FFMPEG专家,但是根据此文档:

I am definitely not an FFMPEG expert, but according to this document:

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

A preset is a collection of options that will provide a certain encoding speed to compression ratio. A slower preset will provide better compression (compression is quality per filesize). General usage is to use the slowest preset that you have patience for. Current presets in descending order of speed are: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo.

据我了解,ffmpeg预设不应影响输出视频的质量,而应仅确定压缩率/输出文件大小.因此,假设相同的质量设置(我将使用-crf 24),则例如faster预设的文件应大于slower预设的文件.那将是使用较慢的预设的唯一原因-以获得较小的文件大小.

So as I understand it, the ffmpeg presets should not affect the quality of the output video, but should only determine the compression ratio / output file size. Consequently, assuming the same quality setting (I will use -crf 24), the files should be larger for e.g., faster preset than for the slower preset. That would be the only reason to use a slower preset - to get a smaller file size.

事实并非如此.我使用不同的预设对来自便携式摄像机的高清流进行编码,其他所有内容都是相同的:

This turns out not to be the case. I encode a HD stream from a handycam using different presets, everything else is the same:

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预设的最小文件大小!例如:

Surprisingly, I get the smallest file size for veryfast preset! For example:

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

我认为不是应该的.现在我想知道这是由于veryfast预设的编码质量较差吗?还是就我而言,使用slower出于某种原因根本就没有意义?

Which I think is not as it should be. Now I wonder, is that due to a worse encoding quality for the veryfast preset? Or in my case using slower does simply not make sense for some reason?

推荐答案

是的,质量可能会略有不同,具体取决于所使用的预设,但数量不算多.这是#x264讨论的摘录.与您类似的问题,由x264开发人员之一提供的答案:

Yes, quality may vary slightly depending on the preset used, but it should not be a significant amount. Here's an excerpt from a discussion on #x264. Similar question to yours with answers provided by one of the x264 developers:

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值的较慢预设将提高每个比特率的质量,但可能会使质量和比特率更高更低.

This means that a slower preset with the same CRF value will improve quality per bitrate, but might make both quality and bitrate higher or lower.

这篇关于FFMPEG H264压缩预设是否会影响视频质量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆