How Video Compression Works

By Udit Agarwal · Updated October 17, 2026

Video compression makes a file smaller by storing most frames as changes from the frames around them and by rounding away detail you are unlikely to notice. The codec, such as H.264 or AV1, does the compressing, and the container, such as MP4 or WebM, packages the video and audio into one file. A video's size follows from its bitrate: size equals bitrate times duration, divided by 8, so a 3-minute clip at 8 megabits per second takes 180 MB. Every way of shrinking a video comes down to lowering that bitrate.

Codecs and containers are different things

A codec is the method that compresses and decompresses the pictures or the sound. A container is the file that holds the compressed streams with their timing, subtitles and metadata. The extension names the container, not the codec, so two MP4 files can behave differently: one may hold H.264 and play everywhere, the other HEVC and fail on a PC without an HEVC decoder.

Container Typical video codecs Typical audio Where it fits
MP4 H.264, H.265/HEVC, AV1 AAC Phones, TVs, chat apps, editors, the web
MOV H.264, HEVC, ProRes AAC Apple's QuickTime format, which MP4 grew out of
MKV Almost any Almost any Downloads and archives; patchy in browsers
WebM VP8, VP9, AV1 Opus, Vorbis Video on web pages

Changing only the container is quick and lossless. Changing the codec means re-encoding every frame, which takes time and costs a little quality.

The four video codecs you will meet

Codec Defined by Year Size at similar quality Notes
H.264 / AVC ITU-T H.264, ISO/IEC 14496-10 2003 Baseline Plays on practically everything
H.265 / HEVC ITU-T H.265, ISO/IEC 23008-2 2013 Often 30 to 50% smaller iPhone default; patent licensing limits support
VP9 Google 2013 Similar to HEVC Royalty-free; widely used by YouTube
AV1 Alliance for Open Media 2018 Smaller still Royalty-free; slow to encode

Newer codecs need fewer bits because they search harder for ways to predict the picture, which costs more computing time to encode and, on older devices, to play. H.264 remains the safe choice when a file must play anywhere.

How a codec squeezes video

Three ideas do most of the work:

  • Prediction between frames. Consecutive frames are mostly alike, so a complete picture, a keyframe, is stored only every so often. The frames between are described by motion vectors, saying which block moved where, plus a small correction.
  • Prediction within a frame. Each block is guessed from the pixels around it, and only the difference is kept.
  • Rounding, then packing. The leftover detail is turned into frequencies and rounded, the lossy step, then packed so common values take the fewest bits.

That is why content matters. A talking head against a plain wall needs few bits, while water, confetti, film grain and shaky footage make much bigger files at the same setting.

Bitrate and the file size formula

Bitrate is the number of bits a video uses per second, in kilobits (kbps) or megabits (Mbps). File size follows from it directly:

size in bytes = (video bitrate + audio bitrate) × duration in seconds ÷ 8

Dividing by 8 turns bits into bytes, the same conversion behind Mbps and MB/s in the internet speed test guide. The container adds a few percent at most.

Video bitrate, plus 128 kbps audio 1 minute 3 minutes 10 minutes
8 Mbps 61 MB 183 MB 610 MB
5 Mbps 38.5 MB 115 MB 385 MB
2.5 Mbps 19.7 MB 59 MB 197 MB
1 Mbps 8.5 MB 25.4 MB 85 MB

The first three rows are YouTube's recommended upload bitrates for 1080p, 720p and 480p at standard frame rates, so they describe generous quality. Audio counts too: 128 kbps adds 0.96 MB per minute.

Resolution and frame rate

Resolution sets how many pixels every frame carries:

Resolution Pixels per frame Share of 1080p
4K (3840 × 2160) 8.3 million 400%
1080p (1920 × 1080) 2.07 million 100%
720p (1280 × 720) 0.92 million 44%
480p (854 × 480) 0.41 million 20%

To judge whether a bitrate suits a resolution, use bits per pixel: the bitrate divided by width × height × frame rate. YouTube's 8 Mbps for 1080p at 30 fps gives about 0.13. ArrayKit's Video Bitrate Calculator rates around 0.1 as comfortable streaming quality for H.264 and anything under 0.02 as likely to fall apart on motion, and allows about 40 percent less for HEVC, VP9 and AV1.

Frame rate matters less than you might expect. Halving 60 fps to 30 fps does not halve the size, because each remaining frame has more change to describe; YouTube's recommendation for 1080p rises only from 8 to 12 Mbps between 30 and 60 fps.

CRF: choosing a quality instead of a size

Most encoders offer a constant quality mode called CRF (constant rate factor). You choose a quality level and the encoder spends whatever bits each scene needs, so the picture looks consistent but the file size is not known until the encode finishes.

