23

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"
  • 1
    I don't know any thing about this command, but it's very well documented here: ffmpeg.org/ffmpeg.html. – Ben Plont Nov 18 '13 at 18:04
  • 1
    Are you using libx264 (for H.264 video) or libvpx (for VP8 video)? Please show your ffmpeg command and the complete console output. – llogan Nov 18 '13 at 18:11
  • 1
    So, the question is if you want to keep this question rather general to CRF, or if you have a specific issue you need help with. In the latter case we'd need to get the full commandline output (i.e. everything from "ffmpeg version…" to the last bit) and the actual command you're using, but it'd unfortunately render the existing answers useless. You might want to ask a new question if you're facing a concrete issue. – slhck Nov 18 '13 at 19:59
  • @slhck Hi, you are absolutely right. I do need to learn to be more specific and comprehensive in future. As it was your answer fitted my needs more than everyone else's but everyone else's were also informative. I will tread more carefully in the future :) Thank you for your time. Much appreciated. – Andrew Simpson Nov 19 '13 at 7:43
23

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, lower is better. In my experience, I see x264 much more often.

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

| improve this answer | |
  • Range for VPX is from 0-63 not 4-63, recommended rate is 15-30 – Suhayb Oct 13 '19 at 22:00
3

The crf flag ensures a variable bitrate for constant quality, if I understand the page linked below correctly. The default range is from 4 to 63, but it can be tweaked further.

Have a look at https://trac.ffmpeg.org/wiki/Encode/VP9 for more information.

| improve this answer | |
  • I'm a little confused by this, we both link to the same site and each page says something slightly different (ranges, that is). In any case, both look legitimate to me, so I'm a little boggled by this. – nerdwaller Nov 18 '13 at 18:02
  • hi, thanks for that. I am looking to improve the quality of the video stream so a low crf will do it? – Andrew Simpson Nov 18 '13 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.