How video compression works
A minute of raw 1080p video is several gigabytes. Your phone saves it as a hundred megabytes or so. Here's where the other 97% went.
Raw video is enormous
One uncompressed 1920×1080 frame with 8-bit colour, stored the way most cameras and codecs do (4:2:0 chroma subsampling), is about 3.1 MB. At 30 frames a second that's roughly 93 MB every second, or about 5.6 GB a minute. Nobody stores video like that. A typical phone keeps the same minute in something like 100–130 MB, and a chat app shrinks it further.
Trick one: only store what changes
Most of a video frame looks like the frame before it. So encoders store a complete picture (a keyframe, or I-frame) only now and then, and describe the frames between as "take the previous frame, move these blocks here, adjust these few". Those are delta frames (P- and B-frames), and they can be a small fraction of a keyframe's size.
Keyframes and the frames in between
Tap a frame. Outlined cells are what the encoder actually has to store for it.
64 / 64
cells stored for frame 1 (keyframe: the full picture)
All 12 frames: 112 cells instead of 768 if every frame were stored whole.
The static background is stored once; afterwards only the moving ball costs anything.
Encoders are good at predicting the next frame from the last; predicting the Moon's shape a week from now is easier still once you've heard ahaboo's narrated take on why it has phases.
Trick two: throw away what you won't miss
Inside each block, the encoder converts pixels into patterns of coarse and fine detail (a transform related to the discrete cosine transform) and then rounds off the fine detail. How hard it rounds is quantisation, and it's the main lever behind quality: round gently and the file is big; round hard and textures turn to mush. Human eyes are less sensitive to colour detail than brightness detail, which is why colour is stored at quarter resolution from the start.
Trick three: pack it tightly
Finally, the leftover numbers are squeezed with entropy coding (CABAC in H.264 and H.265), which gives frequent values short codes. This part is lossless.
Why bitrate is the number that matters
When you ask for a target file size, you are really fixing the bitrate: the size divided by the length. The encoder then has to fit every keyframe, every delta and every rounded block into that budget. Spread it over too many pixels, or too much motion, and quantisation has to get brutal. That's the whole game, and it's what the calculator below lets you play with.
Where do the megabytes go?
A target size is a fixed pile of bits. Move the sliders and watch the video's share shrink.
2,459 kbps
for the picture, out of 2,667 kbps total (128 kbps audio, ~3% container overhead)
Bits per pixel per frame: 0.020
Starved. Expect smeared blocks, especially in fast motion. Drop the resolution or frame rate.
Sharpest safe choice here: 720p at 30 fps.
What newer codecs change
H.265 and AV1 use the same three tricks with more options: bigger and more flexible blocks, more prediction directions, better filters. That's how they reach similar quality at a lower bitrate, at the cost of more computing effort. Compare them on H.264 vs H.265 vs AV1, or put it to work in the compressor.
Questions people ask
How does video compression make a file smaller?
Three tricks together: it stores full pictures only occasionally (keyframes) and describes the frames in between as changes; it throws away fine detail the eye barely notices; and it packs what remains with efficient entropy coding. The bitrate setting decides how much detail survives.
Why does compressed video look blocky in fast scenes?
When most of the picture changes every frame, the "only store the changes" trick stops saving much. At a fixed bitrate the encoder has to throw away more detail, and the blocks it works in become visible.
Is compressing a video twice bad?
Each lossy re-encode discards a little more detail. Always compress from the original file where possible rather than from an already-compressed copy.
Why is a screen recording so small but a phone video so big?
A screen recording is mostly static: menus and text that don't change between frames. Phone footage has sensor noise, camera shake and movement everywhere, so almost every pixel changes all the time.