Glossary
Video codec
An algorithm that compresses video frames into a compact bitstream for storage and streaming and decompresses them for playback.
A video codec is an algorithm that compresses a sequence of video frames into a compact bitstream for storage or streaming, and decompresses that bitstream back into frames for display. H.264, H.265 (HEVC), VP9, AV1 and Apple ProRes are all video codecs. Uncompressed video is enormous, so almost every video file and stream relies on a codec, and the choice affects file size, picture quality, playback compatibility, editing speed and how well computer vision and transcription systems can work with the footage.
Why video needs compression
A single frame of 1080p video has about two million pixels. Stored as raw colour values at 30 frames per second, one minute of footage would take several gigabytes. Even with chroma subsampling, which stores colour at lower resolution than brightness because the eye is less sensitive to it, raw video is far too large to stream over a home connection or store in bulk. Video codecs reduce this by factors of a hundred or more while keeping the picture acceptable to viewers.
The same split between codec and container that applies to sound, described in the entry on audio codecs, applies to video. The codec defines how pictures are encoded. The container, such as MP4, MOV, Matroska or WebM, holds the encoded video stream alongside audio streams, subtitles, chapter markers and metadata. The comparison of MP4 and MOV covers two of the most common containers, and a file’s extension or MIME type names the container rather than the codec inside it.
How video codecs work
Video codecs exploit two kinds of redundancy. Spatial redundancy exists within a single frame: large areas of sky or wall have similar colours, so the codec divides the picture into blocks, predicts each block from its neighbours, transforms the prediction error into frequency components and discards fine detail that is hard to see. Temporal redundancy exists between frames: in most footage, consecutive frames are nearly identical, so the codec describes how blocks moved since an earlier frame instead of encoding them again. This is called motion compensation, and it accounts for most of the savings.
Frames are encoded in three main types. An I-frame, or intra frame, is coded on its own like a still image and can be decoded without any other frame. A P-frame predicts from earlier frames, and a B-frame predicts from frames before and after it. A group of pictures, or GOP, starts with an I-frame followed by predicted frames. Longer GOPs give smaller files, while shorter ones make seeking faster and limit how far errors spread. Players can only start decoding cleanly at an I-frame, which is why seeking in some files jumps to the nearest keyframe and why keyframe extraction often starts from the encoder’s I-frames.
Encoders also choose how to spend bits over time. Constant bitrate keeps the data rate steady for live streaming. Variable bitrate spends more on complex scenes and less on static ones. Quality-based modes such as constant rate factor target a consistent visual quality and let the file size follow. Each codec also defines profiles and levels, which limit features and resolution so that hardware decoders in phones, televisions and browsers know what they must support.
Common video codecs
Codec | Year | Typical use | Notes |
|---|---|---|---|
MPEG-2 | 1995 | DVD, older broadcast | Large files by modern standards |
H.264 (AVC) | 2003 | Web video, cameras, conferencing | Near-universal hardware and browser support |
H.265 (HEVC) | 2013 | 4K streaming, phone cameras | Roughly half the bitrate of H.264 for similar quality; patent licensing is complex |
VP9 | 2013 | YouTube, web streaming | Royalty-free, developed by Google |
AV1 | 2018 | Streaming at scale, newer browsers | Royalty-free, from the Alliance for Open Media; slower to encode |
H.266 (VVC) | 2020 | Next-generation broadcast | Further efficiency gains, limited deployment so far |
Apple ProRes | 2007 | Editing and post-production | Intra-frame, large files, fast to edit |
Delivery codecs and editing codecs serve different needs. Delivery codecs such as H.264, HEVC and AV1 use long GOPs and heavy prediction to minimise size, which makes them efficient to stream but slower to cut and scrub in an editor. Intermediate codecs such as ProRes and DNxHR encode every frame independently at high bitrates, which uses more storage but makes editing responsive and preserves quality through multiple generations of rendering. Many production teams record or transcode to an intermediate codec for editing and export a delivery codec at the end.
Codecs, hardware and compatibility
Decoding high-resolution video in software is demanding, so devices include hardware decoders for specific codecs. H.264 decoding is available almost everywhere. HEVC is supported in most recent phones and televisions, though browser support depends on the operating system and licensing. AV1 hardware decoding has spread through newer chips, and software decoders such as dav1d handle it on older machines at a cost in battery life. Phone cameras commonly record HEVC to save space, which is one reason uploads from iPhones sometimes fail in older tools that expect H.264.
For a service that accepts uploads, compatibility problems usually show up as files that open in one player and fail in another. File type detection identifies the container from its bytes, and tools such as ffprobe or MediaInfo list the streams inside, with codec, profile, resolution, frame rate, duration and bitrate. Recording those fields at ingestion makes it easy to filter problem files later. Capture settings such as camera model and ISO are separate again: they come from metadata written by the recording device, similar to EXIF data in photographs, and are read through metadata extraction.
What codecs mean for video AI
Computer vision models work on decoded frames, so the codec matters through what it preserves. At reasonable bitrates, modern codecs keep enough detail for object detection, captioning and scene analysis. At low bitrates, fine detail disappears first: small on-screen text blurs into blocks, which hurts OCR on slides and lower thirds, and fast motion produces smearing that confuses detectors. Screen recordings with sharp text compress poorly with settings tuned for camera footage, so they benefit from higher bitrates or codecs with screen content tools.
The structure of a compressed stream is also a useful signal. Encoders tend to place I-frames at scene changes, and the size of each frame rises at cuts, so stream statistics give a cheap first pass for shot boundary detection before a learned model confirms the boundaries. Decoding every frame of a long video is expensive, so analysis pipelines usually sample frames at a fixed rate or pick representative frames per shot, then run video scene detection and video understanding models on the samples. The audio track goes through speech to text separately, after being demuxed from the container and decoded.
Variable frame rate is a quieter source of bugs. Phone recordings often vary their frame rate to save power, and a pipeline that assumes a constant rate will drift when converting frame numbers to timestamps. Using the presentation timestamps stored in the stream, rather than frame counts, keeps transcript times, scene boundaries and search results aligned.
Worked example: a product video library
An ecommerce company stores 20,000 product videos from many sources: H.264 MP4 files from its own studio, HEVC MOV files shot on phones by sellers, and a few hundred older MPEG-2 files. The figures here are illustrative. Some seller uploads fail to play on older Android devices because of the HEVC codec, and searching the library for a particular product colour or feature only works on titles.
An ingestion job records each file’s container, codec, resolution, duration and frame rate, then creates an H.264 rendition for playback while keeping the original untouched. For search, each video is split into scenes, each scene is described from sampled frames, and the narration is transcribed with timestamps. A shopper or merchandiser searching for “red trainers on a running track” now gets the scene where they appear, regardless of which codec the original used. The video search use case and the post on what is inside a video file cover the same ground in more depth.
How Exabase works with video codecs
Exabase handles decoding and analysis so applications can work with video content without managing codecs themselves. Upload MP4, MOV or any other major video type as Resources in a Base, and Exabase transcribes the audio, detects scenes, analyses what each scene shows and indexes the result, while keeping the original file. Extract accepts video through the same endpoint as other files and returns a transcript with timestamps, duration, dimensions, capture attributes such as camera type and ISO, the detected scenes, a visual description of each scene and timestamped chunks. The video to JSON tool shows that output for one file, and the retrieving results guide explains how to read it.
Deep Search then matches queries against both what is said and what is shown, returning the scene with start and end timestamps so a result can link to the exact moment. That supports video search, text to video search and video moment retrieval across mixed libraries, as described in the asset search solution. Exabase is the extraction and search layer here: transcoding for playback, streaming and editing workflows remain with the application or a media service. Teams comparing providers can see the best video understanding APIs roundup and the Exabase vs Twelve Labs comparison.
Frequently asked questions
What is the difference between a video codec and a container?
The codec compresses and decompresses the video stream. The container, such as MP4 or MOV, wraps one or more streams with timing, audio, subtitles and metadata. One container can hold different codecs.
Which video codec is most compatible?
H.264 has the widest support across browsers, phones, televisions and editing software. It is the safe choice when you cannot control the playback device.
Is AV1 better than HEVC?
AV1 and HEVC offer similar compression efficiency. AV1 is royalty-free and widely used by streaming services, while HEVC has broader hardware support in older devices and cameras.
Why do some videos from iPhones not play elsewhere?
iPhones often record HEVC in a MOV container. Older software and some browsers lack HEVC support, so the file needs converting to H.264 or the player needs updating.
What is a keyframe in video compression?
A keyframe, or I-frame, is encoded on its own without reference to other frames. Decoding and seeking start from keyframes, and the frames between them are predicted from neighbouring frames.
Does video compression affect AI analysis?
Moderate compression has little effect on scene analysis or captioning. Heavy compression removes fine detail, which mainly hurts reading small on-screen text and detecting small or fast-moving objects.
Related pages: audio codec, bitrate, MP4 vs MOV, keyframe extraction, shot boundary detection, video scene detection, video understanding, video search, asset search, best video understanding APIs