Log in

View Full Version : XViD B-Frames test results (default settings vs no B Frames)


KR
11th July 2004, 18:00
I recently did a test to compare encoding with and without B Frames. I got the idea after reading a thread started by lordadmira. He used "extreme" settings, and many users suggested he tried using the default settings. I did.

Source: Mooto - Revolution of Kicking

Encoded 2-pass with GMC, H.263 (yeah I know its bad), Ultra High (6) Motion search precision, VHQ Wide Search (4), Chroma motion, Trellis quant, and the rest is the default settings, I think.

This has been done twice, the first time with B frames (this version will be referenced by *B*), using the default settings. The next one was without B Frames (*0*)

Both files had approximately the same final filesize.

I wrote a small AviSynth script to put, side by side, *B* and *0*. Below them was the difference between each XViD and the original (using "subtract"). This was then amplified using "levels".

There was no postfiltering.

I analysed the entire video, with it playing in VDuB. (not a frame-by-frame analysis.)

Results: On average, (not a frame-by-frame analysis)
1. The *0* version looks better.
2. The difference between *B* and original versus *0* and original is greater. This means that encoding with B frames further alterates the video.

Why did I say "on average" ? Because by analysing on a frame-by-frame basis, I noticed that for some frames (only a few), the *B* version was better. But, for all the other frames, the *O* version was much better.

The most affected parts on the video were the edges.

I have stopped using B frames.

I invite others to compare with-B-frames encoding versus without and to give me their results.

If anyone could explain why encoding with B-Frames produces worse results, especially on the edges, I'd be happy to read your explanation.

Koepi
11th July 2004, 20:14
Is that by any chance an anime source?

Can you redo the test with qpel enabled and see if the result is the same?

On a sidenote, testing on a single source is as useful as putting a stone on a wall, it won't tell you anything from which you can draw general conclusions :-)

Regards
Koepi

KR
11th July 2004, 21:09
No, the source isn't anime.

I know that testing on only one source isn't sufficient to draw conclusions. That's preciselly why I wrote:

I invite others to compare with-B-frames encoding versus without and to give me their results.



If anyone could explain why encoding with B-Frames produces worse results, especially on the edges, I'd be happy to read your explanation.

P.S.: Sorry for my bad english.

EthanoliX
11th July 2004, 22:27
Both files had approximately the same final filesize.

Ok, but what were the average Quantizers (I/P/B)?

Maybe the reason why your B-result looks worse is, that you had a high Quantizer for Is and Ps (and so a .very high Quantizer for Bs).

And so maybe for Bs the low and middle frequencies are not only quantized very inaccurate but cut off completely, leading to very strong blocking.

Maybe a lower quantizer ratio/offset might help.

malkion
11th July 2004, 22:52
I've always preferred the look of 1 b-frame vs default b-frame.

However, it's a toss up depending on the source between 0 b-frame vs 1 b-frame. Hard to say which one looks more pleasing to me.

Course this is all just personal opinions, b-frame is a setting you choose.

KR
11th July 2004, 23:35
STATS

Without B frames
----------------
Kilobits per Second: 782.49
Kilobits per Frame: 25.85
Kilobits per Macroblock: 0.078
Bits per Pixel: 0.31
I Frames: 1.30%
P Frames: 68.93%
B Frames: 0.00%
S Frames: 29.77% <== what's that ?
N Frames: 0.00% <== are N-frames dropped frames ?
AverageKeyQuant: 3.67
MAXQuant: 21
AverageQuant: 4.13
Deviation: 2.45


With B frames
-------------
Kilobits per Second: 783.19
Kilobits per Frame: 25.88
Kilobits per Macroblock: 0.078
Bits per Pixel: 0.31
I Frames: 1.27%
P Frames: 31.24%
B Frames: 47.33%
S Frames: 20.16% <== what's that ?
N Frames: 0.00% <== are N-frames dropped frames ?
AverageKeyQuant: 2.89
MAXQuant: 31
AverageQuant: 6.02
Deviation: 4.27


The average key frames quantizer is lower for the with-B-frames version. So I frames are actually taking the space saved by high quants for the B frames in exchange of poor quality ? What is happening here ?

Why should B frames have higher quants if it is to destroy the video ? And if I use the same quants for B frames as for P frames, then they take up more space (as already demonstrated by lordadmira with his "extreme" settings). But, because I'm going for 2 pass, which is based on final filesize, using low quants with B frames means higher quants for P frames than if there were no B frames at all. So, as soon as I use B frames (for encoding this particular source), whether they have high quants or low quants doesn't affect the final result: poor image quality.

And so maybe for Bs the low and middle frequencies are not only quantized very inaccurate but cut off completely, leading to very strong blocking.
The most affected parts are the edges (similar to the Gibbs effect (ringing)), and slight noise in the background. But not much blocking, so I don't think that low frequencies were cut off completely. It might depend on the QM used, in this case it was H.263.

Sagittaire
11th July 2004, 23:38
For same size IPBP sequence is generaly better for PSNR than IPPP sequence:

for exemple:

I: q3 45 dB
P: q3 44 dB
B: q5 42 dB
P: q3 44 dB

I: q3 45 dB
P: q4 43 dB
P: q4 43 dB
P: q4 43 dB

and generaly IPBP is visually better than IPPP ...

chilledoutuk
12th July 2004, 00:12
The point of b-frames is not to improve quality at high bitrates but to increase the codecs ability to compress the video more heavily whilst minimising the damage to the video quality.

