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.
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).
If you want the bitrate to be in Kilobits per second (Kbps) multiple this value by 1000:
((size * 8) / length) * 1000
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.
A drained and empty Kennington reservoir images from a drone in early July 2024. The…
Merrimu Reservoir from drone. Click images to view larger.
Using FTP and PHP to get an array of file details such as size and…
Creating and using Laravel form requests to create cleaner code, separation and reusability for your…
Improving the default Laravel login and register views in such a simple manner but making…
Laravel validation for checking if a field value exists in the database. The validation rule…