View Full Version : Ratetol, Qcomp, and Stats Files w/ 3 passes


Oline 61
13th February 2006, 02:59
Okay, I have 2 main questions to ask.

The first is about the effects of --ratetol and --qcomp. I want to use these two settings to generate output with no restriction on bitrate fluctuation in the stream, but clamp the average bitrate very tightly to the --bitrate setting.
I have been using --ratetol 1.0 --qcomp 1.0. I assume that --ratetol only affects the average bitrate, and --qcomp only affects bitrate fluctuation. Is that correct? If not, what are the effects of these functions, and how might I use them to achieve my goal. I am using 3 pass encoding, with the follow 3 commandlines:
/opt/my_mplayer/bin/x264 --pass 1 --bitrate 2454 --stats "/home/andrew/workdir/x264stats.log" --bframes 2 --b-pyramid --filter -3:-3 --subme 1 --analyse none --ratetol 1.0 --qcomp 1.0 --me dia --zones 156250,163225,q=40 --cqmfile "/home/andrew/workdir/eqm_avc_hr.cfg" --progress --no-psnr --output "/home/andrew/workdir/pass1.264" "/home/andrew/workdir/stream.yuv" 640x480
/opt/my_mplayer/bin/x264 --pass 3 --bitrate 2454 --stats "/home/andrew/workdir/x264stats.log" --ref 5 --mixed-refs --no-fast-pskip --bframes 2 --b-pyramid --b-rdo --bime --weightb --filter -3:-3 --subme 6 --trellis 1 --analyse all --8x8dct --ratetol 1.0 --qcomp 1.0 --me umh --zones 156250,163225,q=40 --cqmfile "/home/andrew/workdir/eqm_avc_hr.cfg" --progress --output "/home/andrew/workdir/pass2.264" "/home/andrew/workdir/stream.yuv" 640x480
/opt/my_mplayer/bin/x264 --pass 3 --bitrate 2454 --stats "/home/andrew/workdir/x264stats.log" --ref 5 --mixed-refs --no-fast-pskip --bframes 2 --b-pyramid --b-rdo --bime --weightb --filter -3:-3 --subme 6 --trellis 1 --analyse all --8x8dct --ratetol 1.0 --qcomp 1.0 --me umh --zones 156250,163225,q=40 --cqmfile "/home/andrew/workdir/eqm_avc_hr.cfg" --progress --output "/home/andrew/workdir/pass3.264" "/home/andrew/workdir/stream.yuv" 640x480
The output is being piped from mencoder in case you were wondering.

My second question is about statsfiles in 3 pass mode. I noticed that the first pass creates a file (x264stats.log.temp) which appears to be copied to (x264stats.log) at the completion of the first pass. Then the second pass creates (x264stats.log.temp), but what happens at the end of the pass? Does it update (x264stats.log)? It would be pointless to do 3 passes if the second pass didn't update the stats file, wouldn't it. It seems like the answer should be that it obviously does, but I want to be sure.

I'll go ahead and throw in a 3rd question too. Adaptive quantization isn't part of x264 SVN is it? It's a patch from Sharktooth's builds, correct? Where can I find this patch, because I want to apply it to my x264 builds and try it.

Thanks for your help,
Oline 61

snacky
13th February 2006, 03:05
qcomp=1.0 is almost exactly the same as constant quant (modulo ip_ratio and pb_ratio). Ratetol is sort of hard to predict (behavior depends on the source material) but it only affects the first pass. In theory, larger ratetol values may be better for multipass encodes; very small ratetol values may be useful for single-pass encoding.

Oline 61
13th February 2006, 03:08
How high can I go on the ratetol? If I go too high will I end up with undersized/oversized output? I am trying to fit 2 movies on 1 DVD, and have a very low tolerance for undershooting/overshooting size.

I will keep qcomp at 1.0 because that is exactly what I want.

snacky
13th February 2006, 03:20
You're using multipass, so ratetol will have almost no effect at all on error. You might as well go ahead and use a higher value, as this tends to get better-looking results in multipass encodes. Especially since you're using three passes, which is really overkill imo.

Oline 61
13th February 2006, 04:40
Well, on a short encode ~3000 frames with --ratetol 100.0, the final 3rd pass was about 66 kbit/s off as opposed to 1 kbit/s off with --ratetol 1.0. Needless to say that is probably excessive. I will run several encodes overnight with different --ratetol and analyze the PSNR and bitrate output.

akupenguin
13th February 2006, 09:59
qcomp=1.0 is almost exactly the same as constant quant (modulo ip_ratio and pb_ratio).
pb_ratio works exactly the same with qcomp=1.0 as with cqp. Only ip_ratio differs.

Oline 61
13th February 2006, 23:13
Okay, using ratetol 10, 20 and 30 on a 3000 frame encode had some predictable results. As the ratetol increased, the file became more and more undersized, with the PSNR decreasing at higher ratetol's. I guess it may be more effecient to use a higher ratetol and higher bitrate to achieve the same PSNR as a lower bitrate and lower ratetol. Not sure about that though. May have to do more testing. This is all subjective to this specific clip of course, no idea what will happen on other material, which is why I tend toward the default and plan on keeping it under 5.

Oline 61
16th February 2006, 04:24
Does changing ratetol or qcomp or both really increase quality from defaults? I have a feeling it doesn't help very much for some reason.