rand-o-mat,  software

Predicting File Size of MP3s (and others)

Here’s the question: How do you calculate the file size given bitrate and track length?

First off,  Google’s search engine includes a converter for this. Just search on the product of length and bitrate. For example: “4.12 minutes*201kbps” click to run (answer is provided in MB. I love Google).

I was curious about the relationship between the two today, so after a little digging I found the answer, which in retrospect is fairly obvious.

When you rip a CD (or encode a Wave into an mp3), you’re given a choice of bitrate. The higher its number, the better the quality and the bigger the file. Bitrate is given in kbps. This translates quite literally into the number of kilobits per second required to create a file of the encoded music. This is the same regardless of the encoding type: mp3, aac, wav, aiff, etc.

Now a kilobit is 1/8th of a kilobyte (8 bits in a byte), so the number of kilobytes is simply:

$KB = 1/8*(time * bitrate)$

To convert to MB, divide by 1024, or (time*bitrate)/8192. That’s your formula,

$ size = (time*bitrate)/8192 $

Example: how big is a file 4m 12 sec long encoded using a bitrate of 201kbps?

$ S= (252 s * 201 kb/s)*(1Kb/8kb) =
6.33KB*(1MB/1024KB)= 6.06MB $

Similarly, a WAVE will chew file space at 1411.2 kbps. So, a 10 minute WAVE-encoded file will require:

$1/8*((10*60*1411.2))/1024 = 103MB$.

Likewise, a 73 minutes of music at CD quality (the maximum CD length, more or less) will require 750MB of space (the maximum on most CDs, more or less).

All of this assumes Constant Bitrate (CBR). Most encoded is done using variable bitrate (VBR) these days. The difference will be small though since VBR is an average rate.

I hope you feel more complete knowing this. I know I do.

2021 update to this very old post: The same rules apply to video encoding!

3 Comments

  • Randy

    But what about compression? Doesn’t MP3 use a lossy compression that cuts out sound data that isn’t perceptible?

    Wouldn’t that effect file size?

  • Fauxmat

    Each bitrate is like a fixed-sized hole with stuff flowing through it. The file is the bucket underneath. The amount of stuff collected in the bucket for a given time period is the same no matter what’s flowing out. MP3’s are like cheap wine at a convenience store. AAC’s are the stuff you get in the nicer stores.

    That is, the file size for a given bitrate is the same regardless of the compression algorithm. A five minute 128kpbs MP3 will be the same size as a five minute 128kbps AAC. The AAC will sound better though.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.