Lower numbers mean higher quality and bigger files. On the usual H.264 scale of 0 to 51, values around 18 look practically identical to the source, 23 is a common default, and the size roughly halves for every 6 points you add. VP9 uses a scale of 0 to 63, so the same number means something different there. To land on an exact size, encoders use a target bitrate instead, worked out from the formula above.

Getting a video under 25 MB or 10 MB

Size limits are where the formula earns its keep. Gmail caps attachments at 25 MB, and some chat apps stop at 10 MB. Turn the limit into a bitrate budget, subtract the audio and see what is left per pixel:

Limit and length Bitrate left for video Bits per pixel at 1080p At 720p At 480p
25 MB, 3 minutes 983 kbps 0.016 0.036 0.080
10 MB, 1 minute 1,205 kbps 0.019 0.044 0.098
10 MB, 3 minutes 316 kbps 0.005 0.011 0.026

The figures assume 128 kbps audio, 30 fps and 1 MB = 1,000,000 bytes. A 3-minute clip in 25 MB has under 1 Mbps for the picture: at 1080p that is below the 0.02 line, so fast motion breaks into blocks, while at 480p the same bits cover a fifth of the pixels and land in the comfortable range. The longer the clip, the fewer pixels a limit can afford. Three minutes under 10 MB struggles even at 480p; dropping the audio raises the budget to 444 kbps, but trimming usually works better.

So cut what you do not need with the Video Trimmer, pick a resolution the budget can carry, compress, and leave a few percent of headroom.

Compress a video in your browser with ArrayKit

Video Compressor re-encodes one video at a time. Drop in an MP4, MOV, MKV, WebM or AVI file and choose:

  • Format: MP4, with H.264 video and AAC audio, or WebM, with VP9 video and Opus audio. The sound is re-encoded at 128 kbps in both.
  • Quality (CRF): 18 to 34 for MP4, starting at 28, or 24 to 42 for WebM, starting at 34. Lower means better quality and a bigger file.
  • Resolution: Original, 1080p, 720p or 480p. The preset sets the shorter side, keeps the proportions and never enlarges a smaller video. A horizontal 1920 × 1080 clip becomes 1280 × 720 at 720p, and a vertical 1080 × 1920 phone video becomes 720 × 1280.
  • Remove audio track, and Cap frame rate at 24 fps, which drops frames from 30 or 60 fps footage to bring it down to 24 frames per second and leaves slower footage as it is.

MP4 files are written with their index at the start, so they begin playing on a web page before they have fully downloaded. WebM usually comes out smaller but takes noticeably longer to encode.

Everything runs in your browser, and the video is not uploaded. The first run downloads the video engine, about 31 MB. There is no file-size limit, though a video over 300 MB brings a warning: the encoder works on one processor core inside a browser tab, so it is slower than desktop software and can run out of memory. Live graphs show the encoding speed and, in Chrome and Edge, memory use, and you can cancel at any point. The result shows both sizes and the percentage saved, with a preview and a download named like clip-compressed.mp4.

The compressor works by quality, not by target size. To hit a limit, find the bitrate with the Video Bitrate Calculator, choose a resolution with sensible bits per pixel, compress, and raise the CRF if the result is still too big. Split Video cuts a long recording into parts when even 480p will not fit.

Frequently asked questions

How do I compress a video without losing quality? Re-encoding always loses something, but it can be made invisible: an H.264 CRF around 18 looks practically identical to the source. Trimming unwanted parts and removing an unneeded soundtrack shrink a file without touching the picture, and Mute Video removes the sound without re-encoding.

What is the best format for compressing video? MP4 with H.264 is the safest, since it plays on practically every phone, computer, TV and app. WebM with VP9, or HEVC and AV1 where your devices support them, give smaller files at the same quality but encode more slowly and play in fewer places.

How do I get a video under 25 MB? Turn the limit into a bitrate: 25 MB over 3 minutes leaves about 1.1 Mbps in total, or roughly 980 kbps for the picture after 128 kbps of audio. That suits 480p or 720p rather than 1080p, so trim, lower the resolution and check the result.

What does CRF mean? Constant rate factor, a quality setting: the encoder keeps the visual quality steady and lets the bitrate rise and fall with the content. Lower values mean better quality and bigger files, and on the usual H.264 scale, adding 6 roughly halves the size.

Why is my compressed video bigger than the original? The original was already efficiently encoded, for example HEVC from a phone, and the new settings asked for more bits than it used. Raise the CRF or lower the resolution, and keep the original if nothing helps.

Keep going

動画圧縮

More guides

All Video tools · All guides