PDA

View Full Version : question regarding p and b frame quantization


Blue_MiSfit
3rd June 2004, 02:50
Okay, from my understanding, B frames can theoretically look as good as P frames with higher quantization values. Example: A Q5 B frame could look theoretically as good as a Q3 or Q4 P frame. Thus, XviD would assign B frames higher quantization values than P frames, correct?

This has always been the case in my encodes, the P frames end up getting mostly q2-4 and the bframes get 3-6 or so. However, in a recent encode I tried setting bframes to 8/1/0, thinking this would set the minimum b frame quantizer to 2. However, in the second pass, I am getting strange quantization values, have a look at this screenshot:

http://people.ucsc.edu/~dpresteg/quants.png

As you can see, the average P frame quants are higher than the average B frame quants. Isn't this supposed to be the other way arround to achieve highest quality? I also don't like the spread of I frame quants, I like I frames to stay very low... 2-4 at the most. Am I just doing something very stupid, or is there a bug here?

Also, doesnt an average quant value of 5.96 seem way too high for a 1.1GB target filesize if the movie is about 90 minutes long?
Here are my settings:

Source: A Bug's Life DVD NTSC 4:3
"CG-Animation" CQ Matrix
Qpel
GMC
Adaptive Quant
Bvops @ 8/1/0
Bvop sensitivity 80
Packed Mode
Turbo
Chroma Motion & Optimizer
Trellis
MSP 6 & VHQ4
All quants 2-31

I am using Gamr's May 27th XviD build.

AVS consisted of only crop and undot


comments/suggestions/input welcome as usual.

Thanks
~misfit

sysKin
3rd June 2004, 03:45
Since p-frames and b-frames scale differnetly in 2nd pass, you can't really assume that their average quant will be identical (or even close) just because ratio is 1, offset 0 (well in fact, from the explaination, you should... but it's not really that easy to achive all that in the code).

So, bframes and pframes have a different quant.. and that's what you got, right? It's similar, like you asked, but differnet.

You always have to be careful when you try crazy settings like that. Here, the result is simply horrible, and that's just because of a small scalling difference...

Have fun trying your crazy settings,
Radek

Blue_MiSfit
3rd June 2004, 10:41
righto. surprisingly the result didnt look terrible, but it definatley wasnt up to par with what a 1.1 gig rip of 90 mins of CG video should look like.

I am re encoding with bvops @ 2/1/1 and sensitivity @ 5.

Perhaps this will make something more sensible.

~misfit

lordadmira
4th June 2004, 13:15
Actually I would say the source of ur troubles is the CG Animation Matrix. I've tried it and haven't liked the results. There is no relationship between the quants that P frames get and what B frames get unless u set an offset. To be honest I've found the H263 matrix to be the best for all sorts of animated material. I should know since that's almost all I encode. ^^ Your status graph looks perfectly fine. Keep in mind that CGI material is going to contain a lot of pure gradients, something that fundamentally cannot be encoded properly by Mpeg4. The only thing you can do is smooth out the artifacts with lots of bits. I think if u kept ur original settings and used the H263 matrix it'll look just fine. Better than the defaults.

LA

PS If u want the I frames to have more bits u can set the I frame boost in the Xvid settings.

Prettz
6th June 2004, 06:02
Aren't b-frames significantly larger than p-frames at the same quant?

lordadmira
6th June 2004, 09:34
No there is no relationship between the size of P frames and the size of B frames for any quantizer. It's the motion compensation that results in B frames being significantly smaller than P frames; this is unrelated to the quantizers. Now if u have B frame quantizer offsets set then this effect will be even larger. If ur B frames are coming out larger than the P frames then something is seriously wrong.

LA

Prettz
7th June 2004, 02:11
So then, other than the fact that b-frames are forced to a higher quantizer, what makes a b-frame smaller than a p-frame?

RadicalEd
7th June 2004, 02:39
More precise motion compensation, meaning less interblock data. That's more precise in the sense that there are two frames to search for matches in.

Prettz
7th June 2004, 02:57
Originally posted by RadicalEd
More precise motion compensation, meaning less interblock data. That's more precise in the sense that there are two frames to search for matches in.
So that would come out to, what, 1 extra bit for each predicted macroblock? (I wish I had a detailed copy of the MPEG4 spec to look at right now). It seems to me that, compared to how my thinking was about it before, there's practically no difference between b and p frames.


edit: I believe the reasoning behind my assumption that b-frames are inherently larger than p-frames is from when I made an encode where all b-frames would come out to quant 2, and it ended up being way oversized and poor quality, although I don't remember exactly what the problem with it was now.

CruNcher
7th June 2004, 03:22
@Blue_MiSfit
hehe what you will get with such settings is a nice blinking effect :D
i wonder you didn't recognized that it will be even more horrible with AQ on ;)