CPU Preset and CRF settings

Tawm

Member
Hello,

I'm hoping that a developer or someone with more experience than I could help me to understand how the settings in OBS Studio work with the x264 encoder.

The main CPU Presets I'm concerned with are: Faster, Veryfast, Superfast, and Ultrafast (I think those are the top 4) and I only worry about these because they're the only ones my i7-5820k will handle without maxing out (99%+ CPU usage).

My understanding is that using the top setting, Ultrafast, uses the least CPU power and thus results in worse quality at the same settings otherwise. Superfast, Veryfast, and Faster use more CPU power than the previous. The lower the "speed", the higher the quality, all other options unchanged.
I also have read something to the effect of "faster uses almost double the processing power of veryfast" and similar for all other jumps.

Also, though I'm not sure which Rate Control option I should be using, I'm currently using CRF. (Also, what profile to use?)

So the question is:
What CRF ratings would one have to use to have a Superfast preset look as good as a Veryfast preset?
Essentially, at what point should I jump to the next Preset instead of lowering my CRF further?

An example comparison:
Superfast - 15 CRF
Veryfast - 17 CRF

If I appear to misunderstand anything about these settings, please let me know.
Thank you.
 

Harold

Active Member
If you're using crf based bitrate selection, the quality will remain the same consistently regardless of which preset you're using. Ultrafast and veryfast will look the same, except that veryfast will have a smaller filesize.

CRF based rate control is a quality target, not a bitrate target.
 

Tawm

Member
If you're using crf based bitrate selection, the quality will remain the same consistently regardless of which preset you're using. Ultrafast and veryfast will look the same, except that veryfast will have a smaller filesize.

CRF based rate control is a quality target, not a bitrate target.

That is very helpful! So I would be able to use Ultrafast, barely effect my CPU, and still have high quality with the only downfall of large file sizes.

Would you be able to tell me how the other Rate Control options would effect quality based on CPU Presets?
 

Harold

Active Member
The CBR bitrate control forces a bitrate on your video, ultrafast will look worse than veryfast assuming you're using a bitrate that's not high enough to maintain picture quality in ultrafast.

I haven't played around with the other rate control options, I record using crf 15 ultrafast.
 

Boildown

Active Member
There's some value in moving to SuperFast, but beyond that if you're recording with a CRF below 18 or so, there's no value in dropping to an even slower preset, unless you're about to run out of hard drive space or something.

The idea with recording with a CRF where you don't care too much about hard drive space is to use a CRF a little less than you need. Exactly which CRF at SuperFast equals another CRF at VeryFast isn't defined and would vary based on a whole lot of criteria, not the least of which is the video itself. As such, it can't be accurately predicted. Suffice to say, in the context of OBS, it isn't important or desirable to try to min max for this anyways. The Handbrake forums probably have some info, but they don't have to do realtime encoding so it doesn't apply to OBS very much.
 
Last edited:

Tawm

Member
ultrafast will look worse than veryfast assuming you're using a bitrate that's not high enough to maintain picture quality in ultrafast.

Could you expound upon this statement a bit? I thought CRF would keep constant quality. Are you referring to max write speed (bitrate) of the recording drive?
 

Tawm

Member
use a CRF a little less than you need

Do you mean use other Rate Control options more often, so use CRF less often? Or do you mean use a lower CRF setting than I need, so use 18 instead of 17?
If it's the latter, I don't know what rate I would "need", so I wouldn't be able to choose a setting "a little less than need"
 

Black Ops

Member
Simply put, CRF targets a certain quality level and will using whatever bitrate necessary to reach that quality. The quality of the video is known but the file size isn't

If you are not using CRF, and instead using a certain bitrate, then the file size is known but the quality is not. In this case, Slower Presets will help pack more quality into a specific file size (File size is determined by the Bitrate and length of the video)

What settings you use is dependent on what you plan to do with your video:

If you are doing local recordings which are going to be posted to YouTube, you should record with a low CRF value and compress it later after editing to minimise quality loss

If you are live streaming for example on twitch, you will be stuck at using the max bitrate (3500) so you should use the slowest preset you can to maximise the quality whilst having a stutter free video
 

Tawm

Member
If you are doing local recordings which are going to be posted to YouTube, you should record with a low CRF value and compress it later after editing to minimise quality loss

If you are live streaming for example on twitch, you will be stuck at using the max bitrate (3500) so you should use the slowest preset you can to maximise the quality whilst having a stutter free video

I mostly do local recordings. But even if I use a CRF of 15, there's still the question of what CPU Preset I use. Is the CPU Preset simply dealing with on-the-fly compression (slower meaning more compression) while recording, not quality?
 

Boildown

Active Member
Do you mean use other Rate Control options more often, so use CRF less often? Or do you mean use a lower CRF setting than I need, so use 18 instead of 17?
If it's the latter, I don't know what rate I would "need", so I wouldn't be able to choose a setting "a little less than need"

By less I mean a lower value i.e. higher quality (or rate). You can only find out "what you need" experimentally, by recording at a certain CRF and viewing it, and asking yourself if its good enough. Different people will give drastically different answers to that question while watching the exact same video, so no one can tell you what's good enough, except you.
 

Boildown

Active Member
I mostly do local recordings. But even if I use a CRF of 15, there's still the question of what CPU Preset I use. Is the CPU Preset simply dealing with on-the-fly compression (slower meaning more compression) while recording, not quality?

For local recording, as I said before, assuming you aren't concerned about hard drive space (and you probably aren't), then the only two presets you should be considering are Super Fast or Ultra Fast. UltraFast turns off a few h.264 features that can almost but not quite be made up for by more bitrate, so if you are obsessive about quality, use SuperFast preset. If you're CPU constrained, use UltraFast preset. Once you've done that, increase or decrease quality by changing CRF values.

That's all there is to it.
 

Damian Höster

New Member
If you're using crf based bitrate selection, the quality will remain the same consistently regardless of which preset you're using. Ultrafast and veryfast will look the same, except that veryfast will have a smaller filesize.

CRF based rate control is a quality target, not a bitrate target.
This is not quite true.
The quality does not only depend on the quality setting.
I once encoded a video file with different encoder presets, leaving all other settings the same (using CRF).
The resulting file sizes were not growing bigger, the "faster" the encoding preset went.
Instead, the file sizes varied around a fixed value, with only Ultrafast (ca. 75% higher filesize) and Superfast (ca. 35% higher filesize) standing out.
Veryfast even had the smallest filesize (ca. 5% smaller than the "common" value).
So with turning down the encoder preset without changing the CRF setting, you will loose quality im most scenarios.
Hope I could help.
 

Boildown

Active Member
You bumped an old thread. But yeah, there's no guarantee that slower presets will decrease filesize (i.e. increase compression) when using variable bitrate modes, they might decide to increase quality per bit instead, or some combination of both that favors one over the other. Regardless, its pointless to go slower than Very Fast if you keep bitrate reasonably high for recording, and I'd argue that SuperFast makes the most sense for most people. Hard drive space is cheap and bitrate quickly overwhelms any other factor if you need quality.
 
Top