Quantcast To Max or Not to Max? Bit Rate, that is! - digitalFAQ.com Forums [Archives]
  #1  
12-23-2002, 05:46 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Here's another (crazy) idea, that hopefully ends just as good as the "Crap" thread, which spawned EXCELENT file prediction methods, formulas, and gizmos(sampler!) ( Thanks SabsGrip ). I was wondering if we really need the MAX values that are current in the KVCD templates. It occured to me that maybe if we have the MAX bit rate set to a value higher that what's actually needed, the encoder has to work on a wider "bandwidth", which could be non-optimal.
So here we go again
Call me crazy if you want, but here is what I'm currently trying out, and it seems to work VERY good

First download bit rate viewer from here: http://www.tecoltd.com/bitratev.htm

Now run your regular ripping, DVD2AVI, FitCD, and add SansGrip's "Sampler()" filter line to your .avs.
Now here's the fun part. Open your .avs with TMPEG, and load your favorite template. Go to Settings/Rate control, and set your MIN bit rate to 0 and your MAX bit rate to 9999 and CQ_VBR value to 100 . Yes, zero, nine thousand nine hundred and ninety nine, and one hundred. Read on. We're going to make TMPEG find some nice values for us.
Now run the encoder and make your test sample. Now take that sample and drag it to Bitrate Viewer ( Or run Bitrate viewer and open the sample file ) and note the average bit rate. Now go back to TMPEG and set your MIN bit rate to 300 ( or the MIN value that you use ) and set the MAX bit rate to the average bit rate given in bit rate viewer ( which should be below 2,500Kbps ) ( WHAT!, yes. Read on )
Now do your file prediction formulas and encode with these parameters. After you do your sample, and you calculate your final CQ_VBR value, open the new sample again with bit rate viewer. What's your peak bit rate Lower than your set MAX right ( I hear you say, HOW? WHY? )
We''ll as far as I can see, we're "tightening" the "bandwidth" we had before. For example, on the KVCD 704x480 PLUS we have set MIN=300, MAX=2,500. After I did my first sample with with the procedure above, my average was 2,060. So that's what I used for MAX bit rate. So before we had default TMPEG values of MIN=300, MAX=2,500 which is a "bandwidth" of 2,200 for CQ_VBR. Now with MIN=300 and MAX=2,060, it's only 1,769 ( 2060 - 300 ) so remember that the closer the MIN to the MAX, the closer we get to a constant bit rate curve. After viewing my final encoded sample with bit rate viewer, my average peak bit rate is 1,511Kbps with an average of 631Kbps. So for this particular movie, it would be a waste increasing MAX above this level. You could interpet this as a "Software clipper", clipping high frequencies. In reality, this would (should) cause visible macroblocks if we have a scene that requires bitrate > MAX. In reality, it doesn't reach that point And here's the proof of concept. This is a 704x480 sample from the movie K-19, which is 139 minutes long , and I encoded this sample predicted to fit on one CD-R, with audio at 112Kbps. Here's a 20 second cut out (~3.7MB ) of the .m1v file: http://www.kvcd.net/k19.m1v

Comments (ALWAYS) welcome

-kwag
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
12-23-2002, 06:56 PM
black prince black prince is offline
Free Member
 
Join Date: Jul 2002
Posts: 1,224
Thanks: 0
Thanked 0 Times in 0 Posts
Hey Kwag,

Kwag wrote:
Quote:
I was wondering if we really need the MAX values that are current in the KVCD templates. It occured to me that maybe if we have the MAX bit rate set to a value higher that what's actually needed, the encoder has to work on a wider "bandwidth", which could be non-optimal.
Then we would test for MAX bitrate using BitrateViewer to determine
the optimal MAX. How will this improve the process (i.e. quicker
encodes, better picture quality, etc.) Each KVCD template has different
settings for MIN and MAX bitrates. This would mean a test for the optimal
MAX must be found and set for the movie being tested for file size. Is
this correct?

-black prince
Reply With Quote
  #3  
12-23-2002, 07:59 PM
Racer99 Racer99 is offline
Free Member
 
Join Date: Sep 2002
Location: Massachusetts
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Now go back to TMPEG and set your MIN bit rate to 300 ( or the MIN value that you use ) and set the MAX bit rate to the average bit rate given in bit rate viewer ( which should be below 2,500Kbps )
-kwag
What if bitrate viewer shows greather than 2500? I just tested it on Weekend At Bernies and my peak was 3270 and Avg was 2720.

