Log in

View Full Version : CRF mode of x264


xxxyyyzzzz
5th September 2013, 03:54
Recently I am learning the Rate control of x264. And I am confused about the CRF mode. From the source code of x264, I find the --crf has the same effect with QP. Then I set the --crf as 26, but the encoding result is terriable.
Can anyone tell me how to set the parameter --crf to get a reasonable encoding result?
Thanks!

karasu
5th September 2013, 08:28
a sane crf value would be between 18 and 22. Smaller value = better quality.

Groucho2004
5th September 2013, 08:36
It depends a bit on the material you're encoding. I usually use 16, never go above 22 but sometimes as low as 14. There are a lot of other encoder settings that determine the result as well.

CarlEdman
5th September 2013, 12:20
That's pretty sound advice. I use 16 for standard definition content and 18-20 for high definition content.

LoRd_MuldeR
5th September 2013, 13:03
Recently I am learning the Rate control of x264. And I am confused about the CRF mode. From the source code of x264, I find the --crf has the same effect with QP. Then I set the --crf as 26, but the encoding result is terriable.
Can anyone tell me how to set the parameter --crf to get a reasonable encoding result?
Thanks!

The CRF value lives on the same scale as QP values, but that's only for convenience. It's purley an interface decision, so it could live (for example) on a 0.0 to 1.0 scale just as well.

In any case, you'll have to find the (maximum possible) value that satisfies your eyes.

And also note that the CRF value depends on your other settings too! The same CRF value with, for example, a different "--preset" does not necessarily give same quality.

See also:
http://git.videolan.org/?p=x264.git;a=blob_plain;f=doc/ratecontrol.txt;hb=9e941d1fabb2de4b15f169057a07dc395307d2ce

Thalyn
7th September 2013, 06:19
Wasn't it a percentage at some point in time...?

You have to experiment. No two people are going to have identical preferences. For example, I would not go higher than 23 for FHD (1080p) content - this is the point just before I start to be able to see detail loss, such as skin textures. To wit, I do my "fast" encodes at 22 and my NAS is loaded with encodes at 20.

For SD media, I drop the CRF by 2 (22 becomes 20, 20 becomes 18). But not everything is going to require that, either - the Japanese series of G1 Transformers, for example, I happily record at 24 because they're terribly mastered and just don't have that much detail to retain (I could probably go higher, but I'm happy with their size at 24).

A little note, though: the higher your CRF (lower quality), the more important it becomes to use better settings elsewhere. At CRF20 the difference between SubME 10 and SubME 7 is practically invisible to the eye and less than 1% for filesize, but once you get to CRF22 or above you'll start to notice it.