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. |
|
|
Thread Tools | Search this Thread | Display Modes |
1st June 2009, 11:29 | #1 | Link |
Registered User
Join Date: Dec 2007
Posts: 639
|
The relationship between --vbv-bufsize and --vbv-maxrate
So, after all this time, I'm not sure exactly what they mean, and how to come up with a proper bufsize.
My goal is to restrict peak bitrate to allow streaming. Does --vbv-maxrate do this? I used to think so, but someone once told me that's not exactly what it does, or that the actual bitrate also depends on the bufsize. Does --vbv-maxrate 1500 restrict the peak bitrate to 1.5Mbps? Is bufsize = the amount of bits that should be kept to assure playback? I'm very confused, so much that I'm not even sure I'm asking the right questions. Halp :< |
1st June 2009, 14:02 | #2 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Basically, it works like that: Bufsize specifies the size of the device's buffer. That buffer is filled with a constant data rate. That "input" rate equals the CD/DVD/BD read speed (or the Network bandwidth). Still the video is allowed to have a variable bitrate. So if the bitrate of the video increases over the input bitrate, then the buffer will slowly run out of data. Hence you can have only short bitrate spikes. If the bitrate of the video falls below the input bitrate, then the buffer will slowly run full. Hence you can have only short "low bitrate" periods. VBV takes care of all this! It makes sure that the buffer will never overflow nor underflow, as that would cause playback errors. Maxrate specifies the maximum bitrate that the video can ever have. I think Maxrate is independent from the current buffer filling level, but I may be wrong...
How do you com up with the correct buffer size? Well, the buffer size is defined by the device's hardware. You need to know the correct size of the individual device
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 1st June 2009 at 14:30. |
1st June 2009, 14:43 | #3 | Link |
Registered User
Join Date: Dec 2007
Posts: 639
|
So, --vbv-bufsize = [available bandwidth]. If I want to limit the bandwidth to allow streaming, the values of bufsize and maxrate should be the same, right?
The reason I think that maxrate has something to do with bufsize is that it seems that even if you specify maxrate, it's ignored unless you specify bufsize. I still don't understand completely, mainly because you say that "VBV takes care of all this", but don't explain how. Still, for my purposes, this is enough (if I got the streaming bitrate limit idea correct), since for all other purposes, you know which settings you should use because they're laid out in a spec or something. But it would be interesting to know, if you have the patience to explain or can link to some resource |
1st June 2009, 15:30 | #4 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
For example: If you have a low bandwidth, but a big buffer, you can use a video bitrate that is even lower than the available bandwidth, so the buffer will accumulate more and more data. Then after that period of "low bitrate", your video can have a bitrate spike (for a short moment) and use a bitrate much higher than the bandwidth! That's possible because we have enough data in the buffer, right before the spike. Of course we still must make sure that the buffer will never run out of data (underflow) or exceed its capacity (overflow). And that's what VBV does! So the bigger the buffer, the better for VBV, because it can allow stronger video bitrate fluctuations (which results in better quality). Anyway, the maximum bitrate fluctuation (peak bitrate) is still limited by the Maxrate parameter... Very basically, VBV keeps track of the buffer filling level. If the buffer is in danger to run out of data, then VBV forces the encoder to lower the bitrate, even if that may cause visible artifacts. This also happens in the other direction: If the buffer is in danger to overflow, VBV forces the encoder to use an even higher bitrate. In reality VBV is more complex, of course...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 1st June 2009 at 15:43. |
|
1st June 2009, 15:35 | #5 | Link | |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
That's it. Plain and simple. |
|
1st June 2009, 15:50 | #6 | Link |
Registered User
Join Date: Dec 2007
Posts: 639
|
But what LoRd_MuldeR said intrigued me. Through using the correct settings, could I make it so a user who has only 1.5Mbps of bandwidth can play a video which has large spikes (6-7.5Mbps from 1.5Mbps) (with low bitrate sections inbetween - anime) never has to wait for the video to buffer, as long as the user's bandwidth is constant?
|
1st June 2009, 15:55 | #7 | Link |
Mr. Sandman
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
|
sure. you need a larger buffer that can contain the spikes. it must be big enough to store the highest average bps (1 second samples) of the whole encoding plus a safety margin.
__________________
MPEG-4 ASP Custom Matrices: EQM V1(old), EQM AutoGK Sharpmatrix (aka EQM V2), EQM V3HR (updated 01/10/2004), EQM V3LR, EQM V3ULR (updated 04/02/2005), EQM V3UHR (updated 17/12/2004) and EQM V3EHR (updated 05/10/2004) Info about my ASP matrices. MPEG-4 AVC Custom Matrices: EQM AVC-HR Info about my AVC matrices My x264 builds. Mooo!!! |
1st June 2009, 16:06 | #8 | Link |
Registered User
Join Date: Dec 2007
Posts: 639
|
What exactly is the "highest average bps (1 second samples)"? Is that the highest peak?
Is there a way to know this, other than encoding without any VBV restrictions first? Do you know if DGAVCDec respects the bufsize of a stream when measuring the bitrate? If the peak bitrate of an encode is 7717, is --vbv-bufsize 8000 --vbv-maxrate 8000 correct? Should I specify something else for maxrate? Assuming the available bandwidth is 1.5Mbps (web streaming), that buffer will take 5 and 1/3th seconds to fill, right? Also, using those settings, during a 8Mbps spike, the video will only play for 1 second before it stops to buffer, right? In other words, the buffer has to be able to store as much data to accommodate the longest spike? Last edited by Comatose; 1st June 2009 at 16:20. |
1st June 2009, 16:07 | #9 | Link | ||
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
Quote:
http://forum.doom9.org/showthread.php?t=144409
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 1st June 2009 at 16:16. |
||
1st June 2009, 16:15 | #10 | Link | |
Registered User
Join Date: Dec 2007
Posts: 639
|
Quote:
Maybe I'll get a job in the summer, but I was planning on using that time to see how I fare with one of the x264 SoC projects >_> |
|
1st June 2009, 16:22 | #11 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
http://www.elecard.com/products/prod...reameye-tools/
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ |
|
1st June 2009, 16:39 | #13 | Link | |
Registered User
Join Date: Feb 2006
Posts: 1,076
|
Quote:
I've found this site that helps me; http://handbrake.dynaflashtech.net/c...calculator.cgi I use a buffer period of 1 second, cause i enc. mainly DIY Bluray's. Dont know the buffering period of streamed video though. Last edited by G_M_C; 1st June 2009 at 17:12. |
|
1st June 2009, 16:47 | #14 | Link |
Registered User
Join Date: Dec 2007
Posts: 639
|
That seems awesome, thanks.
With an ABR of 1.5Mbps, a 2s long peak, vbv-maxrate=4000 and vbv-bufsize=8000, it says it'll be able to withstand a 8Mbps peak for 2 seconds. But I don't understand why. My understanding is that maxrate limits the peaks, so the peak bitrate will never exceed 4Mbps with --vbv-maxrate 4000. What am I doing wrong? edit: It seems the ABR value doesn't serve a purpose other than to check abr < maxrate. edit2: And the fps setting doesn't do anything either... how reliable is this tool? :| Last edited by Comatose; 1st June 2009 at 16:50. |
1st June 2009, 16:52 | #15 | Link | |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
|
|
1st June 2009, 16:54 | #16 | Link |
Registered User
Join Date: Dec 2007
Posts: 639
|
So the maxrate is not actually the peak bitrate - as in the highest bitrate that can exist in the stream, it's merely the max bitrate that can enter the buffer.
Your previous post makes sense to me now. Anyway, the buffer will fill completely before decoding is first started, right? Last edited by Comatose; 1st June 2009 at 16:56. |
1st June 2009, 16:58 | #18 | Link |
Registered User
Join Date: Dec 2007
Posts: 639
|
Awesome, thanks. I finally understand VBV :D
edit: One last question... when x264 encodes with auto for bufsize and maxrate, can DGAVCDec, Bitrate Viewer or tools like them correctly measure the bitrate? edit2: Actually, I can use the StreamEye trial to check the peak then compare to other tools. Last edited by Comatose; 1st June 2009 at 17:05. |
1st June 2009, 17:06 | #19 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
If you don't set the VBV parameters explicitly (I think you must set both), then x264 will not use VBV at all.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ |
1st June 2009, 17:08 | #20 | Link |
Registered User
Join Date: Dec 2007
Posts: 639
|
Really? MeGUI says "(automatic)" on the buffer value, so I figured it does, but it decides on the optimal value. Kinda like B-frame mode where it'll pick between Spatial and Temporal when set to Auto.
Anyway, the goal was to find the peak bitrate so that I can re-encode with the optimal VBV settings. Strangely, neither Bitrate Viewer nor DGAVCDec report the same peak as StreamEye, though DGAVCDec is off by less than 10Kbps while Bitrate Viewer is off by more than 600Kbps. Last edited by Comatose; 1st June 2009 at 17:12. |
Thread Tools | Search this Thread |
Display Modes | |
|
|