Johnmeyer and bitrate calc

JackW wrote on 3/21/2015, 1:33 PM
A couple of weeks ago in a discussion on the Forum about bitrate for DVDs, JohnMeyer posted an excellent chart for making this calculation.

Still unanswered for me is this, however: what is, or should be, the relationship between maximum bitrate and average and minimum bitrates? In other words, if I set maximum bitrate for a 90 minute source to 6,583,000, as indicated in John's table, what determines average and minimum bitrates?

Jack

Comments

riredale wrote on 3/21/2015, 2:47 PM
No, I don't think that's correct.

You set the maximum to handle the most-difficult-to-encode parts of the video. I usually default to 9Mb/sec, which is just under the maximum limit.

You set the minimum to what, in your experience, can be tolerated by DVD players. I found in my own testing years ago that setting it too low meant some players had a hard time spinning up and supplying data fast enough when the scene was more demanding. I use a default of 1Mb/sec.

The AVERAGE bitrate is set to the capacity of the disk and the length of video. I use my own rule-of-thumb of 600 / minutes = total bitrate and then subtract how much is needed for the audio (typically 0.2Mb/sec). But John's technique should give an answer almost the same.

As the program material gets longer and longer the average will have to be lower and lower, and at some point the images will start to look blocky or grainy. Then you go to a better (read: more expensive and sophisticated) MPEG2 encoder or switch to a dual-layer DVD+R medium (lots of us here like Verbatim).
johnmeyer wrote on 3/21/2015, 3:30 PM
I apologize if I mislead anyone with that earlier post where I created a bitrate graph. The numbers I provided there are the average bitrate. This is the ONLY bitrate which determines file size.

