Log in

View Full Version : My quant distribution is terrible!


ryeguy
5th February 2007, 00:34
I am making a movie for a game. A movie exists that has great quality with xvid that I am trying to reproduce. The author of the movie doesn't want to give out his settings, so I'm trying to dig deep. The game is a first person shooter, so it's high motion and movement. Both of our movies are at 1280x720 @ 25fps. His quant distribution, using DRF analyzer, is pretty steady, yet no matter what I do I can't get the distribution he has with the quality but with the small filesize. I'm aiming for a filesize under 45mb/min, 50mb/min at most. One thing i DO know he did was use 2pass 5000 bitrate. My xvid settings are:

http://img249.imageshack.us/img249/5927/quantsjj7.jpg

Analysis of HIS movie:
Frame Type Statistics :
I Frames: 4.86%
P Frames: 67.84%
B Frames: 27.30%
S Frames: 0.00%
N Frames: 0.00%
(More Advanced Codecs use B and S frames)
Frame Quality Statistics :

DRF=1&2: 123 5.4%
DRF=3: 1020 44.9%
DRF=4: 501 22.1%
DRF=5: 298 13.1%
DRF=6: 207 9.1%
DRF=7: 108 4.8%
DRF=8: 10 0.4%
DRF=9: 5 0.2%
DRF>9: 0 0.0%
KeyF/DeltaF: 5.11%
KeyDRF<4: 108
KeyDRF=4: 7
KeyDRF>4: 1

AverageKeyDRF: 2.67
MAXDRF: 9
AverageDRF: 3.87
Deviation: 1.31

MY movie:
Frame Type Statistics :
I Frames: 4.71%
P Frames: 63.73%
B Frames: 31.56%
S Frames: 0.00%
N Frames: 0.00%
(More Advanced Codecs use B and S frames)
Frame Quality Statistics :

DRF=1&2: 1 0.1%
DRF=3: 559 60.1%
DRF=4: 62 6.7%
DRF=5: 0 0.0%
DRF=6: 92 9.9%
DRF=7: 212 22.8%
DRF=8: 4 0.4%
DRF=9: 0 0.0%
DRF>9: 0 0.0%
KeyF/DeltaF: 4.95%
KeyDRF<4: 45
KeyDRF=4: 1
KeyDRF>4: 0

AverageKeyDRF: 3.00
MAXDRF: 8
AverageDRF: 4.23
Deviation: 1.72


I just don't get it, his is almost like a bell curve and mine is just random spikes at all quants. I've also noticed something: whatever I set the max quant to, the max is always used. Look at the percentages; the DRF3 is high because the Pframe quant is 2-3 (I know this is really low range, but I've tried larger ranges like 2-5 and they just group at 5 for example), and the 6 and 7's are high because of the Bframe quant ratio. How can I smooth out my distribution more to like his? The only factor anyone here might suggest is the source footage: it's not exactly the same, but both movies are "clips" of footage, so the compressibility of each second of the clip can be much different.

foxyshadis
5th February 2007, 01:20
I think you're confusing quantizer with quality, when really, they just aren't comprable. Quantizer distributions are completely different with different custom matrices, as well. Instead of looking at the quantizers as a way to gauge the quality, you should look directly at the video itself, because quantizers alone tell you nothing. (Except that a really high average and lots of really high quants tell you it's going to look bad.)

If you want a way to optimize visual quality, see the xvid presets thread and several other discussions in here about compressing video game footage.

btw, you get the two peaks because the b-frames are mostly q7, and the i/p-frames mostly q3. The b ratio/offset controls that. Using 0/0 for both will give you a normal distribution, but it'll probably look worse as too much gets spent on less useful frames. And if you set the max too low, like you're doing, you'll kill the rate control and probably oversize your video.

ryeguy
5th February 2007, 01:24
Is there any way to change the p frame distribution though? I mean if the p frame is peaked then the b frame will peak since b's are based off of p's. The whole reason the max is so low for the p's is because the p's will mostly end up being whatever the max is. In his movie the quants are mostly 3, so that's why I set my max to 3 since they would group up there. If I set it any higher they group up at that max then.

foxyshadis
5th February 2007, 04:12
If you want a purely academic method of scaling the quantizers in specific ways I could do that, but I won't waste my time because it's absolutely futile and pointless. You should be setting quant-max to at least 4-5 and filtering your video in order to fit it to your bitrate requirements without looking terrible. Filtering is one of the most important keys, especially for jerky video game footage.

See the presets thread (http://forum.doom9.org/showthread.php?t=119399), run a compressibility check as defined in the thread, and test the configurations the community has found to be the best at various levels of compressibility.

This slavish devotion (http://en.wikipedia.org/wiki/Cargo_cult_programming) to quantizers and their distribution based on one encoder's output baffles me. If you don't understand the codec, the presets thread is there to guide you, and once you're armed with knowledge you can ask more sensible questions.