PDA

View Full Version : Single Pass = VBR?


babyray-uk
10th February 2005, 10:07
Hi Guys

Up till a short time ago I assumed (incorrectly it would seem) that doing a single pass X-viD encode was CBR and that the main reason for doing two pass X-viD encode was for the encoder to distribute the bits to obtain the same file size but 'better' quality (i.e. VBR), so a 1000mb two pass file would be better quality than a 1000mb single pass file.

After reading this thread (http://forum.doom9.org/showthread.php?s=&threadid=80066&highlight=1000mb) it would seem I am not correct in my assumption :) and that 2 pass encoding is only worth doing if you want to hit a file size.

I am currently working on a Perl script that automates a lot of my video encoding I am not worried about hitting a file size and my current logic at the moment is

1. Do a quant 2 full quality first pass.
2. Take the total of the 6th column in the .stats file.
3. Add the .avi overhead size.
4. Multiply this by the quality desired (70% for example).
5. Do a second pass using the size.

My two questions are...

If I am not worried about hitting a file size but I am worried about the actual file size (or I would just encode everything at single pass quant 2) should I carry on using the above method or will single pass at a lower quant give me the same quality as two passes?

If I should use a single pass instead of two passes what is the relationship between quality and quant? is it a sliding scale or a direct relationship i.e.

100% = Quant 2 (1?)
75% = Quant 8.5
50% = Quant 16
25% = Quant 23.5

If it is a sliding scale how do I work out what percentage quality = what quant?

Many thanks in advance, as always :)

BabyRaY

stephanV
10th February 2005, 12:09
Originally posted by babyray-uk

1. Do a quant 2 full quality first pass.
2. Take the total of the 6th column in the .stats file.
3. Add the .avi overhead size.
4. Multiply this by the quality desired (70% for example).
5. Do a second pass using the size.

Step 4 should before step 3. The overhead is not dependant on quality or bit rate, but on the amount of samples (frames) used in your file.


If I am not worried about hitting a file size but I am worried about the actual file size (or I would just encode everything at single pass quant 2) should I carry on using the above method or will single pass at a lower quant give me the same quality as two passes?
If you do a quant 2 encoding and are happy with the filesize i wouldnt bother with a 2 pass encode. However, with higher quants there might be an improvement with doing a 2 pass since constant quant is not exactly the same as constant quality.

Teegedeck
10th February 2005, 13:21
ack! I shouldn't have fast-read your question before typing a lot of garbage. Corrected

So what you want is a kind of a faster, though less accurate first-pass?

Perhaps it would be sufficient if you used the filesize-prediction tool 'enc' in order to test how large your constant-quant encodings would get. Configuring XviD to do a 'fast' one-pass by switching off GMC, VHQ, chroma ME, turning ME search to 5, but leaving on Trellis and Adaptive Quantization - this should give quite an accurate guess at the final filesize but much quicker.

babyray-uk
10th February 2005, 16:41
@ stephanV

Thats a very good point :) and I will start doing it that way round if it turns out 2 pass encodes for quality based encodes is the way to go...


@ Teegedeck

I want to know if I should bother doing a 1st pass at all when doing quality based encodes, and if a 1 pass encode will give me the same quality as a 2 pass encode, if I don't mind not hitting an excat file size but I don't want to encode at Quant 2 and how I work out what quant I do enocode at based on percentage i.e. 80% = Quant 3

Hope that makes sense :)

BabyRaY

jonny
14th February 2005, 11:43
If you don't care too much about filesize, fixed quant encode is better than 2 pass

http://forum.doom9.org/showthread.php?s=&threadid=69457
from sysKin:


The quant distribution from 2-pass is definitely not better than constant quant - it's just more random and imprecise. I doubt you get a better picture by artificially introducing quantizer fluctuations...


... don't overestimate 2-pass encoding. It doesn't know what bitrate scenes need. It just tries to achive constant quant AND desired bitrate, which is simply more difficulat than constant quant alone.


defining:
p = target_size / quant_2_size

you can use:

average_quant = 2 / p

so, for 80% you have an average quant of 2.5 (this is an approximation but should give you an idea of what the size/quant relation is)

babyray-uk
15th February 2005, 20:41
Thanks Jonny

That is excatly the info I wanted :)

I find it pretty intresting that we are almost saying single pass encode is "better" than a 2 pass encode...

All very very intresting :)

Will do some tests and report back my finding now I have the quality forumula :)

Speak Soon

BabyRaY