# Containers overview

Canonical URL: https://encode.wiki/containers/
Content version: ca42e61ede0a24f789d7287a0001244ad22f4abf
Status: current
License: CC BY-SA 4.0
Checksum (SHA-256): a6f03b3a1b447ec6e28b0debc5bff4cf91b87423be9f612d737c28a25eb16422

A container (or "muxer format") is the file that holds your encoded video, audio, subtitles, chapters and metadata together and keeps them in sync. It does not change quality: moving streams between containers is a **remux** and, with `-c copy`, is lossless and takes seconds. The file extension is only a label; what matters is which streams are inside and whether your player understands them.

## Which container should I use?

| Container                         | Extensions              | Use it for                                                                        | Watch out for                                                     |
| --------------------------------- | ----------------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| [Matroska](/containers/matroska/) | `.mkv`, `.mka`, `.mks`  | Archives and releases: any codec, many tracks, ASS/PGS subtitles, fonts, chapters | Not accepted by most phones, TVs and web browsers                 |
| [MP4](/containers/mp4/)           | `.mp4`, `.m4a`, `.m4v`  | Sharing, web, phones, TVs, streaming                                              | Text subtitles only as `mov_text`; no ASS or PGS                  |
| [WebM](/containers/webm/)         | `.webm`                 | Browser playback with VP8/VP9/AV1 and Vorbis/Opus                                 | Nothing else fits: no H.264, AAC or SRT                           |
| [MOV](/containers/mov/)           | `.mov`                  | Editing and mezzanine files (ProRes, DNxHR), Apple workflows                      | Looks like MP4 but accepts codecs MP4 players may not             |
| [Ogg](/containers/ogg/)           | `.ogg`, `.oga`, `.opus` | Opus, Vorbis and FLAC audio; Theora video                                         | Poor video container; `.opus` is Opus in Ogg                      |
| [AVI](/containers/avi/)           | `.avi`                  | Playing old files                                                                 | No real timestamps, no modern features; remux old files out of it |

For a file you will keep or edit later, use MKV. For a file you will send to someone or put on a website, use MP4 (H.264 or HEVC plus AAC or Opus) or WebM. [ISOBMFF](/containers/isobmff/) is the shared base format behind MP4, MOV, HEIF and AVIF.

## Remuxing

Copy streams from one container to another without re-encoding:

```sh
ffmpeg -i input.mkv -c copy output.mp4
mkvmerge -o output.mkv input.mp4
```

This only works if the target container can hold the streams. Without `-map`, FFmpeg keeps one video, one audio and at most one subtitle stream, and it can drop the subtitles without complaint when they cannot be copied, so check the result with `ffprobe`. Subtitles are the usual casualty; see [Audio and subtitle handling](/guides/audio-and-subtitles/) and the [subtitle formats](/codecs/subtitles/) overview.

## What containers do not do

- They do not fix a bad encode or add compatibility to a codec: an MP4 holding a codec your TV cannot decode will not play.
- They do not decide the codec. A `.mp4` can hold H.264, HEVC, AV1 or VP9; check with `ffprobe` rather than trusting the extension.
- Colour and HDR signalling live partly in the bitstream and partly in the container. Remuxing between families can drop or rewrite the container-level part, so verify HDR files after remuxing. See [Preserve colour and HDR](/guides/preserve-color-and-hdr/).
