-crf used for in ffmpeg


When converting an array of jpegs to a video file (ogg format) I have been using the -crf option. What are the valid ranges for -crf? Currently I am using 23.

I cannot find the bookmark I read to know what this flag does and I have spent some time Googling around.

These are the arguments I am using at the moment:

-f image2 -r 10 -i " + _sourcePath + @"\img%05d.jpg -crf 18  -y -r 10 " + _destPath + "\\" + _filename + ".ogg"

Best Answer

That refers to the Constant Rate Factor (crf).

As others have pointed out (Thanks all), the values will depend on which encoder you're using.

For x264 your valid range is 0-51:

The range of the quantizer scale is 0-51: where 0 is lossless, 23 is default, and 51 is worst possible. A lower value is a higher quality and a subjectively sane range is 18-28. Consider 18 to be visually lossless or nearly so: it should look the same or nearly the same as the input but it isn't technically lossless.

For vpx the range is 4-63 (as @sebastian-hoffner answered):

By default the CRF value can be from 4–63, and 10 is a good starting point. Lower values mean better quality.

In both cases, a lower value means higher quality. In my experience, I see x264 much more often.

Slhck's shameless plug (an SU mod) link looks like it has some good info.