Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
Registered User
Join Date: Sep 2010
Posts: 46
|
[FFmpeg] qmin, qmax, subq and bitrate ?
Hi all !
I've run some tests and am trying to strike a balance between qmin, qmax, subq and bitrate parameters in FFmpeg. At first, I designed my custom command lines based on the preset files (I had at first to make sure the presets were indeed optimal for what we were doing specifically, so I had to juggle a little with the many parameters). What I see is that presets usually (for higher quality sets) have very high qmin and qmax (10 and 51 respectively). I had the habit of using values of 1 and 31 respectively. Then, the subq is also rather high (8 or 9 when I usually use 6). However, I usually use a pretty high bitrate to compensate for the quality loss I'd have somewhere else. My question is : is there some trick to help determine what is better, between : a low qmin, a high subq, or a high bitrate ? Are they, in essence, all the same thing and I'm losing my time trying to exchange one for the other ? (Other than subq 7-8 which, I understand, unlock some BFrames-related features ; I don't take that into consideration very much at the moment)... And why did the people who designed the preset, choose this particular setting ? It seemed ok to use qmin 10 and qmax 51, but some self-proclaimed pros told me we were better off with qmin 1, no qmax specified and a lower bitrate. I'd like to have your advice on this. Thank you very much !!! Regards. |
![]() |
![]() |
![]() |
#2 | Link |
Registered User
Join Date: Dec 2002
Posts: 5,565
|
No, they are not the "same thing".
1.) lower bitrate = lower quality for the same settings, so I don't really get that part of your question. Of course more bitrate means better quality. This is true for all lossy compressions. 2.) q(p)min=10 was x264's default setting until recently. Now it is q(p)min=0. The x264 devs use this setting for all presets, so just set it to 0 and let x264 do its job. 3.) The maximum possible value for q(p)max is 51, which is again used in all presets. Stick to it. * qmin and qmax only restrict x264 in it's decision making, so do not change them if you don't know whether you can make better decisions than x264 itself or not. 4.) subq = 7 is x264's standard setting. 8 is slow, 9 even slower and 10 very slow. They are all fine, use the one that's fast enough for you. ( * very recently x264 added a "vbv emergency mode" which is triggered by setting qpmax to a value higher than 51, but your ffmpeg build probably does not support it yet, as it is too new. If you do not use vbv it does not concern you anyways.) |
![]() |
![]() |
![]() |
#3 | Link | |
Registered User
Join Date: Sep 2010
Posts: 46
|
Thanks sneaker_ger !
Quote:
qmax I don't specify in any case. As for subq, I used to stick with a value of 6 most of the time (that seems to be the standard everywhere I look), and that was part of my question : would I be better off using a higher subq and a slightly lower bitrate, or the opposite ? Are the results going to be comparable ? If not, what would change significantly ? As far as I can tell, both the bitrate and subq are designed to influence the general quality, albeit on a different scale. But they must do each a different job, otherwise there wouldn't be two quality switches instead of one, would there ? Thanks a lot. Regards. |
|
![]() |
![]() |
![]() |
#4 | Link | ||
Registered User
Join Date: Dec 2002
Posts: 5,565
|
Quote:
Quote:
subq sets the "subpixel estimation complexity". Higher values = higher quality for the same bitrate So yes, it is possible to reach the same quality with lower subq + higher bitrate as higher subq + lower bitrate. Normally you'd set subq to a value that is still fast enough for you (higher subq = lower speed) and then decide on the bitrate you need. If you are not aiming for a specific file size but rather constant quality of your encodes, use "-crf" (constant quality) instead of "-b" (bitrate) to save some time. |
||
![]() |
![]() |
![]() |
#5 | Link | |
Registered User
Join Date: Sep 2010
Posts: 46
|
Quote:
So -crf is made to replace -b, and not only complement it ? That's what I had figured, but I couldn't make sure... If I use -crf, is it a good idea (or even necessary) to use -minrate/-maxrate in order to achieve fairly constant quality ? And what value of -crf would you personnally recommend for 1920x1080 videos ? Thanks so much ! ![]() |
|
![]() |
![]() |
![]() |
#6 | Link |
Registered User
Join Date: Sep 2010
Posts: 46
|
I ran some tests, replacing -b by -crf, and the result was a video encoded in 2,000 kbps (which is far not enough for my needs, I'd be more comfortable with, say, 20,000 kbps !) so I assume after all -crf is a complement to -b and not a replacement. However I await confirmation from someone in the know ! ;-)
Thanks as always ! |
![]() |
![]() |
![]() |
#7 | Link | ||
Registered User
Join Date: Dec 2002
Posts: 5,565
|
Quote:
Quote:
1.) x264 does not know any "-minrate" option 2.) You can use -maxrate in conjunction with -bufsize to limit the maximum bitrate locally. You don't need to set these options for playback on a PC, but they may be useful if you are aiming for a standalone device such as a Blu-Ray player or a phone etc. crf=18 is a good starting point and probably what most people use. Higher crf = lower quality. You get roughly about double/half the bitrate for the substraction/addition of 6. |
||
![]() |
![]() |
![]() |
#9 | Link | |
typo lover
Join Date: May 2009
Posts: 595
|
Quote:
http://git.ffmpeg.org/?p=ffmpeg.git;...8068f0e3bb9c2f
__________________
my repositories |
|
![]() |
![]() |
![]() |
Tags |
bitrate, ffmpeg, qmax, qmin, subq |
Thread Tools | Search this Thread |
Display Modes | |
|
|