Development

How to calculate video bitrate from video size and length

Manually calculate the bitrate of a video from its file size and length. This can be done for both Megabits per second and Kilobits per second.

Bitrate is the number of bits processed per specified unit of time. The more per time means more data is being sent. For video, this means the higher the bitrate the more detail being processed during the time frame.

Bytes to Bits

Filesize is stated in Bytes whilst video is Bits. There are 8 Megabits to a Megabyte so to convert the video size into Bits you will have to multiply the size in Megabytes by 8.

You now have Megabits, to get the Megabits per second divide by the length of the video in seconds.

(size * 8) / length

This will give the bitrate reading as Megabits per second (Mbps).

As Kilobits per second

If you want the bitrate to be in Kilobits per second (Kbps) multiple this value by 1000:

((size * 8) / length) * 1000

An example

A short clip that is 12.5 Megabytes in size and 18 seconds long:

(12.5 * 8) / 18

This equals 5.55, meaning 5.55 megabits per second. To get this as kilobits per second multiple it by 1000.

Therefore the clip is 5,555.55kbps.

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

1 year ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

1 year ago

FTP getting array of file details such as size using PHP

Using FTP and PHP to get an array of file details such as size and…

2 years ago

Creating Laravel form requests

Creating and using Laravel form requests to create cleaner code, separation and reusability for your…

2 years ago

Improving the default Laravel login and register views

Improving the default Laravel login and register views in such a simple manner but making…

2 years ago

Laravel validation for checking if value exists in the database

Laravel validation for checking if a field value exists in the database. The validation rule…

2 years ago