How Video Compression Works
The principles of video compression are based on reducing the amount of data while maintaining the highest possible image quality. This is done in two main ways: spatial and temporal reduction of information.
Basic Principles
Spatial data reduction is related to analyzing each individual frame. Inside a frame, there are many repetitive or similar elements — for example, large solid-colored areas or smooth color transitions. The codec uses mathematical methods (most often discrete cosine transform or, in modern variants, wavelet transform) to represent such areas more compactly.
Essentially, this is similar to JPEG compression for images: we remove redundant details that the human eye barely notices, thereby reducing the frame size.
Temporal data reduction works with a sequence of frames. In video, neighboring frames are often very similar to each other: the background remains unchanged, and only part of the objects moves.
The codec doesn't store each frame entirely but describes changes relative to the previous one.
This allows for significantly reducing the amount of information, as instead of a complete frame, it's enough to record only what has changed.
This is where two key types of frames emerge:
- Intra-frame (I-frame) — a frame encoded completely, without relying on others. It serves as a reference point and can be played separately.
- Inter-frame (P-frame, B-frame) — frames encoded based on others. P-frames use data from previous frames, while B-frames use both previous and subsequent frames simultaneously. They contain only information about differences, making them much lighter in size.
Thus, the combination of spatial and temporal data reduction allows the codec to effectively balance quality and compression ratio: inside frames, excessive detail is removed, and between frames, only changes are preserved.
The Difference Between Compressed and Uncompressed Video
Data compression is divided into two major approaches — lossy and lossless, and they are applied in different situations depending on what's more important: quality or space savings.
Lossless Compression
Preserves all source information. After decoding, the data completely matches the original, without the slightest changes. This method is used where accuracy is critical: for example, in text documents, program code, databases, or archive formats like ZIP and RAR.
In video and audio, lossless compression also occurs — for example, FLAC format for music or Apple ProRes for video — but they take up much more space and require more resources for storage and transmission.
The limitation here is obvious: files remain large, so lossless compression is applied only when quality is paramount.
Lossy Compression
Lossy compression works differently: it removes part of the information considered insignificant for human perception.
In audio, these might be sounds beyond the audible range; in images — subtle color nuances; in video — details that the eye barely distinguishes.
This approach allows for significantly reducing file sizes, but with repeated re-compression or excessive compression, quality noticeably decreases.
Lossy compression is used everywhere: H.264 or HEVC codecs are the most common.
The limitation here is that restoring the original is impossible — part of the data is lost forever.
Ultimately, the choice between these methods depends on the task: if you need to archive master recordings or store legally important documents, use lossless compression; if the priority is compactness and convenience of transmission, use lossy compression.
Efficiency of Modern Codecs
Modern codecs evolve from H.264 to more efficient H.265, VP9, AV1, and VVC. Each new step provides better quality at lower bitrate but requires more computational resources and support from devices and platforms.
Codecs
H.264 (AVC)
The most common and universal codec. It provides good quality at moderate bitrate and is supported by virtually all devices and browsers. Limitation: by modern standards, it's less efficient, especially for 4K and streaming.
H.265 (HEVC)
Successor to H.264, provides approximately twice the compression at the same quality. Used in 4K video, Blu-ray UHD, and streaming. Downside — licensing and high CPU load during encoding.
VP9
Google's development as an alternative to HEVC. Free and open, widely used on YouTube. Efficiency close to H.265, but encoding is slower.
AV1
New open standard from AOMedia consortium (Google, Netflix, Microsoft, etc.). It provides 30–40% better compression compared to VP9 and HEVC, especially for 4K and HDR. Limitation: encoding is very heavy, but hardware support is gradually appearing in graphics cards and processors.
VVC (H.266)
The latest standard developed by Fraunhofer. Promises up to 50% bitrate savings relative to HEVC at the same quality. Ideal for 8K, VR, and streaming of the future. Limitation: little hardware support yet and complex licensing.
Compression Comparison
Full HD movie (two hours)
| Codec | Bitrate (Mbps) | File Size |
|---|---|---|
| H.264 | ~9 | 9 GB |
| H.265 | ~4.5 | 4.5 GB |
| VP9 | ~5 | 5 GB |
| AV1 | ~3.5 | 3.5 GB |
| VVC | ~2.5 | 2.5 GB |
Short 4K clip (ten minutes)
| Codec | Bitrate (Mbps) | File Size |
|---|---|---|
| H.264 | ~40 | 3.5 GB |
| H.265 | ~20 | 1.7 GB |
| VP9 | ~22 | 2 GB |
| AV1 | ~12 | 1.1 GB |
| VVC | ~9 | 0.8 GB |
Online Full-HD streaming (one hour)
| Codec | Bitrate (Mbps) | File Size |
|---|---|---|
| H.264 | ~5 | 2.2 GB |
| H.265 | ~2.5 | 1.1 GB |
| VP9 | ~3 | 1.3 GB |
| AV1 | ~2 | 0.9 GB |
| VVC | ~1.5 | 0.7 GB |
The Role of Format in Video Compression
The difference in compression results from the container format is practically non-existent. The container is just a "wrapper" that combines video stream, audio stream, subtitles, and service data inside itself. It doesn't handle the compression process itself but only determines how these elements will be stored and synchronized.
Compression and video quality are determined precisely by the codec, which works with frames and sequences, reducing the amount of data. The container only "packages" the codec's output. For example, the same video stream encoded with H.265 can be saved in MP4, MKV, or MOV — and the quality and compression ratio will be identical because they depend on the codec, not the container.
The difference may only manifest in usability:
- some containers support more features (e.g., MKV easily stores multiple subtitle and audio tracks)
- others are better compatible with devices and programs (MP4 plays almost everywhere)
In other words, the container affects compatibility and functionality but not compression efficiency.