# .mkv

> The `.mkv` (Matroska Video) is an open-source multimedia container format that supports multiple video, audio, subtitle and metadata streams in a single file.

## What is an MKV file and can I play it in a browser?

The flexible and open-source container format that allows for storing multiple video, audio, subtitle and metadata streams in one file. It's often used for high-definition video content and supports modern codecs.

- Topic: Video
- Type: format

## Example

Wrong:

```bash
ffmpeg -i movie.mkv movie.mp4
```

Right:

```bash
ffmpeg -i movie.mkv -c copy -movflags +faststart movie.mp4
```

If the codecs are H.264 and AAC, `-c copy` only rewraps the streams into MP4, which is fast and lossless.

## Common mistakes

- Re-encoding an MKV to MP4 when only the container needs to change, losing quality and time.
- Losing extra audio tracks and subtitles when converting, since MP4 handles them differently.

## Key points

- Web players use `.mp4` or `.webm`, not `.mkv`, even when some browsers happen to play it.
- Conversion from MKV first tries remuxing with `-c copy` when the codecs are already web-friendly.

## Interview questions

### MKV vs MP4: which is better?

MKV is more flexible for many audio and subtitle tracks, which suits archives. MP4 is better for web and device playback.

### Is WebM related to MKV?

Yes. WebM is based on the Matroska container, limited to web codecs like VP8, VP9, AV1, Vorbis and Opus.

## Related cards

- [.webm](https://wonderium.dev/engineering/webm.md)
- [.mp4](https://wonderium.dev/engineering/mp4.md)
- [`<video>`](https://wonderium.dev/html/video.md)
- [`<track>`](https://wonderium.dev/html/track.md)

---

- Level: [Engineering](https://wonderium.dev/engineering.md)
- HTML version: https://wonderium.dev/engineering/mkv
- Last updated: 2026-11-25
