Skip to content

AVC / H.264

currentMigrated from docs/video/AVC.mdx at 37c3317fd058; modified for Encode Wiki · CC BY-SA 4.0

H.264, also called Advanced Video Coding (AVC) or MPEG-4 Part 10, was developed jointly by ITU-T and ISO/IEC MPEG and first published in 2003. It is published as ITU-T H.264 and ISO/IEC 14496-10; the current ITU-T edition is from June 2026.

H.264 is still the most compatible video format there is. Every browser, phone, TV, game console, editing application and hardware video block from the last fifteen years decodes 8-bit 4:2:0 H.264. Newer codecs (HEVC, VP9, AV1) need substantially less bitrate for the same quality, but none of them plays everywhere.

  • Compatibility. The fallback rendition in any streaming ladder, and the safe choice for files sent to people whose devices you don’t know.
  • Live streaming and recording where hardware encoders and low-latency decoders matter more than bitrate.
  • Low-effort workflows. x264 is mature, fast and well understood; at high bitrates the efficiency gap to newer codecs narrows.

For new delivery where size matters and AV1 or HEVC decode is available, use those instead.

ProfileBit depthChromaWhat it adds and where it plays
Constrained Baseline84:2:0No B-frames, no CABAC. Old phones, WebRTC (mandatory there, with VP8)
Main84:2:0B-frames, CABAC, weighted prediction, interlace. Broadcast and older devices
High84:2:0, monochrome8×8 transform and custom quantisation matrices. The normal delivery profile; plays everywhere
High 108–104:2:0, monochrome10-bit. Rarely hardware-decoded
High 4:2:28–10up to 4:2:2Professional and broadcast contribution
High 4:4:4 Predictive8–14up to 4:4:44:4:4, RGB coding and lossless mode. Software decode only on most devices

The standard also defines Baseline and Extended profiles, intra-only variants of the High profiles, and the scalable (SVC) and multiview (MVC, used for 3D Blu-ray) extensions.

10-bit H.264 (High 10, often called “Hi10P”) was popular in anime encoding because it reduces banding, but almost no hardware decoders support it, so it plays only in software players. NVIDIA’s RTX 50 (Blackwell) GPUs are a recent exception for H.264 4:2:2 decode and encode; most other hardware stops at 8-bit 4:2:0.

Levels limit the decoder workload: frame size in macroblocks, macroblocks per second, bitrate and decoded-picture buffer size. They run from 1 to 6.2. Common ones:

LevelTypical maximum
3.1720p30
4.01080p30 (20 Mbit/s Main)
4.11080p30 (50 Mbit/s Main)
4.21080p60
5.12160p30
5.22160p60

The decoded-picture buffer limit means that the number of reference frames allowed falls as resolution rises within a level. x264 picks the level automatically from the resolution, frame rate, reference count and VBV settings. When a device needs a specific level, set it (-level 4.1 in FFmpeg, --level 4.1 in x264). Both lower the reference count to fit the level’s buffer, but neither enforces the bitrate limit: x264 only warns. Set -maxrate/-bufsize (--vbv-maxrate/--vbv-bufsize) to the level’s or the device’s limits as well.

H.264 introduced most of the ideas later codecs refined:

  • 16×16 macroblocks, split into partitions down to 4×4 for motion compensation, with quarter-pel motion vectors.
  • Multiple reference frames (up to 16) and B-frames that can themselves be used as references (B-pyramid).
  • Weighted prediction, which helps with fades.
  • 4×4 integer transforms, plus 8×8 in High profile.
  • Two entropy coders: CAVLC, and the more efficient CABAC (Main profile and above).
  • An in-loop deblocking filter.
  • Field and frame coding for interlaced video (PAFF and MBAFF).
H.264 implementations
RelationshipProject or formatEvidence and scopeStatus
Implements byx264 0480cb05fa18x264 is VideoLAN's H.264/AVC software encoder.Scope: Encoder · Sources: x264 source repository and license, ITU-T H.264 — Advanced video coding for generic audiovisual servicesDocumented
  • x264 is the reference point for H.264 quality and the encoder to use for software encoding. It is GPL-licensed, with commercial licenses available.
  • OpenH264 (Cisco) encodes and decodes Constrained Baseline only and targets realtime use such as WebRTC.
  • JM is the reference software, useful for conformance work, not production.
  • Hardware encoders: NVENC, Quick Sync, AMF, VideoToolbox, MediaCodec, VA-API and Vulkan. Fast and low-power, but they need more bitrate than x264’s slower presets for the same quality.

FFmpeg’s native h264 decoder handles all the profiles in the table above in software. Hardware decode of 8-bit 4:2:0 High profile is universal.

A widely compatible file from FFmpeg:

Terminal window
ffmpeg -i input.mkv -c:v libx264 -preset slow -crf 20 -pix_fmt yuv420p -c:a aac -movflags +faststart output.mp4

-pix_fmt yuv420p matters: given RGB, 4:4:4 or 10-bit input, libx264 otherwise keeps that format and produces a High 4:4:4 Predictive or High 10 stream that browsers and phones won’t play. -movflags +faststart moves the index to the start of the file so web playback can begin before the download finishes. x264’s default CRF is 23; lower values give higher quality and larger files. See x264 for presets and tuning.

H.264 container mappings
RelationshipProject or formatEvidence and scopeStatus
Carried ByISO Base Media File FormatMP4RA registers AVC sample entries including avc1 and avc3.Scope: Container Mapping · Sources: MP4 Registration Authority codec registryRegistered
Carried ByMatroskaThe Matroska mapping uses V_MPEG4/ISO/AVC and an AVCDecoderConfigurationRecord.Scope: Container Mapping · Sources: Matroska codec mappingsDocumented
CarriageIdentifier / formNotes
MP4, MOVavc1 or avc3 sample entryavc1 keeps parameter sets in the header (most compatible); avc3 allows them in-band
MatroskaV_MPEG4/ISO/AVCConfiguration record in CodecPrivate
MPEG-TS, HLSAnnex B byte streamStart-code format; FFmpeg converts automatically when remuxing to MP4/MKV
RTP / WebRTCRFC 6184 payload formatPacketisation mode is negotiated in SDP
FLV / RTMPAVC in FLVStill the usual ingest format for many streaming platforms

Avoid AVI for H.264: it has no proper support for B-frame timestamps.

H.264 carries colour primaries, transfer characteristics and matrix coefficients in the VUI, so a 10-bit PQ or HLG stream is technically possible. In practice HDR delivery uses HEVC, AV1 or VP9, because players and devices don’t expect HDR in H.264; consumer H.264 means SDR BT.709.

H.264 is patent-encumbered. Via LA (formerly MPEG LA) runs the main patent pool covering encoders, decoders and some commercial content distribution. Many early H.264 patents have expired, but the pool still licenses the remaining ones. Cisco ships prebuilt OpenH264 binaries and pays the pool royalties for them, which is how Firefox and other open-source projects get licensed H.264 for WebRTC. x264’s GPL license covers copyright only, not patents.

  • Wrong pixel format (see the command above): RGB, 4:4:4 or 10-bit input produces streams that only software players decode.
  • Level too high for the target. Older TVs and set-top boxes may reject streams above level 4.1; set the level and VBV as described above.
  • Interlaced sources. Deinterlace before encoding for web delivery; interlaced H.264 is a broadcast format and many players display it badly.
  • High bitrates hide the codec’s age; low ones don’t. Below a few Mbit/s at 1080p, H.264 shows blocking and smearing that AV1 or HEVC avoid.