What is Video Container vs Codec (MP4, WebM)?

Published on November 10, 2026 • Last updated November 10, 2026

Official Definition

A codec compresses the video and audio, while a container (such as MP4 or WebM) is the file format that packs the compressed streams together with timing and an index.

Detailed Explanation

In-Depth Guide

Key Takeaway

The same container can hold different codecs. An MP4 file normally holds H.264 video and AAC audio, and a WebM file normally holds VP8, VP9 or AV1 video with Opus or Vorbis audio.

Players need to support both the container and the codec inside it, which is why a file can open in one app and fail in another. The container also stores the duration and, in many formats, an index that lets a player jump to any time.

Files written live by a browser recorder can lack both, which is why recordings sometimes show no length until they are repaired.

Frequently Asked Questions

No. MP4 is a container. The codec inside it, usually H.264, does the compression.

The app may support the container but not the audio codec stored in it.

Sometimes. If the codecs are allowed in the new container the streams can be copied across without re-encoding, otherwise the video must be re-encoded.

What do you need to work out next?

Search 276+ free tools by name, or pick a category below. Every one runs instantly in your browser — no signup, nothing to install.

More Developer Tools
AI ADVISOR & COACH

Ask AI Advisor

Ask AI