The maximum bitrate is determined by the DVD spec itself. According to the spec (and I've seen slightly different numbers, so don't take this as 100% correct, but it is close) a DVD player must be able to sustain a total bitrate of 10.08 mbps. This total bitrate includes the video, audio, and substreams (e.g., subtitles). The video bitrate apparently also has a maximum (which is the one we're interested in for this conversation), and that is 9.8 mbps. Since AC-3 audio is usually encoded at 0.192 bps or higher (up to about 0.5 mbps), this puts a practical maximum of about 9.6 mbps, which is the default in the MPEG-2 encoder in modern versions of Vegas. To provide a little padding (because if the disc ends up with errors, the decoder might have to re-try, and the player might get behind), I usually set the maximum to about 8.6 mbps (8,600,000 in the Vegas MPG-2 Render As dialog).

I recommend to set it to that, and then use that for every single MPEG-2 encode you ever do.

For the minimum, I have read many posts suggesting that some players can stall out or get confused by a minimum that is too low. I have actually never once experienced this, nor have I seen any actual tests to confirm it. I've looked, using various utilities that report the bitrate at various points in the video file, and the bitrate usually doesn't go much below 2.0 mbps, no matter where you set the minimum. So, since it is very, very unlikely that the encoder will ever get even close the minimum I go along with what may just be superstition and set the minimum to 0.5 mbps (512,000 bps, in the Vegas dialog). It won't hurt anything to do set the minimum to this higher number.

Again, I set this minimum and use it for every single MPEG-2 encode.

The key number is the average bits per second. This is a really important number, especially if you always want to encode using the maximum number of bits so that you completely fill up a disc, but without creating a file that will be too large to fit, once authored with DVD Architect.

To do this accurately, so you never find yourself with too big a file, thus requiring that you re-encode, you really need a bitrate calculator.

After looking at many bitrate calculators, I never found one that included ALL the variables you need to consider, and also let you see the details of what makes up the final bitrate number. I liked the old Videohelp online calculator, but it was incomplete, so I created my own calculator, done as an Excel file. I've posted this before, but here it is again:

Meyer MPEG-2 DVD Bitrate Calculator

You'll see lots of information in the workbook, but I've configured it so you can only access the fields that can be changed (you can unprotect the worksheet if you really want to access all the cells).

The audio rates are shown as a drop down, so you can only set the "standard" rates. The disc size (single- or dual-layer) is also shown as a drop down, so you are forced to set exactly the correct number.

This calculator also lets you include the size of other data that you may choose to put on the disc. For instance, I often include a folder which contains still photos or documents related to the video. Before I encode the video, I go to the folder which contains all of this material, right-click on the folder, and then copy/paste the "bytes" from that dialog into the cell for "Existing Data (Bytes)."

This ability to include existing data is useful not only for that situation, but is also used if you have already encoded other titles, and now want to squeeze this new encode into whatever space will remain after those already-encoded titles are put on the DVD. Again, go to the folder which contains the existing MPEG-2 and AC-3 files, right click to get the total size, and copy/paste that size (in bytes) into the cell in this spreadsheet.

The spreadsheet does give you a maximum video data rate which is just 9.6 mbps minus the audio data rate. As I already stated, I usually enter a maximum bitrate smaller than this, about 8.6 mbps. However, your encode will probably play just fine if you use the number given by this spreadsheet. After all, Sony itself includes that higher number as it starting point.

For most projects, I enter the total duration of the video, which I get from Vegas, enter the data rate for the audio, and then read the result on the "Average Video Data Rate" line.



farss wrote on 3/21/2015, 4:30 PM
[I]"For the minimum, I have read many posts suggesting that some players can stall out or get confused by a minimum that is too low. I have actually never once experienced this, nor have I seen any actual tests to confirm it. I've looked, using various utilities that report the bitrate at various points in the video file, and the bitrate usually doesn't go much below 2.0 mbps, no matter where you set the minimum. So, since it is very, very unlikely that the encoder will ever get even close the minimum I go along with what may just be superstition and set the minimum to 0.5 mbps (512,000 bps, in the Vegas dialog). It won't hurt anything to do set the minimum to this higher number."[/I]


It's not superstition, I had it happen to me a very long time ago. Analysis with one of the bitrate graphing utilities showed a jump between two frames from the minimum to maximum at exactly the point where multiple people had reported their players where having issues.

No doubt the problem arose because the video went from generated black to what was pretty close to video noise in one frame and there was a marker at that point which would have forced the encoder to put an I frame there.

For sure with normal program content the encoder will never let the bitrate go very low, I guess you could say the problem was caused by me replacing the stage lightings "fade to black" with a noiseless Vegas generated fade to black but there's no real upside to have a low minimum bitrate anyway.

As to the general problem of working out minimum, average and maximum bitrates etc. I've been using Mark's Bitrate Calculator with never an issue, it does give a sensible ratio between the minimum and average and average and maximum bitrates plus it includes allowance for all the possible audio streams.

http://www.johncline.com/bitcalc110.zip

Bob.
JackW wrote on 3/21/2015, 5:14 PM
John, thank you for this excellent analysis and for sharing your bitrate calculator. This clears up a lot of questions I've had and provides a methodology for addressing DVD creation, which here-to-fore I've done on a pretty much "intuitive" basis, successfully some time, not so others.

Jack
johnmeyer wrote on 3/21/2015, 5:29 PM
It's not superstition, I had it happen to me a very long time ago. Analysis with one of the bitrate graphing utilities showed a jump between two frames from the minimum to maximum at exactly the point where multiple people had reported their players where having issues.Bob,

You don't happen to remember whether you were using single-pass or double-pass VBR when this big jump happened? I ask because I have confirmed (on earlier Vegas versions) that Vegas' single-pass VBR does all sorts of strange things. Since it is only making one pass, it only optimizes the bitrate within each local part of the disc. It does this because, having not made a first pass through the file, it has no idea whether material later in the video will require more or fewer bits than the overall overage. As a result, it simply does its best to add more or fewer bits based on each short (I'm guessing just a few seconds) section of video. Therefore, I wouldn't be surprised if it created some rather violent swings, in an attempt to squeeze out as many bits from some temporary lull in the action.

The other reason to use two-pass VBR is that single pass VBR often creates a file that is larger or smaller than what is predicted by the average bitrate. As has been stated hundreds of times in this forum, the ONLY thing that determines the size of a video file is the average bitrate. As long as the encoder does its job of making sure the average bitrate target it met, the video file size can be computed ahead of time with perfect precision.

farss wrote on 3/21/2015, 7:26 PM
[I]"You don't happen to remember whether you were using single-pass or double-pass VBR when this big jump happened?"[/I]

90% certain it was single pass.

As for the rest of what you say, sure single pass is very crude. I'm far from convinced that Vegas's two pass is particularly smart though. On the other hand finding the "best fit" is a non trivial coding problem that I've only briefly brushed up against. It seems best resolved by looking at standard deviation from every permutation. Such brute force code could take a very long time to run:(

Bob.
musicvid10 wrote on 3/21/2015, 7:26 PM
2 Mbps minimum all but eliminates encoder-caused blocking in ftb and shadows.
9.5 maximum should be fine for all but the oldest players.
6 Mbps average is in the range of DVD movie quality, but you can only put about 95 minutes in a 4.35 GB space.
4 Mbps average is about the crappiest I will tolerate, and motion artifacts are noticeable. That's over two hours of material..

-- And yes, 2-pass VBR esp. with motion footage. Has more headroom than CBR.

That's all just my comfort zone; YMMV.
mborkp wrote on 3/22/2015, 3:21 AM
This is excellent thread, thanks to all posters :)
Does something similar apply to BD?
Thanks
musicvid10 wrote on 3/22/2015, 9:44 AM
Not exactly. Bluray bitrates are more specific to the video codec in use.

The johnmeyer chart mentioned in the first post is here:
http://www.sonycreativesoftware.com/forums/ShowMessage.asp?ForumID=4&MessageID=918436