Calculating the bitrate for CLI video encode

So if you’re like me and like to make your back-up’s via cli, wether it’s in windo$$ or linux, and want to hit a specific filesize for storage/quality issues, you do need to calculate the final bitrate for inputing on your *bat or *sh file.

Most peepz i know, use an external GUI app, mostly MeGUI. So in order to keep it real and use nothing else, i found out some handy tip on mplayer‘s documentation, back when i was wanting to know how to make backups on linux.

Calculating the bitrate

If you aim at a certain size, you will have to somehow calculate the bitrate. But before that, you need to know how much space you should reserve for the audio track(s), so you should rip those first. You can compute the bitrate with the following equation:

bitrate = (target_size_in_Mbytes – sound_size_in_Mbytes) * 1024 * 1024 / length_in_secs * 8 / 1000

For instance, to squeeze a two-hour movie onto a 702MB CD, with 60MB of audio track, the video bitrate will have to be: (702 – 60) * 1024 * 1024 / (120*60) * 8 / 1000 = 740kbps

If you have trouble to calculate with precision the time in seconds please follow this link:


Calculating the bitrate for CLI video encode

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s