# .mp4 MIME Type: video/mp4

> The most widely supported video container, usually holding H.264 or H.265 video with AAC audio.

- MIME type: `video/mp4`
- Extensions: .mp4, .m4v
- Content-Type header: `video/mp4`
- Compress in transit: no (already compressed)
- File signature: `66 74 79 70` at offset 4 (an ISO base media file; the brand after ftyp is typically isom or mp42)

## Good to know

- Browsers need `Accept-Ranges: bytes` and [206 Partial Content](https://www.devkult.com/http/206.md) responses to seek; static file servers and CDNs handle this automatically.
- For fast start, the `moov` index must be at the beginning of the file (`ffmpeg -movflags +faststart`).
- The MIME type doesn't say which codec is inside; `<source type='video/mp4; codecs="avc1.42E01E"'>` can.

## Server configuration

### nginx (inside the types block in mime.types)

```
video/mp4 mp4 m4v;
```

### Apache (.htaccess or server config)

```
AddType video/mp4 .mp4 .m4v
```

### Express

```
res.set("Content-Type", "video/mp4");
```

### Python

```
import mimetypes

mimetypes.add_type("video/mp4", ".mp4")
mimetypes.add_type("video/mp4", ".m4v")
```

### HTML file input

```
<input type="file" accept=".mp4,.m4v,video/mp4">
```

## FAQ

### What is the MIME type for .mp4 files?

`video/mp4`. The same type covers .m4v.

### What Content-Type header should a .mp4 file be served with?

`Content-Type: video/mp4`. It's already compressed, so servers shouldn't gzip it.

### How can I tell if a file is really a .mp4?

Check its bytes rather than the extension: MP4 files contain `66 74 79 70` (`ftyp`) at byte offset 4 — an ISO base media file; the brand after ftyp is typically isom or mp42. On the command line, `file --mime-type name.mp4` does this for you.

## Related types

- [.webm — video/webm](https://www.devkult.com/mime/webm.md)
- [.mov — video/quicktime](https://www.devkult.com/mime/mov.md)
- [.m3u8 — application/vnd.apple.mpegurl](https://www.devkult.com/mime/m3u8.md)

Open the interactive page: https://www.devkult.com/mime/mp4