Comparing x264 “RF” settings in Handbrake (examples)

Here, I’m taking a look at various RF settings in Handbrake, both in terms of visuals and filesize.


I started with encodes from the “24” DVD (Season 6, Episode 1). If you have the same DVD and are looking to reproduce this test, the following settings were used:

  • x264 Preset: very slow
  • x264 Tune: none
  • x264 Profile: high
  • x264 Level: 4.1
  • Strict Anamorphic
  • Defaults for everything else (Handbrake 0.9.9 on OSX)

I tested the following RF values (listed in Handbrake under “Constant Quality”:
0, 10, 18, 20, 22, 24, 26, 28, 30, 32



I’ll start with a few screenshots at different RF values. There’s a video below too, but it comes with a bit of a caveat so might not show everything well for you. Pictures should work for nearly everyone. Note that the first one (RF0) is for reference (lossless).

x264 Handbrake encode at RF 0
x264 Handbrake encode at RF 10
x264 Handbrake encode at RF 18
x264 Handbrake encode at RF 20
x264 Handbrake encode at RF 22
x264 Handbrake encode at RF 24
x264 Handbrake encode at RF 26
x264 Handbrake encode at RF 28
x264 Handbrake encode at RF 30
x264 Handbrake encode at RF 32

(click for larger images)


Worth noting that x264’s psychovisual enhancements (trellis, etc) do a pretty good job of keeping detail where you’d notice it (the face), at the expense of the stuff you normally wouldn’t notice while watching (like those background areas). Of course, this only goes so far – once the RF value is high enough, there’s no saving Jack’s facial features from the effects of compression!

For those interested, I’ve also got another page on this site that lets you compare x264 vs x265 vs VP8 vs VP9 (at various RF and bitrate settings).

A static image isn’t always great, so here’s the 35-second video showcasing the difference between these RF settings in “24”. Note that you must click the appropriate buttons to watch this at full-screen 1080p if you want to see the differences somewhat clearly:

Note that YouTube re-compresses videos – I kept it at full-quality as long as I could, but I suspect YouTube won’t be fine with serving up a 360MB video that only lasts 35 seconds, so we’re at the mercy of their encoder.



Now that you hopefully have an idea as to how each of the videos look, let’s see what each weighed in at for the full 43m8s episode. Note that these sizes ONLY apply to this episode of this source :


RF:0 – 6127.2MB (yes, 6.1GB)
RF:10 – 1925.2MB (yes, 1.9GB)
RF:18 – 355.6MB
RF:20 – 254.6MB
RF:22 – 197.3MB
RF:24 – 160.4MB
RF:26 – 136.1MB
RF:28 – 119.6MB
RF:30 – 107.5MB
RF:32 – 98.3MB





A few things you probably observed when comparing to RF:0 (the lossless version):

  • RF10 looks almost identical to RF0 in the images, but still results in a massive file size – quite possibly similar to the size of your source. At that point, you’re probably better off keeping your original source rather than trying to recode it.
  • RF18-20 are incredibly close in the images, and it’s pretty hard to tell the difference when it comes to watching the video. The reductions in file size here tend to be substantial though, almost 100MB smaller (28% savings) by going from RF18 to RF20.
  • RF22-24 is about the point where visual differences are starting to become noticeable, but typically not to the point where they’d stand out when you’re actually watching. You save under 40MB (19%) by dropping from RF22 to RF24 here.
  • RF26-32 is where noticeable degradation comes about. It’s a matter of how much you can tolerate at this point. You really start to lose a lot of quality for each bit of filesize you try saving. Dropping the RF value by 2 saves under 20MB (9-12%), and the video is noticeably worse.

All that said, be sure to draw your own conclusions. And if you’re new to encoding with Handbrake, hopefully this has helped you to get a better understanding of the Constant Quality setting and the effects of various RF values.


 | Leave a Comment Sort by Oldest | Sort by Newest
  1. Thank You for this very helpful experiment

    • Nice. Thank you for taking the time and making effort – both investments must’ve been substantial – to conduct this experiment and publish the results. When comparing the file sizes resulting from changing RF values, it’d b interesting to also see what the original file size is.

  2. This is exactly what i was looking for, thanks!
    Will changing the value of H.264 Profile and H.264 Level have any noticeable difference in the video quality?

    • Jeremy:

      It usually* shouldn’t affect the quality you see (assuming you’re using RF values). File sizes may change though, particularly if you’re mixing it with slower settings – lower profiles/levels will often result in bigger files, whereas higher profiles/levels will often result in smaller files.

      *NOTE: There are exceptions. For example, quality might plummet if you choose a level that’s too low for your source at the RF value you’ve chosen. An easy way to see an extreme example of this is to encode a 30 second DVD clip at RF18 (which would normally look good), but use something like main profile level 1.0. You’ll see massive blocking, because the bitrate is constricted by the level/profile. Even though you chose RF18, the low level didn’t allow it to use enough of a bitrate.

      This sort of thing usually isn’t an issue if you’re dabbling with DVD encodes at reasonable RF values, and trying to choose between say… Level 3.x and Level 4.x. It’s a larger issue if you try to start encoding BluRays at low RF values (high quality) and trying to use a profile of less than 4.x. Regardless, going with the highest profile your device(s) support is usually the safe way to go.

      I know that’s probably not the definitive yes/no answer you might have been looking for, but I hope that helps.

    • If you just leave the profile and level to auto, x264 will pick a level that doesn’t interfere with the quality you picked.

  3. Excellent article, saved me hours of testing!

  4. What framerate setting do you use for higher quality video?

    • Woody: Assuming you mean for Handbrake encodes, always “same as source”. Exception is if I have a source that’s too high for most web/devices (1080/60p for example), in which case I’ll try to bring it to something cleanly divisible if making the change via HB – in such a case I’d probably use 30fps. I generally avoid changing the original frame rate whenever possible though.

  5. I think the actual RF numbers depend on the input video dimensions – 4K and VGA are going to require wildly different numbers to 1080p

    Is “RF” the same as “–quality” (or -q) in HandbrakeCLI, do you know?

  6. Anonymous

    How about x264 presets? Would they of affected the quality of your results? Say instead of using very slow you used very fast. Would there of been a difference?

    • Anonymous:

      It’s hard to give a definitive answer here. I’ve got another writeup at which shows some of the inconsistent behaviour across the x264 presets. On top of that, I believe there might be (don’t remember for sure…) a difference in which psychovisual enhancements are enabled as you move to slower settings. Also, as you move to lower x264 profiles/levels, it’s possible to end up bitrate constrained at lower RF values which can throw a wrench into things if you move to faster presets that tend to use higher bitrates.

      All that being said, each source behaves a little differently (as you’ll see in the other writeup), so while it might be possible to test each speed on a source and determine that “X” speed gives the best quality at an “X” RF value for “X” source (assuming your eyes are keen enough to spot the small differences – mine certainly aren’t), that determination wouldn’t always hold true for other sources.

  7. Thank you Very much
    Extremely Helpful

  8. Definitely best for everybody to save some time and read the manual. It clarifies some not-so-obvious things, like why RF0, RF10, and RF18 are not going to look any different:

  9. Hey ! I have some bluray movies, i just wanted to remove the black bars and want to keep quality intact.. what settings would be best?
    If I choose RF – 0, it gives me the file which is bigger than my bluray .. lol
    Can somebody suggest please?
    I just want the black bars gone. thats all

    • A bluray you can start with RF=22. To get rid of the black bars, just use the default “autocrop” option. In fact, this is a good idea, because not removing the black bars can create artifacts in high motion scenes at the edge of the picture, and also you don’t want those black bars taking up disk space when in fact, they’re just blank black bars. So always crop them off!

      • You should mention that those “black bars” are in the actual picture frame used in the camera. I understand that removing the bars reduces filesize, but those bars are not “just blank black bars”. They actually contribute to the correct contrast and brightness of the entire picture frame. It just comes down to what quality you are comfortable with for one specific picture (e.g. Action movies are quite different from documentaries so quality settings are not fixed values for all types of film material). I normally use the following settings for (Action movies) Blurays: Anamorphic: Strict, Cropping 0:0:0:0, All filters off, Video RF: 18, x264 preset: Very slow, x264 tune: none, H.264 profile: high, H.264 level: 4.1.

        • I’m not sure what specific cases/circumstances you might be referring to, but it’s worth noting that in the vast majority of videos, the black bars actually aren’t part of the original frame. The only reason they even still exist on standard media is because to adhere to something like the DVD-Video spec or Blu-ray spec, you have to either crop or letterbox/pillarbox videos in certain aspect ratios to match one of the spec’s supported aspect ratios.

          Removing them is often a good idea – ignoring the minor size and technical benefits for the moment (you can often squeeze an extra reference frame in, for example), it removes the potential for extra pillar-boxing, letter-boxing, or postage stamping when played across various screen aspect ratios and devices.

          • As “Anonymous” wrote on January 15, 2015, I found out that his suggested settings are the best indead for regular blurays but i notist that when you use these setting for poor source blurays (yes thats possible) you even should go for Video RF: settings lower than 18, for example 16 because the black portitions in the source are very sencitive and can result in faded blacks in the outputfile. Or do you have a specil trick to let Handbrake take more ettention to the black/dark parts specific? On a HD-tv it realy shows when the blacks/dark parts are poor quality, so i like perfect blacks and do not have to worry about big outputfile because the bigger HDD drive nowadays.

            Sorry for my poor english.

          • The following can help reduce blotchy black areas:

            Just stick that in the “Additional Options” box. Only one of those is actually needed, but for the life of me, I can never remember which.

            If that isn’t enough to take care of it, then throwing an immense amount of bitrate at the encode by changing the RF value (as you mentioned) is the only way I know of to do it.

            Good luck!

    • Hello Sandeep.

      If all you want is to remove the black bars with no size increments in the resulting file, you can try doing some video crop using MKVToolNix.
      Simply go to the “Edit Headers” section, and you can set how much “crop” do you want to apply to the file.
      That will crop the black bars in the video file without touching the file size.

      Make sure you do a copy of the file before trying this option.

      Hope this help.

  10. Hi,

    Did you happen to take note of times (even rough will do) it took to run at different RF settings ?

  11. Thanks for this, you saved me a ton of time! I’m happy I found this, I even bookmarked it. Good work 😀

  12. Hey, I’m just curious if audio was a factor in any of this? Or does this compression only compress the video?

  13. Anonymous

    Thanks so much! I learned something new today.

  14. Great post man!Really saved all my efforts!

  15. This would have been more helpful if you gave the specs on the original file before encoding (i.e. file size, length of video file, maybe a screenshot for visual quality, like a before and after deal). I don’t know which setting I should use for my source because I can’t compare your results to your beginning product, if that makes any sense.

    • Hey Peyton,

      The RF:0 result effectively doubles as a “before” screenshot (lossless), and you can consider all the others to be “after” screenshots.

      Video duration/length was mentioned in the write-up (43m8s). As to the original file size, the episode was slightly under 2GB. That said, don’t focus too much on those particulars: as I mentioned in the write-up, the results are only applicable for this source. The trends you see above tend to apply across sources. Specifics on the other hand are an entirely different story… loosely correlated at best.

  16. very good keep it up

  17. Good stuff and exactly what I was looking for….Thanks!

  18. Thanks Matt, as a newcomer to this stuff, that was very helpful.
    kind regards

  19. Good job man!

  20. Devvrat Shukla

    thank for this experiment bro 😉

  21. Noticeable difference in contrast between RF18 and RF20 when zoomed in.

  22. Thank you so much for this. I installed linux on my encoding machine. Turns out my gig per 30 minutes was a bit over the top.
    Taking your images to compare them via photoshop was very interesting as well.
    Like: Make to layers RF18 and RF 20 and keep on as normal and divide that through the other. It shows pretty well how much bits have changed where.

    Looks like this.
    Quite enlightening.

  23. I wish I had found you 6mo ago when I started ripping my collection. But, now I have a better understanding what to choose and why… You have a great way of explaining it all. Many thanks to you, sir!

  24. Goldeneye0007

    Thank you for the data. I appreciate it.

  25. Thanks! Very detailed and useful!

  26. Thanks for this.
    I think the idea is to shrink the original file and still have the best possible quality. At what point does the average person start to notice? I think a value of RF of 18 should be standard for everything and of course level 4.1 H.264 high and constant frame rate – Why would one want to choose variable frame rate, isn’t the source frame rate constant anyways?(at least for tv shows or movies)

    • OTA broadcast and DVD’s are both pain points for constant frame rate:

      When it comes to DVD, you’ll run into a lot of stuff that was shot in 24 fps and telecined to 30fps (NTSC regions). This is trickier to handle with a CFR (constant frame rate)… if the deteleciner works perfectly you could set a constant of 24fps. But often the deteleciner won’t catch everything so you’ll have some parts that remain at 30 fps… by setting a CFR of 24fps you’ll end up with some dropped frames. Of course if you set the CFR to 30fps, you’ll end up with duplicated frames instead (and perhaps a larger file).

      To a lesser extent, variable can also save you from shooting yourself in the foot by setting the wrong frame rate. Not just dealing with telecined content, but interlaced too. If your input video is 1080i60, it’s 60 fields (consisting of half frames) per second. So do you use 30fps or 60fps after it’s deinterlaced? If using the “bob” deinterlacer probably 60fps. But if using blending/interpolation (default filter) then… maybe 30 or maybe 60? Was the original shot in 30fps and interlaced to 60fps for ATSC distribution? Or was it actually shot at 60fps and half the lines in each field simply dropped?

      There are a number of other possibilities too, but VFR is nice because it’ll catch everything and generally make a sensible decision, especially if you don’t know the details behind how your original source video was constructed.

      Not that you can’t use CFR if you prefer. But unless you know your original video is very straightforward (shot + distributed in the same frame rate, no telecining, no interlacing, no injected content at different frame rates, is itself CFR through-and-through), CFR carries a few risks along the way. Since VFR used on a constant source should just hold a constant frame rate anyway (with a VFR flag), there aren’t huge downsides to using it in most cases. Big exception would be if you need the output to be constant (using HB as a format converter and video editing afterwards, creating Video DVD, site/service/program that requires constant, etc) – then absolutely you have no choice but to use constant.

  27. If lower RF means higher quality then why RF 22-28 is recommended for 2160p 4K Ultra High Definition

  28. Do you have any suggestions (or previous articles) on audio settings for Handbrake? In my research, assuming you don’t want to choose the “passthru” option which preserves the audio from the source (resulting in a larger file size), I’ve found that AAC is preferred over AC3, but where I’m stuck is on the audio bitrate. I’ve run across sources that say that for 5.1, you’d want at least 512 kbps (out of a possible 1536) . That’s roughly 85 per channel. For stereo, 128 is sufficient. Would you concur? And would you ever recommend taking a DTS source and choosing an AAC passthru option (to try maintain source quality but not wanting the size that comes with DTS). Thanks for any help you can provide. Going crazy trying to figure this out.

Leave a Comment

You can use an alias and fake email. However, if you choose to use a real email, "gravatars" are supported. You can check the privacy policy for more details.

To reduce spam, I manually approve all comments, so don't panic if it looks like the page simply refreshed and your comment doesn't show up immediately.