Video bitrate and file size calculation
Solution 1
You have the bitrate and the length, so you can simply multiply them together:
24 MBPS * 2 hours * 60 minutes / hour * 60 seconds / minute = 172,800 MB
If MB in your case is "Megabits" and not "MegaBytes", then divide by 8 to get 21,600 MegaBytes or ~21.6 GB.
Solution 2
I did it in a different way. I figured out how to calculate the bitrate per size of picture to always get the best for a 2 hour movie.
frames per sec. -30
res.width -1920
res.height -1080
Gop size -12
frame/sec by Gopsize
(30/12=2,5)
pixels in 1 frame
(1920*1080=2.073.600)
pixels in frame/sec
(2.073.600*30=62.208.000)
bitrate max needed
(62.208.000/2,5=24.883.200)
-24000 - 24Mb/sbitrate with 70% loses
(24.883.200/0,7=17.418.240)
- 17000 - 17Mb/s For 720i with loses 70% and will give a size of file equalling 10Gbfor losses of 40% give 4Gb and screens with a res of 720-480 and an aspect ratio of 3/4, this will give size 3,7Gb for 70% and 1,4Gb for 40%
Solution 3
Here are two popular online services to calculate a recommended bitrate based on video dimensions and FPS
https://streamfrogs.com/bitrate-calculator (for twitch)
By sheer guessing and blessing the formula they are using is
(width x height) / 1000 * fps * bits per pixel
where bits per pixel (BPP)
is one of the following values (or any value in the range 0.06 and 0.16)
0.06 (lowest quality allowed by twitch)
0.08 (the bitratecalc "low" quality approximately)
0.1 (recommended by twitch - the sweet spot)
0.15 (the bitratecalc "high" quality exactly)
0.16 (highest quality allowed by twitch)
There is a trade off here. If BPP is too low, quality will be poor. If BPP is too high, you will get too much buffering. How I worked this out I don't know - thanks to J-e^s^u-s my King for the assist :D
Based on
And applying this formula, it appears Apple use a BPP of approximately 0.1 (low) and 0.13 (high)
Note that twitch recommends bitrate should not exceed 6000kbps although they allow 8500kbps in some circumstances
Solution 4
For audio file: Size of file (bit) = bit_depth (b) * sample_rate (hz) * number_of_channel * time (second)
For video file: File Size (bit) = Frames per Second (fps) * Pixels per Frame (=width*high) * Bit depth (b) * Time (second)
Peter
Updated on December 22, 2021Comments
-
Peter over 2 years
Folks,
I am trying to understand the relationship between video bitrate, image size, codec, and the file size. For example, if I have a movie that has an image of 1920*1080 pixels, the bitrate is 24 MBPS, the length is 2 hours and the codec used is H.264, how can I approximate the file size?
We can ignore audio for the moment.
Any pointer would be appreciated.
Regards,
Peter -
Peter over 12 yearsThank you for your help. That was indeed my initial calculation but what I failed to understand is how the codec fits into this equation. I would imagine an encoder such as H.264 is better at compression compared to others. I heard MJPEG2000 is even better in compression. The other thing that I don't understand is how the initial size of the movie comes into picture. I would imagine 1920x1080 size would take more space compared to 720p.
-
user1118321 over 12 yearsWell that's going to depend on how you tell the compressor to do its job, and the content of the video. If you tell the compressor to use 24 MBPS for your 720p footage, you end up with a file the same size . If your frame size is smaller, you can usually turn down that 24 MBPS to something equally smaller and get the same quality level. Since 1920x1080 is about double the area of 1280x720, you could compress your 720p footage to 12 MBPS and get roughly the same quality.
-
user1118321 over 12 yearsBy the way, if this answer was useful, please check the green check mark on the left!
-
Zettt over 7 yearsReading this, I actually think "loss of 70%" is incorrect. It's the other way around, 30% loss. In your example a higher loss results in smaller file size, which can't be true.
-
Eugene Alexeev about 6 yearsIt doesn't seem right. For example, if gop size is 2 (every second frame is key frame), it will be 30/2 = 15. ANd it will actually produce less bit-rate than it's for gop size of 12. Am I missing something?