Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 ASP

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th January 2003, 03:05   #21  |  Link
?¿öM¿?
Delphi Guru
 
Join Date: Nov 2002
Location: Narnia
Posts: 62
The RCa period is the user defined average bitrate period. If you have a clip that is 120000 frames long and you give the codec a bitrate of 1200 and an RCa of 60000, the bitrate will average out to roughly 1200 in each half of the movie. If you give it RCa 2000, then bitrate will average out to 1200 in each 2000 frames.

This is why you tend to get lower quantizer values at the end of an RCa period, the codec under compensates for bitrate distribution and usually has an excess to get rid of at the end of the period. A file that is a bit too small is better than a bit too big. Theoretically on a 2pass encode, this shouldn't happen as the reason for a 2pass encode is to get a near perfect distribution of bits within the RCa. In practice this doesn't seem to be the case. It still seems to have lower quantizer values at the end of the RCa, but it isn't as dramatic as 1pass which means that the distribution of bits is better. The RCa when used in 2pass is for allowing the codec the biggest period for allocating bits and not forcing it to spend them in the wrong places as a low RCa will do. You get close to your desired file size using 1/2 total frames because as the RCa will only roughly come out at the average bits, it is usually less, the accumulation of the little bitrate underrun errors is less as there is only two of them. If you use 2000RCa with a 120000 clip, there will be 60 of them.

On a one pass encode, you use the RCa to force bitrate spending(or not). On a low motion movie, using a low RCa(500-1000) will produce better results as the codec spends bits faster as the end of the RCa period is so much closer. Often the RCa period will only have 2-4 I frames and the rest are P&B(in lowmotion). This means that as there are fewer bits needing to be spent, it will lower the quantizer to get a better image to use the bits instead of conserving them. However, the moment fastmotion comes in, the codec freaks out because bits are being spent rapidly and it has little time to average them out. It then increases the quantizer value and begins to throw P&B frames where it shouldn't in order to conserve bits and the result is incredibly ugly macroblocking.

(FastMotion definition: The more pixels that change colour from frame to frame and the bigger the colour change, the faster the motion) In movies with lots of fast motion and an RCa period of 4000-6000, the best results will be achieved. The codec will hold off on increasing the quantizer early in the RCaPeriod during fast motion as it sees that it has alot of frames left before it needs to achieve its average bitrate, so it will wait and see what happens. However, when it comes to a low motion area where it could easily spend bits and throw low the quantizers around willy nilly, it won't because it doesn't want to spend bits early in the RCa Period, resulting in poor quality low motion scenes.

Of course when you are using stupidly high bitrates, the RCa Period tends to become moot as the codec has heaps of bits to plaster all over the place . It's effects will become less and less, the higher the bitrate.

I will at some date do extensive testing of the Rate Control Averaging Period on 2pass, right after I finish shooting holes in WM9series .
__________________
A computer is a device for rapidly creating highly accurate errors.

Last edited by ?¿öM¿?; 11th January 2003 at 03:16.
?¿öM¿? is offline   Reply With Quote
Old 11th January 2003, 03:25   #22  |  Link
bkam
Registered User
 
bkam's Avatar
 
Join Date: Nov 2002
Location: London
Posts: 115
@?¿öM¿?:
Thank you for your thorough and informative response.

However, I still have a few questions. I now understand the nature of the averaging period much better. But I do not understand, if this is the case, why you would not just want the 1200 bitrate you mentioned to be distributed among all 120000 frames at once. In other words, why not allow the codec to look at the whole movie and judge the distribution of bitrate over the whole thing?

