Calculating the optimum bitrate

Post Reply
Gorf
Advisor
Posts: 428
Joined: Tue May 31, 2005 2:46 pm
Location: Blackburn, UK

Calculating the optimum bitrate

Post by Gorf »

There's always talk of what bitrate to use, and it gets quite depressing to see "hit and miss" suggestions because it's completely unnecessary. If you have enough intelligence to work a computer, you have enough intelligence to work out your own optimal bitrate. Here's how:

Work out how much space you've got (A), in kilobits.
Work out how much video you've got (B), in seconds.
Overall average bitrate (C) = A/B
Cap C if necessary
Decide on your audio bitrate D
Average video bitrate (E) = C - D
IF E is low enough, you need to do VBR, so your maximum F is whatever you want the bitrate to peak at, minus D.

Given the bitrates you can work at, you then decide the video format you plan to use, and at the same time you need to decide the best resolution.

Practical example 1:
First off, you need to establish how much space you want the video to fill. This works for whatever digital delivery medium you're aiming for, whether it's WMV, an MPEG for emailing, DVD, blu-ray (when it comes) etc.

In this example, I'm going to use a single-layer DVD. It's a fairly simple structure, so of those 4.7 billion bytes, I'm going to allow 4% for the filesystem overhead. This DVD is for some kids, though, so I'm going to triple my usual 5% "edge allowance". This is the blank space around the edge of the disc that I leave clear to avoid the effects of fingerprints etc. 15% should do it for this one.

4.7GB is 37,600,000 kilobits (4.7GB * 8 bits in a byte * 1,000,000 kilos in a giga), which less 4% and another 15% is 30,681,600 kilobits (A) - this is the space I'm going to use on the DVD.

My feature is 101 minutes long, and my DVD will have a motion menu that loops every 3½ minutes. This is a total of 6,270 seconds (B).

This means that I need to average 4,893 kilobits per second (C) in order to fit everything on the DVD (30,681,600 / 6,270) (always round down).

I'm going to use 192 kbps AC3 (D), which leaves 4,701 kilobits per second (E) for the video. This is low enough for me to want to use two-pass VBR to get the best out of my lowish bitrate, so I'll need to work out my maximum video bitrate before encoding. As I'm using DVDR, I don't want the peak bitrate to ever go above 7,000kbps, so my max video bitrate is 6,808kbps (F) (7000-192)


Practical example 2

I want to email a 45 second WMV to a buddy, but his email address balks at emails over 10MB. Email attachments have a 33% overhead for the encoding, leaving me 6.7MB to play with. I'm going to play it safe and use 6.2 MB.

6.2MB is 49,600 kilobits (6.2 * 8 bits in a byte * 1,000 kilos in a mega), so my average bitrate needs to be 1,102kbps (49,600 / 45). I'm going to use 96kbps audio, so I can encode the video at 1,006kbps. That's actually nice and high for a WMV file, so I'm going to use a 320x240 video size.


Simple, eh?

nb For DVD I always cap the overall bitrate at 7,000kbps, and I use VBR if the average bitrate needed goes below 5,000kbps.
sjj1805
Posts: 14383
Joined: Wed Jan 26, 2005 7:20 am
operating_system: Windows XP Pro
System_Drive: C
32bit or 64bit: 32 Bit
motherboard: Equium P200-178
processor: Intel Pentium Dual-Core Processor T2080
ram: 2 GB
Video Card: Intel 945 Express
sound_card: Intel GMA 950
Hard_Drive_Capacity: 1160 GB
Location: Birmingham UK

Post by sjj1805 »

Alternatively use a bit rate calculator such as this one
http://www.videohelp.com/calc.htm

Or follow the guide here:
7th post down
http://phpbb.ulead.com.tw/EN/viewtopic.php?t=11923
Gorf
Advisor
Posts: 428
Joined: Tue May 31, 2005 2:46 pm
Location: Blackburn, UK

Post by Gorf »

sjj1805 wrote:Alternatively use a bit rate calculator such as this one
http://www.videohelp.com/calc.htm
That particular one is about the worst online bitrate calculator there is, so it's not an alternative, really. If you put in a DVD of 30 minutes, it will tell you to use a video bitrate that results in a total near the DVD maximum of 9800kbps - bad for pressed DVDs and useless for DVDRs.

It also mixes binary and decimal measuring systems - bad for newbies and experienced users alike.

There are better ones available online, or you can just make your own in excel.

sjj1805 wrote: Or follow the guide here:
7th post down
http://phpbb.ulead.com.tw/EN/viewtopic.php?t=11923
It was that guide that prompted me to start this thread in the first place, as the default settings for MF2 are wrong. As that thread is locked, I can't comment there.

Don't get me wrong - I'm all for making it simple if possible. It's just that it takes 20 seconds to work out your own bitrate with calc.exe.
rwernyei
Posts: 564
Joined: Wed Feb 09, 2005 9:35 pm

Post by rwernyei »

Very nice breakdown BUT I get different mathematical figures.

Correct: 4.7GB is 37,600,000 kilobits (4.7GB * 8 bits in a byte * 1,000,000 kilos in a giga)

Wrong: which less 4% and another 15% is 30,681,600 kilobits
37,600,000*.19(19%)=7,144,000
37,600,000-7,144,000=30,456,000

This little difference makes the rest of the calculations wrong.
Devil
Posts: 3032
Joined: Fri Mar 18, 2005 8:06 am
Location: Cyprus

Post by Devil »

37,600,000 * 0.96 * 0.85 = 30,681,600, which is what he said.

