Container vs codec
A file extension names the wrapper. The codec is the compression inside it. Confusing the two is the root of most playback failures, and telling them apart takes one command.
A container is the file format that packs video, audio and subtitle streams together, such as MP4, MKV or WebM. A codec is the way each stream is compressed, such as H.264, AV1 or AAC. A player must understand both. That is why an MP4 can still fail to play.
Two files sit on a desk, both called clip.mp4. One plays in every browser. The other opens a black window with a spinning wheel, or plays picture with no sound. They have the same extension, the same size and the same length. The difference is all inside. The first holds H.264 video and AAC audio. The second holds HEVC video and AC-3 audio. The browser can decode only the first pair.
That is the whole container-versus-codec problem in one picture. This explainer defines both terms clearly. It shows which pairings are legal and which are playable, which is not the same thing. It also gives you a repeatable way to inspect any file before you upload it, embed it or send it to someone. The video formats hub links every guide on containers, video codecs and audio codecs in one place.
The container is the box
A container, also called a wrapper or file format, is a specification for arranging one or more streams in a file. It defines how streams are interleaved, so video and audio can be read together. It sets how timestamps are recorded, so they stay in sync. It says where the index lives, so a player can seek, and what metadata can be attached. MP4, MKV, WebM, MOV, AVI and MPEG-TS are containers. The extension usually tells you which one you have, but it is only a label. The real answer is in the first few bytes of the file.
Containers care about codecs only to the extent of listing which ones they permit. MP4 allows a registered set: H.264, H.265, AV1, MPEG-4 Part 2, VP9, AAC, MP3, Opus, AC-3 and a few others. WebM allows only VP8, VP9 and AV1 with Vorbis or Opus. Matroska allows nearly anything. AVI, as the container comparison explains, was designed before most modern codecs existed.
The codec is what is in the box
A codec (coder-decoder) is a compression scheme for a single stream. Raw 1080p video at 30 frames per second is roughly 1.5 gigabits per second before compression. So every practical video file is compressed, and the codec is the method doing it. H.264, H.265, AV1, VP9 and MPEG-2 are video codecs. AAC, Opus, MP3, AC-3, FLAC and Vorbis are audio codecs. The video codec comparison and the audio codec guide go into each.
Codecs are where quality lives. Resolution, frame rate, bitrate, colour depth and the encoder's skill at spending bits all belong to the codec layer. Changing the container leaves all of it untouched. Changing the codec means decoding to raw frames and encoding again. That is the only point at which a conversion can make a picture worse.
Because each stream is separate, you can work on one without touching the other. The free mute video tool drops the audio stream and copies the video as it is, so the picture does not change. The extract audio tool does the opposite. It saves the sound as its own MP3, M4A, WAV or Opus file.
ffmpeg is a universal media converter. It can read a wide variety of inputs - including live grabbing/recording devices - filter, and transcode them into a plenty of output formats.
FFmpeg documentation, ffmpeg(1)
How to inspect any file
The ffprobe tool that ships with FFmpeg answers the question definitively. Install FFmpeg, open a terminal and run the following.
- Show the container and every stream:
ffprobe -hide_banner input.mp4. The first line after the input path names the demuxer, for examplemov,mp4,m4a,3gp,3g2,mj2for the MP4 family ormatroska,webmfor MKV and WebM. - Read the stream lines.
Stream #0:0: Video: h264 (High), yuv420p, 1920x1080, 30 fpstells you the video codec, profile, pixel format, resolution and frame rate.Stream #0:1: Audio: aac (LC), 48000 Hz, stereodoes the same for audio. - For a machine-readable answer, use
ffprobe -v error -show_entries stream=codec_type,codec_name,profile -of csv=p=0 input.mp4, which prints one line per stream. - Compare the result against what your target player supports. A browser wants H.264 or AV1 with AAC or Opus; if you see
hevc,ac3,dtsormpeg4, you have found the reason for the black screen.
Legal versus playable
A container may permit a codec that a given player still cannot decode. Both columns matter.
| File | Container permits it? | Plays in most browsers? | Fix |
|---|---|---|---|
| MP4 with H.264 + AAC | Yes | Yes | None needed |
| MP4 with HEVC + AAC | Yes | Depends on hardware and browser | Transcode video to H.264 |
| MP4 with H.264 + AC-3 | Yes | Picture only, often no sound | Transcode audio to AAC, copy video |
| MP4 with AV1 + Opus | Yes | Chrome, Firefox, Edge; Safari on newer hardware | Offer an H.264 alternate |
| MKV with H.264 + AAC | Yes | Inconsistent | Remux to MP4 with stream copy |
| WebM with VP9 + Opus | Yes | Yes | None needed |
| AVI with MPEG-4 Part 2 + MP3 | Yes | No | Transcode to H.264 in MP4 |
| MP4 with moov box at the end | Yes | Only after full download | Remux with faststart |
Where the word 'format' fits
"Format" is used loosely for both layers, which is how the confusion starts. When a website says "supported formats: MP4, WebM", it means containers, and usually assumes the common codecs inside them. When a camera says "records in HEVC format", it means the codec. When a file dialog offers "Export format", it may mean either or both. Reading a claim as "container plus codec" resolves most of the ambiguity.
Why the distinction matters for uploads
A hosting platform has to handle both layers. On VideoBB the container list is broad on purpose. mp4, mkv, avi, mov, webm, m4v, mpg, wmv, flv, ts and 3gp are all accepted, up to 4 GB per file. The transcoder decodes whatever codec it finds inside, from MPEG-2 in an old .mpg to AV1 in a new .webm. The output is always HLS with renditions from 144p to 1080p. When the source is large enough, 1440p and 2160p are made too, and Premium members can watch them. So the viewer's browser never has to cope with the original.
Where the layers still matter is before transcoding. Some files have a damaged container or a missing index. Others use a codec so rare that it needs a slow software decoder. These take longer to process, and in rare cases fail. The upload failure guide lists the container-level and codec-level causes separately, because the fixes are different.
Three tools, three jobs
Identifies the container and every stream inside it. The first thing to run on any file that misbehaves.
InspectRemuxes streams into a different container without re-encoding. Lossless and fast; fixes container-level problems only.
RemuxTranscodes the video stream to a new codec. Slow and lossy by nature; necessary when the codec is the problem.
TranscodeFrequently asked questions
Is MP4 a codec?
No. MP4 is a container defined by ISO/IEC 14496-14. The mix-up has two causes. The same MPEG-4 family of standards includes MPEG-4 Part 2 and Part 10 (H.264), which are codecs. And MP4 files almost always hold H.264 video. But an MP4 can equally hold HEVC, AV1 or MPEG-4 Part 2 video, and which one it holds decides whether a given device can play it.
What is a codec string like avc1.640028?
It is the RFC 6381 notation web players and HLS playlists use to declare exactly what a stream contains. avc1 identifies H.264, and the hexadecimal suffix encodes profile, constraints and level; 640028 is High profile at level 4.0. Browsers use these strings, via the MediaSource and canPlayType APIs, to decide whether they can decode a stream before downloading it.
Can a container hold more than one video stream?
Yes. MKV and MP4 both allow several video tracks. They are used for alternate angles or, in streaming packages, for different renditions. Most players only show the first video track by default. Several audio tracks are far more common and better supported, for example an original language plus a dubbed version. Several subtitle tracks are routine in MKV.
Why does a file play in VLC but not in my browser?
VLC bundles decoders for almost every codec and demuxers for almost every container, so it plays nearly anything. Browsers ship a deliberately small set: MP4 and WebM containers with H.264, VP9, AV1 and sometimes HEVC video, and AAC, Opus and MP3 audio. If VLC plays a file and a browser does not, the file holds something outside that set. ffprobe will show which stream it is.
Sources
- MDN: Media container formats — Containers and codecs supported on the web
- FFmpeg documentation: ffmpeg — The ffmpeg command-line tool, source of the quoted description
- FFmpeg formats documentation — Demuxers and muxers
- RFC 6381: The 'Codecs' and 'Profiles' Parameters for Bucket Media Types — Codec string notation
Related guides

MP4 vs MKV vs AVI
Three containers from three different decades. Here is what each one can hold, where it plays, what it cannot do, and why MP4 is the right default for anything you upload or share.

H.264 vs H.265 vs AV1
One codec plays on everything, one halves the bitrate but carries licensing baggage, and one is royalty-free and gaining ground. How to choose between them for encoding, upload and delivery.

Why video uploads fail
An upload that stops, stalls, restarts or is rejected is almost always one of a short list of causes. Learn to tell them apart from what the browser shows you, and fix the right one.

AAC vs Opus vs MP3
Video gets the attention, but the audio codec decides whether a file plays silently, fails in HLS or wastes bitrate. What each of the three main codecs does well and which container each belongs in.