Also after you plugged in you max bit rate from the 1st pass you mentioned "Now do your file prediction formulas and encode with these parameters. After you do your sample, and you calculate your final CQ_VBR value". Do you do the 2nd pass with the CQ_VBR @ 100 also?

And then on the 3rd sample you would then adjust you CQ_VBR based of the file prediction forumula, correct?

Settings:
KVCDx2-CQ-704x480 Template
TMPGEnc 2.59 Plus
Source: From DVD Vob files.

Racer99
Reply With Quote
  #4  
12-23-2002, 08:43 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by black prince
Hey Kwag,

Kwag wrote:
Quote:
I was wondering if we really need the MAX values that are current in the KVCD templates. It occured to me that maybe if we have the MAX bit rate set to a value higher that what's actually needed, the encoder has to work on a wider "bandwidth", which could be non-optimal.
Then we would test for MAX bitrate using BitrateViewer to determine
the optimal MAX. How will this improve the process (i.e. quicker
encodes, better picture quality, etc.)
Better picture quality because we're using only the necessary bandwidth needed for the movie by closing the gap between MIN and MAX. So that gives the encoder a smaller range to fluctuate bit rate.
Quote:
Each KVCD template has different
settings for MIN and MAX bitrates. This would mean a test for the optimal
MAX must be found and set for the movie being tested for file size. Is
this correct?
Bingo , and you do that with only the first test sample. Then pick the average and use that as MAX.

Just look at the sample. It's from a 138 minute movie at 704x480
So now we should be able to put a ~2 hour movie on a CD-R with the quality we used to get before with only 60 minutes
Of course, that is when we brainstorm the crap out of this thread

-kwag
Reply With Quote
  #5  
12-23-2002, 08:50 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Racer99
Quote:
Originally Posted by kwag
Now go back to TMPEG and set your MIN bit rate to 300 ( or the MIN value that you use ) and set the MAX bit rate to the average bit rate given in bit rate viewer ( which should be below 2,500Kbps )
-kwag
What if bitrate viewer shows greather than 2500? I just tested it on Weekend At Bernies and my peak was 3270 and Avg was 2720.
Then if your DVD player can handle 2,720 that is what you use for MAX. If not, then set it for 2,500 which is the current MAX set on the 804x480 PLUS templates.
Quote:

Also after you plugged in you max bit rate from the 1st pass you mentioned "Now do your file prediction formulas and encode with these parameters. After you do your sample, and you calculate your final CQ_VBR value". Do you do the 2nd pass with the CQ_VBR @ 100 also?
No, you only set CQ_VBR to 100 on the first pass with MIN=0 and MAX=9999. After you find the average from this pass, then you set your MIN=300 and MAX=average found above. Then you'll get your CQ_VBR value when you run your following sample tests with prediction, as usual.
Quote:

And then on the 3rd sample you would then adjust you CQ_VBR based of the file prediction forumula, correct?
On the second run you set your CQ_VBR to ~20 or so and run prediction tests.

-kwag
Reply With Quote
  #6  
12-23-2002, 09:07 PM
Racer99 Racer99 is offline
Free Member
 
Join Date: Sep 2002
Location: Massachusetts
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
On the second run you set your CQ_VBR to ~20 or so and run prediction tests.

-kwag
Thanks, I'll give it a shot!

-Racer99
Reply With Quote
  #7  
12-23-2002, 09:09 PM
SansGrip SansGrip is offline
Free Member
 
Join Date: Nov 2002
Location: Ontario, Canada
Posts: 1,135
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Here's a 20 second cut out (~3.7MB ) of the .m1v file: http://www.kvcd.net/k19.m1v


Could you run the same test strip at 704x480 using the "normal" method and post the same section from that clip for comparison?
Reply With Quote
  #8  
12-23-2002, 09:29 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by SansGrip
Quote:
Originally Posted by kwag
Here's a 20 second cut out (~3.7MB ) of the .m1v file: http://www.kvcd.net/k19.m1v
I assume that is a good sign
Quote:

Could you run the same test strip at 704x480 using the "normal" method and post the same section from that clip for comparison?
I cut that at a random point. But I'll do it again. I was just running a test on "The Green Mile" and it gave me an average bit rate of 1,124Kbps so I was going to re-encode that again with that MAX value and prediction.
I did notice less artifacts on that 704x480 encode, compared to the one I did originally with MAX=2,500. So apparently the narower [MIN...MAX] does a better job on that. It's a shorter swing for CQ_VBR

-kwag
Reply With Quote
  #9  