He did not say:

37,600,000 - 37,600,000 * (4 + 15)/100 = 30,456,000
[b][i][color=red]Devil[/color][/i][/b]

[size=84]P4 Core 2 Duo 2.6 GHz/Elite NVidia NF650iSLIT-A/2 Gb dual channel FSB 1333 MHz/Gainward NVidia 7300/2 x 80 Gb, 1 x 300 Gb, 1 x 200 Gb/DVCAM DRV-1000P drive/ Pan NV-DX1&-DX100/MSP8/WS2/PI11/C3D etc.[/size]
sjj1805
Posts: 14383
Joined: Wed Jan 26, 2005 7:20 am
operating_system: Windows XP Pro
System_Drive: C
32bit or 64bit: 32 Bit
motherboard: Equium P200-178
processor: Intel Pentium Dual-Core Processor T2080
ram: 2 GB
Video Card: Intel 945 Express
sound_card: Intel GMA 950
Hard_Drive_Capacity: 1160 GB
Location: Birmingham UK

Re: Calculating the optimum bitrate

Post by sjj1805 »

Gorf wrote:....If you have enough intelligence to work a computer, ....
You want to come and work here. Our workforce of over 12,000 people all have to use computers. Some of them couldn't even operate a toaster.

:D :D
rwernyei
Posts: 564
Joined: Wed Feb 09, 2005 9:35 pm

Post by rwernyei »

Devil,
I understood his method but I thought applying on the whole(19%) percent would yield a more safer number. I shouldn't have said he was wrong, when his distributive method calculates correctly. Also, I know Gorf and he is a DVD producer and knows his business.
Gorf
Advisor
Posts: 428
Joined: Tue May 31, 2005 2:46 pm
Location: Blackburn, UK

Post by Gorf »

rwernyei wrote:...Also, I know Gorf and he is a DVD producer and knows his business.
Thanks, Robert - but I'm always happy to be put right when I'm wrong and when what I'm doing is not necessarily being done the most efficient way.

In this one instance, though, I'm right. :)

The overhead (when needed - it's necessary on DVD but not all media) is taken after you decide on your available space, and part of that decision is to knock off the percentage of blank space first. This means you multiply out the two reducing factors.

It doesn't really matter though, because the overhead is really the only piece of guesswork in the whole procedure. If you put all your video assets in the same title set, there is very little overhead because the VOB files for that title set get huge. If each small asset gets its own title set, then you need to bump up the overhead. It covers things like the IFO and BUP files, and the possibility that each of these small files does not fill an allocation unit on the DVD. The more files there are, the more likelihood there is of that happening.

There's no actual "science" to working out how much overhead you need, so I vary it between 4% for single asset DVDs up to 6% for complex ones.



Now after saying all that - this is the part where I have to come clean. I don't do any of this any more. I still maintain that the "hit and miss" approach to filling DVDs is unnecessary, but there's an even esier way, if you have the necessary software, and if you are authoring to single layer discs...

Now, even though I have a single layer, I encode all my MPEGs at the maximum bitrate MSP allows (8.6 megabits/sec I think) and author up a VIDEO_TS folder with those files on the hard drive.

Then I run the whole lot through "Nero Recode" to get a new VIDEO_TS folder that will fit into 4200 MB (binary MB).

I couldn't do it the Nero way if I was authoring double layer, I'd have to use my bitbudget spreadsheet.
sjj1805
Posts: 14383
Joined: Wed Jan 26, 2005 7:20 am
operating_system: Windows XP Pro
System_Drive: C
32bit or 64bit: 32 Bit
motherboard: Equium P200-178
processor: Intel Pentium Dual-Core Processor T2080
ram: 2 GB
Video Card: Intel 945 Express
sound_card: Intel GMA 950
Hard_Drive_Capacity: 1160 GB
Location: Birmingham UK

Post by sjj1805 »

Gorf
Just had an idea :idea:
Perhaps you could create a fairly simple excel spreadsheet of your method and plonk it on the internet somewhere for our members to download. 8)
Gorf
Advisor
Posts: 428
Joined: Tue May 31, 2005 2:46 pm
Location: Blackburn, UK

Post by Gorf »

I've put the spreadsheet I used for the figures in the other thread here.

To use it, just "SL", DL" or "8cm" into the first yellow box. The space you want to allow for the filesystem overhead goes in the next yellow box, and the space you want to be left blank in the next. "Increments" allows you to change the step size of the comparison, and the first "Duration" box works as the seed.

Note that the spreadsheet is not protected, so it can be tweaked as you see fit, or if you discover any errors. The prime areas for tweaking are the Audio bitrate" and "Resolution" columns, which can be tailored to suit. For example, you might _always_ use AC3 settings of 192 (I do).

@everyone: If you download it, use it or fix any problems, let me know.
Gorf
Advisor
Posts: 428
Joined: Tue May 31, 2005 2:46 pm
Location: Blackburn, UK

Post by Gorf »

Forgot to say - it's primarily geared towards single-layer DVDs or parallel-track dual layer DVDs. If your software writes opposite-track dual-layers, the "space reserved" idea is pretty much in the hands of your burning software. I don't use DL discs, so I don't know how the layer break is handled by consumer DVD authoring systems such as DVDWS and DVDMF.

If you want to use it for the email example, just adjust the DVD capacity boxes directly, instead of having them calculated by formula. For example, for the 6.2 MB email in the example at the top of the thread, replace the formula in C2 with "=6.2 * 8000"
Post Reply