View Full Version : Does setting B-VOP ratio/offset to 1/0 affect quality?
Janzki
17th December 2005, 22:17
I've searched and read numerous threads about b-frame settings in XviD, but didn't find an exact answer to the question I've been pondering. The clip I have is a 5-minute long heavily edited anime clip with lots of panning and transitions between scenes. I'm encoding one-pass, target quantizer 2 with XviD 1.0.3.
If I set B-VOPs to 1/1/0, is there any, even mathematical, loss in quality vs. an encode without b-frames? Or does it only affect decoding complexity? Personally I can't see any difference, but my vision may not be the best any more at this old age. ;) Contrary to what I've read, the savings in filesize seem to be about 8-9% every time, so I'm wondering if this is a case of "free lunch".
Manao
17th December 2005, 23:46
Bframes 1/1/0 will raise the quality vs speed tradeoff against no bframes. On some clips, it'll lower the quality, but the filesize drop will be bigger. On other, the quality will raise, and the filesize won't. Finally, there will be clips where both filesize and quality raise.
Most of the time, it'll be better ( meaning, if the qualities were the same, the filesize would be smaller, or if the filesizes were the same, the quality would be higher ). On some clip, it might hurts. But such clips are rare enough to considere such settings safe.
Teegedeck
18th December 2005, 11:29
If you use XviD 1.03 setting b-frames 1/1/0 will definitely degrade quality; simply because there is no VHQ for b-frames in 1.03. So either don't use b-frames instead of 1/1/0 or switch to XviD 1.1.
Janzki
18th December 2005, 13:30
I've been wary of beta versions because I want my encodes to be future-proof, but I think I'll try version 1.1b2. Thanks!
Teegedeck
18th December 2005, 15:07
All good things in video & audio encoding are beta.
Sharktooth
18th December 2005, 15:26
beta 2 is quite old. i suggest using this build: http://www.aziendeassociate.it/cd/XviD.1.1.cvs.exe from celtic druid that contains the latest fixes/additions and can be considered a release candidate.
however xvid 1.1 and 1.2 betas are quite stable, so dont worry :)
if you want to keep all the goodies of the koepi's package (custom matrices, calculator, stats reader, fourcc changer, etc.) just install beta 2 and then install the celtic druid's build over it.
Manao
18th December 2005, 18:20
If you use XviD 1.03 setting b-frames 1/1/0 will definitely degrade quality; simply because there is no VHQ for b-frames in 1.03VHQ isn't a magic tools. Bframes are inherently more efficient than Pframes, with or without VHQ. VHQ for P and not for B reduces only slightly the gap in efficiency. Not having VHQ didn't prevent you from using XviD back in the time where it didn't exist ?
Backflip
18th December 2005, 23:32
I might change to latest XviD beta too, hopefully it's really stable enough to encode many DVD's without checking watching later and seeing problems.
Teegedeck
19th December 2005, 17:04
VHQ isn't a magic tools. Bframes are inherently more efficient than Pframes, with or without VHQ. VHQ for P and not for B reduces only slightly the gap in efficiency. Not having VHQ didn't prevent you from using XviD back in the time where it didn't exist ?The question asked was whether in a constant-quantizer-2 one-pass encode, where filesize is of no importance, the result would look better with or without b-frames. And 'without b-frames' is the answer because a b-frame without VHQ looks clearly worse than a p-frame with vhq. Even with b-vhq I'd probably not use b-frames _if_ I didn't care about filesize. 'Efficiency' doesn't seem a concern of Janzki's. But VHQ increases quality, not only efficiency.
(At the same quantizer, encoding with b-frames is inherently only slightly more efficient than encoding without b-frames - and ONLY if you use VHQ for b-frames. See the test performed by StephanV here (http://forum.doom9.org/showthread.php?p=675985&highlight=b-frame+size+p-frame#post675984) .)
In two-pass, on the other hand, using b-frames at a higher quantizer than p-frames yields such a gain in compressibility that the resulting quality is (and always was) higher than what you get without b-frames - provided you are well away from the point of saturation. This is the common case; restricted filesizes and thus other means of improving quality. Increasing resolution, the use of CQMs etc. would all come before I'd think about not using b-frames. I hope that clears it up.
Edited: made some points more clear
Sagittaire
19th December 2005, 18:07
quality between 0/1/0 (no-bframes) and 1/1/0 is certainely indentical in practice
| bitrate SSIM0 PSNR (avg)
--------------------------------------------------------------------------
no bvops, VHQ4: | 2755 kbps 89.64 46.7475 dB
bvops(1/1/0), VHQ4, no b-VHQ: | 2727 kbps 89.37 46.6376 dB
bvops(1/1/0), VHQ4, b-VHQ: | 2684 kbps 89.31 46.6042 dB
bvops(2/1/0), VHQ4, b-VHQ: | 2690 kbps 89.29 46.5947 dB
bvops(1/1/1), VHQ4, b-VHQ: | 2265 kbps 88.10 45.9830 dB
file is little small with bframe but quality too: with exactly the same size the quality could be the same.
But use bframe like that is useless : encoding with bframe + ratio/offset is always the best way for quality else use encoding without bframe (it's better for soft/hardware decoding)
Manao
19th December 2005, 22:21
Teegedeck: OK, I see your point. But then, if one doesn't care about filesize, why not encode at Q1, or with a high bitrate matrix ? Quality will be even higher.
And so, a bit off topic :At the same quantizer, encoding with b-frames is inherently only slightly more efficient than encoding without b-frames - and ONLY if you use VHQ for b-frames.It depends widely on the content. And I think there is "more content" where using bframes is more efficient ( whatever the VHQ settings for B's ).
Anyway, what I don't understand is why on a one pass scenario, filesize suddenly doesn't matter. I mean, the difference in quality between P-only @ Q2, and P-B @ Q2 won't be perceptible, while the filesize reduction can be. Then, why not put a bit more emphasis on filesize reduction ? Since quality is visually the same, as Janzki said : it's a free lunch.
Manao
19th December 2005, 22:48
And to back up words with figures : Foreman, denoised :
P VHQ 4 @ Q2 : 43.95 dB, 3826 KB
P VHQ 4 - B no VHQ @ Q2 : 43.92 dB, 3602 KBOk, you wonder, why denoising ? Well, I first tried without, and while the psnr decrease was alike, the filedrop was lessen. Then I tried adding noise, thinking "mmm, bframes improve prediction, so they'll help more if there's noise". So wrong I was, in such a case ( ie, constant quantizer ), it's the opposite that happens. The correct thinking was "bframes efficiency comes from a better prediction ( that at least I got right ), which added noise destroys ( that I completely overlooked )".
Also, stepping from that observation to claiming that bframes help most when the video is clean and easy to encode is a step I won't take ( because there's was only one test, in particular condition : constant quantizer ).
Anyway, back to my point : 0.03dB can't be seen, while 6% bitrate savings can.
Teegedeck
19th December 2005, 22:59
Gonna read what you wrote with more scrutiny tomorrow morning. For now: What is Foreman?
Edit:
Good morning, I'm back.
In answer to your posts:
1) Again, I only answered the question whether an XviD 1.03 one-pass encode looks better with or without b-frames, IF filesize is of no importance, and the simple answer is 'without'. IF you use XviD 1.1 with b-vhq the answer would be 'no perceivable difference, thus go with the more efficient setting = 1/1/0'.
(That I would skip resizing, skip denoising, use a high-bitrate CQM, and probably wouldn't even want to do 1-pass before I'd recommend not using b-frames is an entirely different question.)
2) We've had not one, but so many discussions of the efficiency and quality of b-frames that it is kind of bothersome now. It seems the myth of the efficieny of b-frames stems from their actual framesize being so tiny that many people don't look farther and don't realize that the framesize of p-frames goes up when you use b-frames, so you don't save anything in the end if you use ratio/offset 1.0/0 and don't use VHQ for b-frames. B-frames were meant to be compressed at a higher quantizer than p-frames, otherwise there's no sense in using them...
3) ...because b-frames deliver no improvement in quality over p-frames. As quality indicator you can use your eyes or the results of synthetical quality measurement Sagittaire has given above. But b-frames are much more tolerant to strong compression and don't degrade the quality of frames to follow, that's their strong point.
We can of course have another round of test encodings to settle the efficiency question.(I don't give much for synthetic quality measurement though.) Have you read on that thread? There was another test here (http://forum.doom9.org/showthread.php?p=676209#post676209). Harley Quin found a 6% efficiency gain for b-frames with b-vhq and a loss of effciency without b-vhq (though not even one percent). So I would strongly suggest to use b-frames only with vhq for b-frames as of XviD 1.1 and ideally more strongly compressed than p-frames.
To summ it up:
best quality if you don't give a toss about filesize:
b-frames 0/0/0
an efficiency gain ranging from small to considerable (3-6%) and possibly a minimal quality-loss over b-frames 0/0/0:
b-frames 1/1/0 (XviD 1.1 with vhq for b-frames ONLY)
if you care about filesize at all:
b-frames 2/1.5/1 with vhq for b-frames (alternatively 2/1.63/0)
XviD 1.03 with b-frames 1/1/0 is not at all a recommendable setting.
Trephin
14th February 2006, 11:37
if you care about filesize at all:
b-frames 2/1.5/1 with vhq for b-frames (alternatively 2/1.63/0)
Interesting. I also read Didée used 1/1.62/0 or 2/1.63/0. How do you arrive at quantizer ratio 1.63 exactly?
Didée
14th February 2006, 14:30
The idea is to have an *effective* Offset of +1 for the P-quants q2 & q3 ("hi-Q" range), an effective Offset of +2 for q4, and an effective Offset of +3 for q5 & q6 ("low-Q" range).
With default settings, you'll get an effective Offset of +2 even for the low q2 & q3 quantizers, where I prefer to have a smaller Offset. So I settled for those settings, because they deliver a small Offset for low quantizers, and "the usual" Offset for higher quantizers. In particular for high-BR matrices with characteristics similar to SixOfNine, this seems reasonable to me.
BTW, you can just the number 1.6 for that just as well ... the reason I typed "1.62" was that this is just the mathematical number for "the golden cut" (0.618... resp. 1.618...), which, funnily enough, once more approved it's golden-ness, in the strange context of video-coding. ;)
Trephin
14th February 2006, 15:54
Aaaaahh... The golden ratio! Nice :) Now I will surely sleep well knowing my quantizer ratio is not chosen randomly :)
Elic
14th February 2006, 23:20
Didée
> *effective* Offset of +1 for the P-quants q2 & q3 [...] Offset of +3 for q5 & q6 ("low-Q" range). [...] for high-BR matrices with characteristics similar to SixOfNine, this seems reasonable to me.
Thanks! Very interesting. I prefer Jawor's matrices so I will try if your method is suitable for them too...
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.