12-23-2002, 10:58 PM
SansGrip SansGrip is offline
Free Member
 
Join Date: Nov 2002
Location: Ontario, Canada
Posts: 1,135
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
I assume that is a good sign
It looks good -- but I can't say how good until I see what it looks like with the same CQ_VBR and "normal" min/max .
Reply With Quote
  #10  
12-23-2002, 11:10 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by SansGrip
Quote:
Originally Posted by kwag
I assume that is a good sign
It looks good -- but I can't say how good until I see what it looks like with the same CQ_VBR and "normal" min/max .
I stopped the movie I was encoding to try this out. I'm encoding a sample with MIN=300, MAX=2,500, as usual for a 704x480 template, and another one MIN=0, MAX=2,060 ( Calculated average ) and when I get the same file size on both samples ( because CQ_VBR value will change ) I'll post both clips. I'll also check both samples with Bitrate Viewer. There should be a difference. The one of MAX=2060 should have a lower Q. If it doesn't, then this thread and idea is the real crap

Edit: My first encode is MIN=300, MAX=2,500. Then the second is MIN=300, MAX=2,060. On this second sample I have to adjust CQ_VBR to target the same size as the first sample. Leaving the same CQ_VBR as the first, produces a larger file, because CQ_VBR is closer to MAX.

-kwag
Reply With Quote
  #11  
12-24-2002, 12:59 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Well, it was a nice try
There is no visual difference when encoding with MAX=2060 or 2500.
So my theory bombed completely. TMPEG's CQ_VBR just follows the range, and adjusts it's quality internally somehow. So the MAX bit rates, even though they're above the value that would normally be reached, can be left there. So MIN and MAX are just safety borders that you should set depending on the limits of your DVD player. Now I'll dig a deep hole in the ground, and stick my head in there REAL deep, and maybe tomorrow some other ideas, less stupid than this one comes out of my (*)Head

Time to get some sleep

-kwag
Reply With Quote
  #12  
12-24-2002, 01:23 AM
SansGrip SansGrip is offline
Free Member
 
Join Date: Nov 2002
Location: Ontario, Canada
Posts: 1,135
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Edit: My first encode is MIN=300, MAX=2,500. Then the second is MIN=300, MAX=2,060. On this second sample I have to adjust CQ_VBR to target the same size as the first sample. Leaving the same CQ_VBR as the first, produces a larger file, because CQ_VBR is closer to MAX.
You get a larger file size when you reduce the max bitrate? That doesn't make sense .
Reply With Quote
  #13  
12-24-2002, 01:29 AM
SansGrip SansGrip is offline
Free Member
 
Join Date: Nov 2002
Location: Ontario, Canada
Posts: 1,135
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
There is no visual difference when encoding with MAX=2060 or 2500.
So when you reduce the max bitrate the file size increases and the quality stays the same? This sounds weird . How is the average Q level affected?

I could just try it for myself, but I'm sitting here in the family room with my laptop and playing with my new receiver .

(So I calibrated it then switched on the TV and ordered The Scorpion King on PPV -- regular Dolby Surround -- and here's an exact quote of my reaction:

Quote:


Oh



my



God

It completely blows my old receiver (a Denon 1601) out of the water. I can't wait to try the Pro Logic II-encoded version of Resident Evil .
Reply With Quote
  #14  
12-24-2002, 09:30 AM
black prince black prince is offline
Free Member
 
Join Date: Jul 2002
Posts: 1,224
Thanks: 0
Thanked 0 Times in 0 Posts
Hey Kwag,

Kwag wrote:
Quote:
Now I'll dig a deep hole in the ground, and stick my head in there REAL deep, and maybe tomorrow some other ideas, less stupid than this one comes out of my (*)Head
Keep coming up with ideas!!! If you would just stop and look at all
the great ideas, file prediction, GOP, KVCDx3, LBR, etc. They came
from trying things that others said can't work. There will be a few
ideas that don't work, but putting your head in a hole isn't one. While
your in that hole think about more compression techniques and possible
ways to enhance picture quality further

-black prince
Reply With Quote
  #15  
12-24-2002, 10:42 AM
gonzopdx gonzopdx is offline
Free Member
 
Join Date: Dec 2002
Location: Corvallis, OR
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
kwag,

i'll give it a shot when i get back home (at the 'rents house for x-mas atm).. i'm curious to see if this will work. it sounds like a very sound theory and i'd like to try it out for myself