I understand what you say with low motion, that setting it low will force it to use bits towards the end. Is this to say that the codec will reduce quality in low motion scenes disproportionately? What I mean is, it should be fine if you set a large RCa and then it sees a low motion scene and proportionately reduces the bitrate (because low motion requires less bits than high motion, so in theory it's the same quality). But I think what you are saying is that the codec will give even fewer than is necessary and decrease the quality in these scenes?

It seems to me, if the RCa has no upper limit and the codec is "smart" then why not set RCa to half the movie, or all of it? I can only infer that the codec is smart, but by limiting the size it has to average, you can more accurately assign bits. I would appreciate confirmation (or negation) of this inference.
bkam is offline   Reply With Quote
Old 11th January 2003, 12:20   #23  |  Link
cordraconis
Lurker by lack of time
 
Join Date: Dec 2001
Location: Belgium, Zele
Posts: 90
I'm in the middle of an exam period, so this thread doesn't completely "penetrate" my tired brains But here is a good suggestion for the persons who do have time for this:
- If I'm correct, then putting the RCa to the maximum ammount of frames, results in undersized files.
- If you run a compressibility test, and it's too high, you also risk undersized files.
- What if you use a DivxEnc compressibility test, and use the percentage (and therefore a number that represents the ammount of HM-scenes) as an Empirical Law to find the optimal amount of frames? (lots of testing required ofcourse, but if you can first agree on a rule op thumb ... I suggest you take the percentage above 75%, double it, and then use that percentage to reduce the percentage-of-frames (which is standard on 50%)

This means: Comp Check is 100% --> +25% Diff. compared to 75% --> 50% Standard minus (2*25% Diff.) is 0% RCa --> One frame RCa (Makes sense since compressibility is 100% !!!)

Or Comp check is 50% --> -25% Diff. compared to 75% --> 50% Std. plus (2*25% Diff.) is 100% RCa --> The codec should use *All* the frames to distribute the bits as efficiëntly as possible. (Something like a 1-pass encode, with the quality parameter according to the desired bitrate/filesize).

I'm a Chemist and exact mathematics are *not* my style, but I love "real" laws that are not exact, but good enough for reality. This is just a suggestion from me, if anybody has better "values" for the above (like for example bias everything on 60% in stead of 75%) then go ahead.
__________________
"the Word Wide Web is a web like any other: either you get caught in it, or you learn to walk on it like a spider. In the future, I'd like to be somewhere on top of the food chain. " -- Cordraconis
cordraconis is offline   Reply With Quote
Old 11th January 2003, 20:15   #24  |  Link
bkam
Registered User
 
bkam's Avatar
 
Join Date: Nov 2002
Location: London
Posts: 115
@cordraconis:
Interesting idea. I thought I'd simplify the expression so it's easier for anybody who wants to test it..

Let x be the compressibility test value.
So the the expression to get the % above 75 is x - 75.
You say to double it, so 2(x - 75)
You say to reduce the standard 505 by this.
Therefore 50 - 2(x - 75).
This simplifies to 50 - 2x + 150 = 200 - 2x.

So you can use 200-2x, where x is your compressibility test. To use your examples, a test of 100% = 200 - 2(100) = 0 and a test of 50% = 200 - 2(50) = 100%. That makes the "standard" 50% RCa period happen at 75%.

I'm not sure if this works, particularly because certain people seem to think that over half frames for RCa period may not be smart (dTb for example). I'm not sure which is true but
bkam is offline   Reply With Quote
Old 13th January 2003, 21:50   #25  |  Link
SpEeDaMiGo
Registered User
 
Join Date: Dec 2001
Posts: 66
@bkam:
i won't comment on all your maths, let me just tell you this: if you want (nearly) perfect bitrate distribution then go for divx3 sbc (or xvid as well, i think). i consider divx5 2-pass mode as kinda pseudo, cause, as you mentioned, it doesn't really analyse the movie as a whole. with divx3 sbc you perform a first pass which is bitrate-independent, cause it just analyses all the frames without already allocating bits to it (divx5 somehow does), which is then done "before" the second pass and which can be tweaked almost infinitely and which provides a real control over the bitrate allocation, whereas divx5 is a mix of 1-pass and divx3 sbc. i'm no expert on this, but that's what i understand of the whole matter. well, to sum up: you won't get perfect bitrate allocation with divx5 and even tweaking the averaging period value will always have some drawbacks concerning either size predictability, slow or fast motion scenes.
hope, this gives you some rough idea.
SpEeDaMiGo is offline   Reply With Quote
Old 14th January 2003, 17:36   #26  |  Link
ohliuv
Registered User
 
Join Date: Oct 2001
Location: Belgium
Posts: 113
If I remember correct, someone mentioned in the forum that 50% RC significantly improves the overall result of hard to compress movies.
Also remember that some time ago I experimented with SPR (full encode), and the result looked better with 50% RC.
ohliuv is offline   Reply With Quote
Old 15th January 2003, 02:55   #27  |  Link
UGAthecat
slacker - lurker
 
Join Date: Jun 2002
Location: at the corner of procrastination and indecision
Posts: 80
I thought the main reason people were using 50% for the RC avg period was because when splitting one avi for 2cd rip, if you use 100% of the frames you can't always split dead center in the movie.
so, when you use 50% of the frames as your RC avg period, the first half and second half of the movie should be the exact same size, allowing you to cut the movie at whatever frame # is in the middle of the movie.
(IE: 1cd rip, use 100% for RCa, 2cds use 50%, 3 cds try 33.3...%)
also, if you calculate the RC avg period this way, you use one formula to determine both the RCa, and the frame numbers you split your file on if aiming for more than one disc.
UGAthecat is offline   Reply With Quote
Old 15th January 2003, 05:05   #28  |  Link
bkam
Registered User
 
bkam's Avatar
 
Join Date: Nov 2002
Location: London
Posts: 115
Does that mean that you automatically have a keyframe every RCa period number of frames?
bkam is offline   Reply With Quote
Old 20th January 2003, 12:11   #29  |  Link
drizztcanrender
Registered User
 
drizztcanrender's Avatar
 
Join Date: Aug 2002
Location: Athens,Greece
Posts: 33
Quote:
Does that mean that you automatically have a keyframe every RCa period number of frames?
That sounds possible.It might put keyframes at the beggining and at the end to create boundaries which will help it analyze.But i haven't a clue if it is really true.


originally posted by SpEeDaMiGo

Quote:
i won't comment on all your maths, let me just tell you this: if you want (nearly) perfect bitrate distribution then go for divx3 sbc (or xvid as well, i think). i consider divx5 2-pass mode as kinda pseudo, cause, as you mentioned, it doesn't really analyse the movie as a whole. with divx3 sbc you perform a first pass which is bitrate-independent, cause it just analyses all the frames without already allocating bits to it (divx5 somehow does), which is then done "before" the second pass and which can be tweaked almost infinitely and which provides a real control over the bitrate allocation, whereas divx5 is a mix of 1-pass and divx3 sbc. i'm no expert on this, but that's what i understand of the whole matter. well, to sum up: you won't get perfect bitrate allocation with divx5 and even tweaking the averaging period value will always have some drawbacks concerning either size predictability, slow or fast motion scenes.
I will have to disagree,it's not pseudo at all.Maybe you are talking about divx4(?).The first pass of divx5 is done with quant 2 and it is bitrate independent.It's job is to analyse every frame of the movie and then store the quant values of every frame in the .log file and the motion estimation values in the .bin file.Then in the second pass the codec just uses all those informations and to encode the movie.
So i would say the divx5's 2-pass method is better than sbc.

I have a suggestion for you guys trying to test the rc averaging period.You can try this,although i'm not sure how much it will help. Try to do some 2-pass encodes of the same clip,with the same values for the codec options and changing every time only the rc avraging period.Then make a program that takes the quant values from a .log file and create graphs to see if there is any difference.You should be able to see clearer quant distribution in a graph.Just a thought,i may be terribly wrong but i am tired so...

See ya...
drizztcanrender is offline   Reply With Quote
Old 20th January 2003, 12:53   #30  |  Link
jonny
Registered User
 
jonny's Avatar
 
Join Date: Feb 2002
Location: Italy
Posts: 876
Quote:
The first pass of divx5 is done with quant 2 and it is bitrate independent
Sorry, it's not correct, divx5 first pass is done using the bitrate you specify (thats why you can't change too much to bitrate from the first to the second pass)
jonny is offline   Reply With Quote
Old 20th January 2003, 13:41   #31  |  Link
theReal
Piper at theGates of Dawn
 
theReal's Avatar
 
Join Date: Nov 2001
Posts: 2,136
Quote:
Originally posted by jonny
Sorry, it's not correct, divx5 first pass is done using the bitrate you specify (thats why you can't change too much to bitrate from the first to the second pass)
Yep. I guess drizztcanrender you were thinking about the Gknot compress test. Gknot sets quant max=2 and quant min=2 for the compress test first pass.

There have been attempts of changing the Divx 4/5 1st pass log with a tool called Morphix. The results were not really worthwile, as far as I can remember because nobody except the Divx people know exactly how the log is used for determining the second pass quantizers (and they won't tell, obviously...)
__________________
"Under a government which imprisons unjustly, the true place for a just man is also a prison"
Henry David Thoreau, On the duty of civil disobedience, 1849
theReal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.