Log in

View Full Version : ipratio pbratio reasonable values


SamLowry
4th February 2009, 14:29
Can someone, please, explain why most encoders by default give P frames higher quantization then I frames, and B frames get higher quantization the P frames.
I understand that I and P frames are used as reference from P and B frames but still don't get the logic.
I.e. on an encoded video stream with 75% B frames, why would someone like to boost the quality of 25% of all frames by compromising the quality of the rest 75% of the video?

When trying to get almost transparent video encoding, does it make sense to set ipratio and pbratio to 1.0?

Dark Shikari
4th February 2009, 14:45
B-frames inherently get better prediction than P-frames because of the effectiveness of biprediction. Thus, they don't need as a low a quantizer to achieve the same quality. Part of the idea behind the higher quantizer is to try to maximize the number of skip in B-frames in order to save bits for other frames. Furthermore, they're not referenced by future frames, so a slight drop in quality won't stack up over time.

I-frames are higher quality because they primarily exist on scenecuts, so they ensure that a new scene has a high quality reference frame to start with. And also because intra prediction is inherently worse at keeping detail than inter in H.264.

x264 uses a much lower pbratio than some previous encoders (e.g. Xvid) because of the issues that extremely high B-frame quantizers can cause.

SamLowry
4th February 2009, 15:55
Thank you Dark Shikari for the explanation. It's clear now.

Just one more question. The defaults (ipratio=1.4, pbratio=1.3) can be optimal for one kind of footage but not for other. How to guess when I need to tweak those settings in order to get the better overall quality in "Constant Quality" mode?

I'm encoding PAL DV footage with plenty of motion, zoom-in/out and panning with "--crf 18", 50 GOP, 3 b-frames.

burfadel
4th February 2009, 16:02
With the massive improvements in x264 over the last couple of years, wouldn't the optimal defaults change slightly?

Sagekilla
4th February 2009, 18:08
Generally speaking, the defaults of ip=1.4, pb=1.3 -are- optimal. You really shouldn't touch them unless you're trying to do something specific. The only situation I can think of where you'd wanna touch this (which is a contrived example anyway) is a very long sequence where there's little movement.

Still, it's not worth touching it.