# Calculating bandwidth math

I think I'm having a pretty fundamental problem in calculating bandwidth math.

I work in streaming video and I often have clients asking me the famous question: "How many streams can I push at once?"

My response is invariably the same:

Let's say you have a 1,024 kilo-bit per second stream. It's unlikely, as that's an extremely high-quality HD stream. In any case, if you have a 100 mega-bit per second link, that means that by simple math, you should be able to push out 100 of these extremely high-quality streams concurrently, theoretically.

...to which I always receive a response like "Only 100 streams!?!?!"

I don't know how to reply. Is my math accurate? Clients in the wild often see much higher concurrent users than this with high-quality streams. Am I missing something in my math?

-
Are you sure you are not mixing up the rates of multi-media encoding with the rates for network throughput? – Zoredache Nov 9 '11 at 8:04
Yep! probably more like 96 streams. Don't forget protocol overheads and other factors that come into play like network load between you and the client (which actually can help you server more streams at a lower data rate for each one). – Matt Mar 6 '12 at 5:33

Technically, given the units in your question your math is wrong. However, it is more semantically wrong as it could be construed as right depending on how one defines the units.

The big confusion comes down to the unit being used. A kilobit versus a kibibit. A megabit versus a mebibit.

Additionally, I am going to assume on the wire data rates for the stream. If your media stream -- what the encoder is outputting, is 1,024 kilobits per second the on the wire data rate (RTP, UDP, IP, Ethernet overhead) will be larger than 1,024 kilobits per second. You must take into account overhead if you want to be exact in the real world. However, the example below is to illustrate the math regardless of encoder output rate.

For our example, I assume the on the wire data rate is 1,024 kilobits per second, meaning encoder output is less than 1,024 kilobits per second.

A 1,024 kilobit per second on the wire data rate is 1,024,000 bits per second. A 100 megabit per second link is 100,000,000 bits per second.

100,000,000 bps / 1,024,000 bps yields 97 possible "streams/data rates" of 1,024 kilobits per second on a 100 megabit link.

Like my physics teacher always stammered: Units! Units! Units!

-
I think the point is, he's suprised that a 100Mbit/s link is only going to give only around 100 streams.. actually, likely less due to overheads. – Matt Mar 6 '12 at 5:33

Nope, your math is accurate. 1024 kilobits is one megabit. Or rather, 1024 kibibits is one mebibit. But yes, 1 mebibit is a lot of bandwidth for a single stream.

-

Your math is close enough. The reason people push more streams in the wild is likely because some of the clients aren't actually keeping up with the streams. If your clients provide packet reception reports, you should find that the average number of bytes received by clients per second simply cannot exceed the number of bytes the outbound line can hold.

-