Quality beyond Very Slow or Placebo in H.264?

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
Dysthymia
Posts: 24
Joined: Fri Nov 04, 2016 12:21 pm

Quality beyond Very Slow or Placebo in H.264?

Post by Dysthymia »

According to the tooltip in the Extra Options field, these are the parameters for the H.264 Encoder presets:

Very Slow
ref=16:bframes=8:b-adapt=2:direct=auto:analyse=all:me=umh:merange=24:subme=10:trellis=2:rc-lookahead=60

Placebo
ref=16:bframes=16:b-adapt=2:direct=auto:analyse=all:me=tesa:merange=24:subme=11:trellis=2:fast-pskip=0:rc-lookahead=60

Are there any valid values for these variables that could further extend quality?
rollin_eng
Veteran User
Posts: 4854
Joined: Wed May 04, 2011 11:06 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by rollin_eng »

Placebo is named that for a reason, don't use it, and don't use even slower settings.
Woodstock
Veteran User
Posts: 4619
Joined: Tue Aug 27, 2013 6:39 am

Re: Quality beyond Very Slow or Placebo in H.264?

Post by Woodstock »

You cannot add quality to a source, just avoid removing much.

Placebo is "make the output file bigger than the source".
Dysthymia
Posts: 24
Joined: Fri Nov 04, 2016 12:21 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by Dysthymia »

Woodstock wrote: Tue Aug 01, 2017 5:24 pm You cannot add quality to a source, just avoid removing much.

Placebo is "make the output file bigger than the source".
I apologize, I was referring to the Encoder Preset slider under Optimise Video, rather than the Constant Quality slider. I know that setting an RF number of 0 makes no sense. :D

No, the settings from Ultrafast to Placebo under Optimise Video govern what the RF number will get you, with Placebo taking far longer than most people are willing to wait but offering the best quality to file size ratio for any given RF number, right? I was just wondering if there are any variable values that could further enhance that ratio, even if they incur an unreasonable performance penalty.

What is your objection to Slower/Very Slow/Placebo, rollin_eng? I'm usually not patient enough for Placebo, but why would you recommend against it for someone who is?
Last edited by Dysthymia on Tue Aug 01, 2017 5:57 pm, edited 1 time in total.
rollin_eng
Veteran User
Posts: 4854
Joined: Wed May 04, 2011 11:06 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by rollin_eng »

Placebo is named that for a reason. It is essentially useless except to boast about it.
Dysthymia
Posts: 24
Joined: Fri Nov 04, 2016 12:21 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by Dysthymia »

rollin_eng wrote: Tue Aug 01, 2017 5:44 pm Placebo is named that for a reason. It is essentially useless except to boast about it.
I can't really argue with that. I probably couldn't pick a Placebo encoded video over Very Slow in a blind test, but I'm still interested in maximizing that quality to file size ratio.
rollin_eng
Veteran User
Posts: 4854
Joined: Wed May 04, 2011 11:06 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by rollin_eng »

You can probably always squeeze 0.0000001% better quality/size at the expense of days/weeks/years of encode time but it's just not worth it.

The presets are created by people who know what they are doing so unless you have a specific need just stick with them.
mduell
Veteran User
Posts: 8198
Joined: Sat Apr 21, 2007 8:54 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by mduell »

There seems to be some confusion here about the fundamentals. The primary control for quality is your ratecontrol setting, whether it be a bitrate or an RF value. The x264 preset/tunes/encoder options are primarily a control for quality per bit, not total quality.
Dysthymia
Posts: 24
Joined: Fri Nov 04, 2016 12:21 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by Dysthymia »

mduell wrote: Tue Aug 01, 2017 6:37 pm There seems to be some confusion here about the fundamentals. The primary control for quality is your ratecontrol setting, whether it be a bitrate or an RF value. The x264 preset/tunes/encoder options are primarily a control for quality per bit, not total quality.
I accept that the Constant Quality/RF slider or the Avg Bitrate field are considered the most important for the quality of the encoded result. But is it not also true that different Encoder Preset values could effect things significantly? For example, an RF value of 20 with an Encoder Preset of Veryfast or Superfast could (depending on the source) look worse than using an RF value of 22 with an Encoder Preset of VerySlow. :?:

There are so many settings to tweak on the Encoder Preset/Extra Options side of things, but next to nothing to fiddle with as far as RF and bitrate. Maybe rollin_eng is right to think I'm wasting my time, but I am just looking to get the most I can out of an encode (aside from it getting done quickly :lol: ).
rollin_eng
Veteran User
Posts: 4854
Joined: Wed May 04, 2011 11:06 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by rollin_eng »

Dysthymia wrote: Tue Aug 01, 2017 7:12 pm There are so many settings to tweak on the Encoder Preset/Extra Options side of things, but next to nothing to fiddle with as far as RF and bitrate. Maybe rollin_eng is right to think I'm wasting my time, but I am just looking to get the most I can out of an encode (aside from it getting done quickly :lol: ).
And these extra settings are being hidden and not in the presets because...
Dysthymia
Posts: 24
Joined: Fri Nov 04, 2016 12:21 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by Dysthymia »

rollin_eng wrote: Tue Aug 01, 2017 7:21 pm And these extra settings are being hidden and not in the presets because...
I see how that can complement your stance on this topic, but I like to think it's because hiding them makes for the most user friendly interface. We don't want users to feel confused and overwhelmed.

Many of the individual variables are set by the presets, you just have to park the mouse over the Extra Options field to see what they are. The Medium preset seems to leave everything at its default (those values aren't shown), while Slow is:

Code: Select all

ref=5:b-adapt=2:direct=auto:me=umh:subme=8:rc-lookahead=50
rollin_eng
Veteran User
Posts: 4854
Joined: Wed May 04, 2011 11:06 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by rollin_eng »

:)