From my experience in order to take advantage of this increased compressibility to gain better quality you have utilise it increased compression power by increasing the resolution of the video.

By encoding the video at a higher resolution than you would if you did not use b-frames the slight reduction in the picture clarity would be easily offset by the clarity gain of an increase in frame size.

This is especially true when encoding anamorphic encodes where the compression power of b-frames allows the original resolution of the video source to be kept whilst not sacrificing too much on compressibility.

Also remember that the increased compressibility means that a quant matrix like HVS Best can be used at bits per a pixel rates that is simply unfeasible without the implementation of b-frames.


I therefore strongly suggest that you do not compare encoding with and without b-frames with the same settings as this is simply not realistic as most people use b-frames and offset the quality reduction with the use of more compressibility expensive features such as Qpel, and custom matrixs.

Sagittaire
12th July 2004, 00:38
Without B frames
----------------
Kilobits per Second: 782.49
Kilobits per Frame: 25.85
Kilobits per Macroblock: 0.078
Bits per Pixel: 0.31
I Frames: 1.30%
P Frames: 68.93%
B Frames: 0.00%
S Frames: 29.77% Pframe with GMC (glabal vectrorisation)
N Frames: 0.00%
AverageKeyQuant: 3.67
MAXQuant: 21
AverageQuant: 4.13
Deviation: 2.45


With B frames
-------------
Kilobits per Second: 783.19
Kilobits per Frame: 25.88
Kilobits per Macroblock: 0.078
Bits per Pixel: 0.31
I Frames: 1.27%
P Frames: 31.24%
B Frames: 47.33%
S Frames: 20.16%
N Frames: 0.00%
AverageKeyQuant: 2.89
MAXQuant: 31
AverageQuant: 6.02
Deviation: 4.27


AverageQuant with Brame is higher than without Bframe but deviation with Brame is higher without Bframe: the local quant variability is high with bframe ... parhabs too high for you with bframe defaut setting 2/1.50/1.00. Try with soft setting 1/1.25/0.75 ... or very soft setting 1/1.00/1.00


P Frames: 68.93% -> P Frames: 31.24%
S Frames: 29.77% -> S Frames: 20.16%

Interressing too ... but my english is too bad for clear explain

KR
12th July 2004, 00:44
@chilledoutuk

Thanks a lot for the info. I initially though that if B frames could increase the codec's ability to compress the video more heavily while minimising the damage to the video quality, then lower quants could be used for the other frames, but it seems that it doesn't improve the quality enough to compensate the B-frames.

If:
I do NOT use QPel
I use typical NTSC resolutions (640*480) and lower
I use my custom matrix (which I personnaly think is better than HVS Best, but it is still similar)

would you recommend using b-frames ?
It seems like I shouldn't, because I don't "offset the quality reduction".


@Sagittaire
Thanks a lot for the info. Now I know what are S frames. I'll try B Frames with 1/1.00/1.00 settings. I just hope it won't drain quality from P frames, as it happens with 1/1.00/0.

malkion
12th July 2004, 01:26
If you're interested in an alternative, and worried about quality drain *whatever that is, I dunno*, I use 1/1.00/2.00 or 1/1.00/3.00. That's how I choose my offset when encoding with ratio of 1.00. Havent been adventurous enough to try a greater offset yet...

lordadmira
13th July 2004, 01:26
The first thing I would point out is that 782 kbps is a very low bitrate to expect any kind of quality from. The fact that the codec used quants as high as 31 (egads!) tells me something else is wrong here. I'ld be interested to see the quant distributions for each frame type. It doesn't make sense for the key quants to be so low and everything else so high. Did u set a super high I frame boost? Also what're the resolution and length of the video?

LA

KR
14th July 2004, 05:18
The first thing I would point out is that this last reply is not linked to the subject: B frames. It seems useless to me to reply to this last post, but I will do so anyways.

Approx. 800 kbps is used for 1:30 hres - 1 CD encodes.
More and more people think that 1 Cd encodes aren't good. I've seen encodes done with DivX3-SBC that were much better than 2CD encodes done with DivX5 or XViD. Quality is not just bitrate.

Resolution was quite low: 360*240

For the non-B Frames version, image quality was medium. The MaxQuant value doesn't tell anything about quality. Maybe it was used for a single frame...

For the I Frame boost, well it was 0% ! (not a typo) Wow ! Super high !

I think people shouldn't pay attention to this thread anymore. I wasn't trying to convice people of not using B-Frames... so don't try to persuade me that my test was perhaps a bad one. I already know that ! I wanted people to give me their results by doing similar tests with different sources and different settings.

And what was the point of all those tests ? Differencing a possible gain in quality from the psychological factor: "Oh ! Look at this new QPel thing (just an example) that makes the encoding process so slow ! It must me super hyper high quality !" And, above all, making good quality encodes with a very nice codec (thanks to the XViD team !) that can be improved even more.

yaz
14th July 2004, 10:01
what do u, guys use for analysis? if it's drfanalyzer, be careful. time to time it reports false frame quantizers. for me, it's quite general getting q31 even if it's restricted to a much lower limit. just try it!
i checked the quantizers many times also with ffdshow & always(!) turned out that such quantizers simply do not exist. just a drfa error nothing more.
i've never experienced a quant-distribution wider than +-4 & the amount of quants out of a +-3 range is usually neglibile (far below 1%). ok, it's only my experience on a limited set of samples (some hundreds of encodes only :-) so it does not mean u wont ever get sg diferent.
the bests
y