
The final formula to calculate how many MBs to expect after the compression is simply:ĭuration (seconds) x (Video Bitrate + Audio Bitrate) In other words: two video files compressed with the same bitrates (i.e one is HD and the other is not) will ALWAYS consume roughly the same amount of storage space. If you know the bitrate of the video and audio, as well as the duration of the file in seconds, you can accurately calculate the final file size even if you have no idea what the video resolution or playback frame rate is. Both of these parts contribute to the final video size and the only determining factor of the individual file size is a thing called “the bitrate.”īitrate is the amount of bits (8 bits = 1 byte) required per one second of a video/audio file. One file is a silent slideshow of pictures and the other is the audio to be played along with the slideshow. What sets the size of a video file?Ī video file is actually two files attached to each other, assuming that the video is not 3D and that the audio is not multi-language. Below you will find a line by line explanation of how to do that. As an obsessive optimization guru, you know that there must be a way to utilize all of the horsepower in our phones. Unfortunately, cloud service providers’ price tag for storage and bandwidth do not reflect this increase. The state of technology today means that most iPhones are more powerful than some desktop gaming computers and are also bundled with industrial-grade cameras, so the disk space a single video consumes increases tremendously every year. The more users your app has, the more bandwidth your server will require, not to mention the storage space. Or maybe your app overlays some special effects on people’s faces. Maybe your app is a video sharing platform where people showcase their talent. Skip to the end of the article if you’re just looking for code.Ĭhances are there will be a time when you’ll need to capture a video within your app, compress it to a respectable size, and then send it to your server to fulfill some feature of your app.


TLDR Skip to the “How do I compress an H264 video?” section if you already know what “bitrate” and “codec” mean. This post is brought to you by TestFairy, a mobile testing platform that helps companies streamline their mobile development process and fix bugs faster.