Yes part of the reason for not exposing the options is to stop people doing silly things.

But there really isn't any 'secret' settings to get better quality.
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by BradleyS »

At best you will shave a fraction of a percent off the file size for no quality gain.
nhyone
Bright Spark User
Posts: 252
Joined: Fri Jul 24, 2015 4:13 am

Re: Quality beyond Very Slow or Placebo in H.264?

Post by nhyone »

You have to be aware that the presets is not a linear scale. There are three variables: time, size and quality.

Presets affect mainly time and size, not quality. (This is not strictly true, but is mostly true.)

Bitrate and CRF have a much bigger impact on quality.

Edit: note that this applies to x264 only. Presets in x265 do affect quality.
metaldave
Posts: 36
Joined: Mon Apr 10, 2017 6:40 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by metaldave »

Thanks everyone who contributed to this thread. It's been informative. A couple of questions:
  • Does the Encoder Options - Preset slider override the encoder Quality settings? Specifically, will the Encoder Preset slider override the Constant Quality RF value slider?
  • What is the de-facto (default) Encoder Preset speed? Medium or Fast? I had thought it was "fast," but it was indicated that "medium" seemed to have the least optimizations.
I also think this discussion is interesting when reviewing the Official Presets Pane. The preset for "Super HQ 1080p30 Surround" uses the "veryslow" Encoder Preset and CQ RF of 18. Isn't this overkill for no discernible improvement (aside from bragging rights as someone offered above)? The "HQ 1080p30 Surround" set uses CQ RF 20 with a "slow" Encoder Preset value. Finally, the "Fast 1080p30" setting brings us back to CQ RF 22 with the "fast" Encoder Preset.

I realize the "right" settings are in the eye of the beholder, but I accept the concept the "defaults" are probably best (greater minds put the work in, etc.).
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by BradleyS »

Encoder preset does not alter the crf value. The default encoder preset for x264/5 is medium, but official HandBrake presets vary this based on the intention of the preset, the trade off typically being typically encoding speed versus quality. Higher quality presets use slower encoder presets both to improve analysis and ideally avoid bloating the file size more than necessary to accommodate the increased overall quality.

Take a look at the documentation article on the subject: https://handbrake.fr/docs/en/1.0.0/work ... ality.html

You may be interested in the footnote on display size and viewing distance. People with large displays and short viewing distances may perceive more artifacts than others, and want to bump the quality up a notch. Low source resolution and animation are two other examples where higher quality is a benefit, reducing artifact amplification when displayed at a large physical size and reducing artifacts around clean edges, respectively. Generally speaking, there is little benefit using ultra high quality settings in most other normal situations.
nhyone
Bright Spark User
Posts: 252
Joined: Fri Jul 24, 2015 4:13 am

Re: Quality beyond Very Slow or Placebo in H.264?

Post by nhyone »

metaldave wrote: Tue Aug 15, 2017 6:30 am I also think this discussion is interesting when reviewing the Official Presets Pane. The preset for "Super HQ 1080p30 Surround" uses the "veryslow" Encoder Preset and CQ RF of 18. Isn't this overkill for no discernible improvement (aside from bragging rights as someone offered above)? The "HQ 1080p30 Surround" set uses CQ RF 20 with a "slow" Encoder Preset value. Finally, the "Fast 1080p30" setting brings us back to CQ RF 22 with the "fast" Encoder Preset.
I don't see any contradiction.

Super HQ uses CRF 18, HQ 20 and Fast 22. This is the key parameter that determines the output quality.

The encoding presets trade off mainly output size vs encoding time, although the slower presets are tuned to prefer quality over speed/size.

Also, CRF 18 veryslow is a good start for transparent encoding. I won't call it an overkill. Any lower (CRF 16 and/or placebo), then yes.
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: Quality beyond Very Slow or Placebo in H.264?

Post by BradleyS »

@nhyone You're basically correct but some of your statements are slightly misleading. Also, I wouldn't suggest most people start at crf 18 for 1080p; most will find 21-23 just fine, which is why the default preset uses 22. That said, 18 is pretty transparent in most viewing scenarios for 1080p.

It's true each HandBrake preset adjusts more than one variable. This is intentional. Raising the crf value (lowering quality) contributes to speed since more bits are discarded. Likewise, a faster encoder preset is... well, faster. So by doing both, we can provide a reasonable increase in speed and label that "Very Fast", for instance. That said, the default HandBrake preset Fast is a great balance of speed and quality, most of the time, for most people.

Similarly, the high quality presets both lower the RF (raising quality) and use a slower encoder preset to achieve better compression. Slower encode preset can also very slightly affect quality in some situations, mostly motion analysis related—but this is not typically significant compared to adjusting crf. Anyway, the idea being anyone interested in higher quality is willing to wait a bit for it, and pack in the best quality per pixel possible for the given encoding time.

So what you have are four major presets in HandBrake: Very Fast, Fast, HQ, and Super HQ. If you care about speed, use the default Fast or encode in even less time with Very Fast for a small penalty to quality. If you want higher quality than the default, use HQ or go all out with Super HQ if you can wait.

Of course, the documentation makes it very clear that you can tweak the quality (RF) for any of these, should you desire. It's not uncommon for people to want to stick with the Fast preset but bump up the quality a notch, which is fine. This will be slightly faster than the HQ preset, but possibly yield a slightly larger file due to the faster encoder preset.

In the end, it's pretty much a one click deal for most. Four general presets that cover 90% of what people want (16 taking into account the resolution differences), with the ability to adjust one control (the quality slider) for intermediate values if desired. I think that's pretty great, but of course I'm biased since I made the presets. That said, most of the hard work was done by x264; their encoder preset system is both sane and fairly well tuned.
Post Reply