View Full Version : 2 passes quality-based
el_rico
17th December 2003, 15:49
Hello,
First, do apologize if this has already been debated here, but I'm not able to find it using the search functionality (since the keywords are very often use but not in the sense I'd like).
Second, my question. Is there an automatic way to achieve 2-passes quality based encoding. My main motivation is quality and my encodings are not made for burning CDs: I do not have size target. However, I dislike wasting space. Then I'd like to reach quality target such as with quality-based encoding but with smarter bits allocation. Unfortunately, 2-passes are - as far as I know - filesize driven...
Here is what I do "manually":
- create AVS script using Gordian Knot (with generally maximum resolution)
- launch 1st pass accordingly using VDubMod
- open just created stats under Gordian Knot
- adjust filesize such that Bits/(Pixel*Frame) reaches 80% (seems that there is a consensus not going above this value) of what stats file indicates
- launch 2nd pass with this filesize as target.
Is this idiot? If not, what I'd like, of course, is a mean to do these 2 passes automatically. The only variable for this process if the quality (not the same as in 1-pass Q-based, 80% in the example above).
Thanks!
el_rico
18th December 2003, 09:48
OK. So maybe it's silly but nobody is willing to say so. A short answer could have been "Go with 1 pass Q-based". But I think my question remains especially when considering that 1 pass Q-based has disappeared in XVid1.0b...
Manao
18th December 2003, 09:58
There are no automatic way of doing what you want with just XviD / VDub. You need a commandline tool which will read the filestat and choose the final size according to the size read. It is easy to implement ( the new filestat format is quite easy to understand ).
But you would have then to use AVS2AVI ( a command line utility which allows you to encode ), and to feed it with the calculated final size.
It would be yet another change in the API to implement that in the codec itself ( afaik )
And quality based is roughly equivalent to constant quantizer, so you're still able to make 'constant quality' first pass.
MfA
18th December 2003, 10:13
I dont know how GomGom's experiments with p-domain statistics turned out ... if it works well it wouldnt be too hard to implement a fast constant MSE coding mode (which also means constant PSNR for people who prefer it).
el_rico
2nd January 2004, 09:26
Yes, constant MSE coding mode would be great. I have just searched something about p-domain statistics in this forum without success. Any link?
Thanks.
philtre
2nd January 2004, 11:11
isn't quality based encoding now achieved by using zones?
coolsva
2nd January 2004, 15:34
Nobody seems to be talking about 1 pass quality these days. 1 pass quality is the best setting for many of us who do not have a set target (basically backing up our home videos, we need th best quality no space constraint).
Here is what I usually do
- In the codec settings screen, set the encoding type to 1 pass and bitrate to some high figure like 100000
- In the advanced options screen, go to the quantization tab and change all fields to 2
- In the Profiole @ Level settings, I setup the quantizer ration to 1.0
This way, I can get the benefit of B frames but with a fixed quantizer (compression) for all frames.
Perhaps, this is not the right way, but it gives me the best results.
Leak
2nd January 2004, 15:49
Originally posted by coolsva
- In the codec settings screen, set the encoding type to 1 pass and bitrate to some high figure like 100000
- In the advanced options screen, go to the quantization tab and change all fields to 2
- In the Profiole @ Level settings, I setup the quantizer ration to 1.0
This way, I can get the benefit of B frames but with a fixed quantizer (compression) for all frames.
Perhaps, this is not the right way, but it gives me the best results.
Actually, just setting the default zone to a fixed quantizer of 2 and changing the BVOP quantizer ratio to 1 and the offset to 0 should do the trick; no need to mess with the quantization tab.
np: M. Mayer - Speaker (Total 5 comp.)
sysKin
2nd January 2004, 16:13
Originally posted by Leak
Actually, just setting the default zone to a fixed quantizer of 2 and changing the BVOP quantizer ratio to 1 and the offset to 0 should do the trick; no need to mess with the quantization tab.In the settings he quoted, b-frames will still have quant 4 (min/max is at 2, but that's before ratio/offset are applied).
In other words, a quant-2 zone will result in exactly the same video.
Radek
Hylas
2nd January 2004, 18:57
Then I'd like to reach quality target such as with quality-based encoding but with smarter bits allocation. Can someone extend on this? In how far is the 2-pass bit allocation better (qualitywise) than a constant quantizer mode? Or is it just a compromise to reach a specified bitrate?
Leak
2nd January 2004, 21:55
Originally posted by sysKin
In the settings he quoted, b-frames will still have quant 4 (min/max is at 2, but that's before ratio/offset are applied).
In other words, a quant-2 zone will result in exactly the same video.
Well, he *did* want to have the highest quality, size be damned, so quant 2 for B-frames should be more what he wants... :)
np: Jonas Bering - Mustang 1966 (Sketches For The Next Season)
temporance
2nd January 2004, 23:51
Originally posted by Hylas
Can someone extend on this? In how far is the 2-pass bit allocation better (qualitywise) than a constant quantizer mode? Or is it just a compromise to reach a specified bitrate? Generally, two pass could give a better overall experience than constant quantizer by modulating the quantizer according to HVS and R-D factors (e.g. raising quantizer slightly in scenes with high motion).
Also, constant quantizer doesn't respect a VBV model so would not be guaranteed to be played on MPEG-4 standalones. Then again, the only codec with working 2-pass VBV is DivX 5, AFAIK. So if you're talking about xvid then this is a mute point.
Hylas
3rd January 2004, 09:31
Originally posted by temporance
Generally, two pass could give a better overall experience than constant quantizer by modulating the quantizer according to HVS and R-D factors (e.g. raising quantizer slightly in scenes with high motion).
Couldn't this be (theoretically) done in a 1-pass "quality" mode as well? This would speed up the encoding for those of us without target sizes (DVD±R anyone? ;)).
Thanks for the info!
temporance
3rd January 2004, 13:57
Originally posted by Hylas
Couldn't this be (theoretically) done in a 1-pass "quality" mode as well? This would speed up the encoding for those of us without target sizes (DVD±R anyone? ;)).Yes, but quality gain would be pretty small: and it all gets very subjective.
sysKin
3rd January 2004, 14:21
Originally posted by Hylas
Couldn't this be (theoretically) done in a 1-pass "quality" mode as well? This would speed up the encoding for those of us without target sizes (DVD±R anyone? ;)).Well first XviD has to do that at all - and it doesn't ;)
Radek
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.