Multimedia & Machine Learning Algorithms · Multimedia Algorithms
Video Compression — Motion Estimation, I/P/B Frames & MPEG/H.264/HEVC
Explanation
Intuition — What's Special About Video?
Video is a sequence of still images (frames). A Full-HD frame (1920×1080) at ~3 bytes per pixel takes MB. At 25 fps: MB/s, GB/hour — uncompressed. The solution: exploit temporal redundancy — consecutive frames are very similar, and only changes between them need to be sent.
The Three Frame Types
| Type | Full name | Dependency | Typical size |
|---|---|---|---|
| I | Intra-coded | Fully independent | Large (~JPEG) |
| P | Predictive | Coded relative to previous I/P frame | Medium (~¼ of I) |
| B | Bidirectional | Coded relative to both previous and next frame | Small (~⅛ of I) |
GOP (Group of Pictures): A group always starting with an I-frame and containing P and B frames. Example: `IBBPBBPBBP` (GOP size = 10). Larger GOP = better compression but slower recovery after errors.
Motion Estimation
Problem: For each Macroblock ( pixels) in the current frame, find the most similar block in the reference frame.
Motion Vector (MV): Displacement from current frame to reference frame.
Block Residual:
Steps:
1. Estimation: Search for the closest block in the reference frame (using SAD, SSD, or diamond search).
2. Compensation: Subtract the predicted block from the actual block get the residual.
3. Coding: Send MV + residual (much smaller than the original block) using I/P/B-frame coding.
SAD (Sum of Absolute Differences):
Frame Order: Display vs. Coded Order
With B-frames, frame lies between and in display order — but must be decoded before . Therefore:
- Display order:
- Coded/Transmitted order:
P/I-frames come first; B-frames that reference them follow. The decoder reorders to display order.
Major Video Standards
| Standard | Year | Application scope | Relative efficiency |
|---|---|---|---|
| MPEG-1 | 1993 | VCD, up to 352×288 | Baseline (1×) |
| MPEG-2 | 1996 | DVD, broadcast HD | ~1.3× MPEG-1 |
| H.264 / AVC | 2003 | Blu-ray, YouTube, Zoom | ~2× MPEG-2 |
| HEVC / H.265 | 2013 | 4K, Netflix, HEIF | ~2× H.264 |
| AV1 | 2018 | YouTube (4K), Netflix | ~1.2–1.3× HEVC |
What improved in H.264/HEVC?
- Flexible block sizes (4×4 up to 64×64 in HEVC), not just 16×16.
- Advanced entropy coding (CABAC).
- Sophisticated Intra Prediction.
- Improved Deblocking Filters.
Interactive Visualization
Loading visualization
Worked Examples
Practice
Exercise 1 of 6
1
What is an I-frame in video compression?
★Quiz
Test your knowledge from this lesson
A mix of questions from the lesson — each attempt varies slightly
Answer at least 4 out of 5 questions correctly to pass (70%)