H.264 is a block-based hybrid video compression standard, formally ITU-T H.264 and ISO/IEC 14496-10, also known as Advanced Video Coding (AVC) or MPEG-4 Part 10. It removes spatial and temporal redundancy from moving images so that video can be stored and transmitted at a fraction of its uncompressed size, typically 100 to 1,000 times smaller, while keeping acceptable visual quality.
Published jointly by the ITU-T Video Coding Experts Group and ISO/IEC MPEG in 2003, H.264 became the most widely supported video codec in the world. Its successors, H.265 and AV1, compress more efficiently, but H.264 remains the compatibility baseline for web video, video conferencing, surveillance, Blu-ray Disc and consumer cameras because nearly every device can decode it in hardware.
How H.264 compresses video
H.264 compresses video by predicting each block of pixels from data that the decoder already has and then encoding only the prediction error, called the residual. Each frame is divided into 16×16 macroblocks, which can be split further into partitions as small as 4×4 pixels so that detailed areas receive finer prediction.
Intra prediction predicts a block from neighboring pixels in the same frame, using up to nine directional modes for 4×4 blocks. Inter prediction predicts a block from one or more reference frames through motion vectors with quarter-pixel precision, and H.264 allows up to 16 reference frames. The residual is transformed with a 4×4 or 8×8 integer transform, quantized, and entropy coded.
The following table summarizes the main coding tools and what each contributes to efficiency.
| Coding tool | What it does | Benefit |
|---|---|---|
| Variable block partitions | Splits macroblocks down to 4×4 | Follows motion edges precisely |
| Multiple reference frames | Predicts from up to 16 earlier frames | Better prediction of repeating content |
| Integer transform | Exact 4×4 or 8×8 transform | No encoder and decoder drift |
| In-loop deblocking filter | Smooths block edges before reference use | Fewer blocking artifacts |
| CABAC | Context-adaptive arithmetic entropy coding | About 10-15% smaller than CAVLC |
| Weighted prediction | Scales reference brightness | Efficient fades and flashes |
Frames are organized into a group of pictures (GOP). I-frames are coded independently, P-frames predict from earlier frames, and B-frames can predict from both earlier and later frames. An IDR frame is a special keyframe that clears the reference buffer, so a decoder can start playback there cleanly.
Profiles and levels of H.264
Profiles define which coding tools a stream may use, and levels cap the decoder workload, such as resolution, frame rate and bitrate. A decoder that supports a given profile and level is guaranteed to play any conforming stream within those limits, which is why device specifications list them explicitly, for example High Profile at Level 4.1.
| Profile | Key features | Typical use |
|---|---|---|
| Constrained Baseline | No B-frames, CAVLC only | Real-time conferencing, legacy mobile |
| Main | B-frames, CABAC, interlace | Standard-definition broadcast |
| High | Adds 8×8 transform and custom quantization | Streaming, Blu-ray, HD broadcast |
| High 10 | 10-bit samples | Higher-quality contribution and some HDR work |
| High 4:2:2 and 4:4:4 | Higher chroma resolution, up to 4:4:4 | Professional acquisition and intermediates |
Levels range from 1 to 6.2. Level 4.1 covers 1080p at 30 frames per second, Level 4.2 covers 1080p at 60, and Level 5.1 covers 2160p at 30. In practice, most consumer hardware decoders support only 8-bit 4:2:0 High Profile, so 10-bit or 4:2:2 H.264 often falls back to slower software decoding.
H.264 compared with other video codecs
H.264 trades some compression efficiency for universal compatibility and low decoding cost. Newer delivery codecs achieve the same perceived quality at lower bitrates, while intermediate codecs such as ProRes and DNxHR use intra-frame coding at much higher bitrates for easier editing.
| Codec | Bitrate for similar quality | Licensing | Main strength |
|---|---|---|---|
| H.264 (AVC) | Reference point | Patent pool, broadly licensed | Plays almost everywhere |
| H.265 (HEVC) | About 30-50% lower | Several patent pools | 4K and HDR broadcast and streaming |
| VP9 | About 30-40% lower | Royalty-free | Web video in browsers |
| AV1 | About 40-50% lower | Royalty-free | Large-scale streaming efficiency |
| ProRes, DNxHR | Several times higher | Vendor-controlled | Fast, robust editing |
These savings are approximate and depend on content, resolution and encoder quality. A well-tuned H.264 encoder can outperform a poorly tuned HEVC encoder, so comparisons are meaningful only at matched encoder effort and measured quality.
Encoding H.264 in practice
Good H.264 results depend more on rate control and encoder settings than on the standard itself, because the standard defines only the bitstream and the decoder. Software encoders such as the open-source x264 offer presets that trade encoding speed for efficiency, while hardware encoders in GPUs and phones are much faster but usually less efficient at the same bitrate.
The decision table below matches common delivery scenarios with a suitable rate-control strategy.
| Scenario | Recommended mode | Reason |
|---|---|---|
| Archive or local file | CRF about 18-23 | Constant quality, variable size |
| Adaptive streaming | Capped VBR with fixed GOP | Predictable segments and bandwidth |
| Live broadcast or contribution | CBR | Steady buffer on fixed channels |
| Video conferencing | Low-latency CBR, no B-frames | Minimal delay |
| Two-pass delivery master | Two-pass VBR | Best quality at a target size |
For streaming, a keyframe interval of about two seconds keeps segments aligned for adaptive bitrate switching. Typical bitrates for 1080p at 30 frames per second run from about 4 to 8 Mbit/s, with fast motion or film grain needing more.
Limitations and common mistakes
H.264 shows its age at high resolutions and in HDR. Its 16×16 macroblocks are small for 4K content, so it needs noticeably higher bitrates than HEVC or AV1, and 8-bit encoding of smooth gradients causes visible banding.
- Starving the bitrate produces blocking, smearing and mosquito noise around edges.
- Using long GOPs for editing makes timelines sluggish; transcode to an intermediate codec or create proxies.
- Exceeding the target level causes playback failures on devices that enforce level limits.
- Assuming H.264 means MP4 confuses a codec with a container; H.264 can also travel in MOV, MKV or MPEG-TS.
- Re-encoding repeatedly compounds generation loss; keep a high-quality master.
In everyday language
H.264 is a set of rules for shrinking video so it fits through the internet and onto small storage. Most of a video changes very little from one frame to the next. So instead of saving every picture in full, H.264 saves one complete picture. After that, it describes only what moves or changes.
Think of it as giving directions instead of sending a new map for every step. Because almost every phone, browser, television and computer understands these rules, H.264 is the safest choice when a video simply has to play everywhere.
Seen in the real world
A small marketing team publishes a two-minute product video recorded in 4K on a mirrorless camera. The camera file is 10-bit H.265 at 150 Mbit/s, which some older laptops and office browsers struggle to play, and the team needs one file that works for everyone.
The editor exports a 1080p master and encodes it with H.264 High Profile, Level 4.1, using two-pass VBR at about 6 Mbit/s, a two-second keyframe interval and AAC audio in an MP4 container. The resulting file is about 95 MB, plays smoothly on phones, tablets and corporate laptops, and uploads without being rejected by any platform. The outcome is maximum reach at modest file size, at the cost of slightly more bitrate than a newer codec would need.