i'm still playing with Die Another Day (218 minutes).. my last test I used the new prediction methods (which overshot the end file size by about 20 megs, but still way closer than the original method ), re-arranged my script to use a more logical ordering of the filters applied (which ended up in higher quality/lower file size in the tests) and encoded at 352x480 to see how it'd turn out (480x352 had too many artifacts).. i didn't have a chance to multiplex and burn it to check out the quality before i had to leave home, but the little bit i did check out on my pc looked pretty darn good (besides the 'softness').. if i can encode it at the original resolution of 480x480 (or higher from dvd's) with less artifacts and better usage of the bitrate, so much the better :P

how did the Q factor compare in your tests?

on another note, i tried narrowing the bitrate range by changing the minimum bitrate to 700 and leaving the max at 2500 on a test i did.. the result, which i expected to look much better, actually looked MUCH worse.. TONS of artifacts and gibs in every possible location. same test with min of 300 gave the desired results any ideas why this would happen?
Reply With Quote
  #16  
12-24-2002, 10:56 AM
ARAGORN ARAGORN is offline
Free Member
 
Join Date: Oct 2002
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Kwag!

What a work! All this topics are gonna make me crazy!!! But i like this. Great work

I've tried your new idea and it's not so bad. There's a little difference in quality but not important. On one min clip I,ve got 3MO less in the file size. I'm sure there's some improvements that can be found. Tmpgenc as so many options. Have you ever tried manual vbr? Perhaps an optimization of q matrix ? Go further.

ARAGORN


Edit: min 300 max 2500= 14,2MO min 300 max 1711=11,2

1711 is the average bitrate given by bitrate viewer.

With the same cqvbr.

ARAGORN
Reply With Quote
  #17  
12-24-2002, 11:01 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by SansGrip
You get a larger file size when you reduce the max bitrate? That doesn't make sense .
Yes it does. If you keep a constant CQ_VBR value and encode a clip with say MAX=1500 and encode the same clip at MAX=2000, the file size will be larger with MAX=1500 ONLY IF it's a low to medium material that didn't need to use more bit rate. When you increase the MAX to 2000, the Q curve is farther from MAX, and you get a smaller file size. That was my reasoning for the experiment in this section. Maybe I should take one eye out of the hole, just one eye so if it fails, I can go back quickly in the hole , and encode an action film and see if it makes a difference.
We'll see. I'll do some more tries today. I still have a feeling that this has to work. Don't know exactly why or how, but I do

-kwag
Reply With Quote
  #18  
12-24-2002, 11:15 AM
SansGrip SansGrip is offline
Free Member
 
Join Date: Nov 2002
Location: Ontario, Canada
Posts: 1,135
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
If you keep a constant CQ_VBR value and encode a clip with say MAX=1500 and encode the same clip at MAX=2000, the file size will be larger with MAX=1500 ONLY IF it's a low to medium material that didn't need to use more bit rate. When you increase the MAX to 2000, the Q curve is farther from MAX, and you get a smaller file size.
I still don't understand how that works, but I trust you . Maybe I'll run some tests of my own in a minute...
Reply With Quote
  #19  
12-24-2002, 01:07 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by SansGrip
I still don't understand how that works, but I trust you .
Thanks for the vote of confidence , but don't blaim me if it blows up
Quote:
Maybe I'll run some tests of my own in a minute...
Please do so . I'd like to know if you get the same results I get.

-kwag
Reply With Quote
  #20  
12-24-2002, 06:31 PM
jorel jorel is offline
Invalid Email / Banned / Spammer
 
Join Date: Aug 2002
Location: Brasil - MG - third stone from the sun
Posts: 5,570
Thanks: 0
Thanked 0 Times in 0 Posts
or i'm very lost or i'm talking about this in this thread:

http://www.kvcd.net/forum/viewtopic....a6aecd53b4880e

correct me if i'm wrong.
thanks!
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Frame Rate Raro Novatisisimo Convertir y Codificar Video (Español) 8 07-08-2004 10:18 PM
FRAME RATE DUVIDA JACK WADE Conversão e Codificação de Vídeo (Português) 2 05-08-2004 11:59 PM
Can't recognise frame rate? Stevis2002 Video Encoding and Conversion 14 01-22-2004 03:19 AM
HeadAC3he: What bit rate do you use for your movies? audi2honda Audio Conversion 13 08-16-2003 10:14 PM
KVCD: recommended bit rate? ak47 Video Encoding and Conversion 1 06-28-2003 02:09 PM

Thread Tools



 
All times are GMT -5. The time now is 08:48 PM  —  vBulletin © Jelsoft Enterprises Ltd