fundamentals · 5 min read
Video codecs and containers explained
A video file has two layers: a container, such as MP4, MOV, MKV or WebM, that packages the tracks, and codecs, such as H.264, HEVC, VP9 or AV1, that compress the video and audio inside it.
A device can support the container but not the codec, or the codec but not the container. That mismatch, more than the file extension on its own, is why a video plays on one phone and shows an error on another screen.
Container vs codec: the envelope and the letter
The container is the box: it says where the video track, audio tracks, subtitles and metadata begin, and how they are synchronized. It also holds the index that lets a player jump to a timestamp. The codec is the compression method used inside a track, and it is what actually turns pixels and sound into a stream of bytes.
The extension follows the container, not the codec. An MP4 file can contain H.264, HEVC, AV1 or several other formats, while a MOV file from a Mac might hold exactly the same H.264 stream and play much less widely. This is why choosing a container and choosing a codec are two separate decisions.
The codecs you will meet
H.264, also called AVC, is the compatibility workhorse. Almost every browser, phone, television and video platform decodes it, and it remains the safest choice for a file that has to play anywhere. HEVC, or H.265, compresses more efficiently, roughly halving the bitrate needed for similar quality, which makes it popular for 4K, HDR and phone recordings. It is more expensive to license, which slowed adoption outside Apple devices and some TVs.
VP9 is a royalty-free codec developed for the web and used heavily by video platforms inside WebM or MP4. AV1 is newer, royalty-free and more efficient again, but it is slower to encode and needs newer hardware to decode smoothly. For audio, AAC is the near-universal companion inside MP4, while Opus is common in WebM; ProRes is an editing codec, not a delivery one.
Bitrate, resolution and quality
Bitrate is how many bits per second the encoder spends describing the video. At the same resolution and codec, more bitrate usually means fewer compression artifacts, but the relationship is not linear: a detailed forest scene needs more data than a static talking-head shot to look equally clean.
Resolution sets the pixel grid, not the quality. A 4K clip encoded at a very low bitrate can look worse than a well-encoded 1080p clip, and upscaling a small video never adds detail. Variable bitrate encoders spend more data on complex scenes and less on simple ones, which is why two files with the same average bitrate can look different.
Why a video will not play on another device
Playback fails when the player cannot find a decoder for one of the tracks. A common case is 10-bit HEVC from a recent phone: the file plays on the phone, but an older television or Windows installation lacks the codec. Another is an MKV or WebM container that some phones and living-room apps do not index at all. Audio can be the blocker too, especially when a file carries an unusual track such as DTS or an older MPEG audio format.
Web playback adds its own rules. Browsers need a codec they support and, for reliable streaming, a file whose metadata sits at the front rather than the end. A large MP4 can work when opened from disk but stall in a browser until nearly the whole file has downloaded. Digital rights management is separate again: no amount of converting will make a protected file play outside its authorised app.
What conversion can and cannot fix
There are two kinds of conversion. A remux copies the existing video and audio streams into a different container, which is fast and lossless; changing MOV to MP4 is often just that. A transcode decodes the video and encodes it again, which takes time and loses some quality, but it can change the codec, bitrate, resolution and bit depth so an incompatible file becomes playable.
A good conversion chooses the smallest change that fixes the problem. If the codec is already widely supported, remux. If the target device is unknown, H.264 video with AAC audio in an MP4 container is the lowest-risk delivery format. No conversion can recover detail a low-bitrate source never had, and none can remove DRM legally or technically.