devkult_
tools29converters34
home/mime/.mp4

.mp4 MIME type

MP4 videovideo

video/mp4

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

MIME typevideo/mp4
Extensions.mp4, .m4v
Content-Typevideo/mp4
Compress in transit?No — already compressed
File signature66 74 79 70 (ftyp) 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 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.

Serve .mp4 files with the right type

The response header to send:

Content-Type: video/mp4

Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:

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">

Check it

See what a server sends for a file, and what type a local file really is by its contents:

curl -sI https://example.com/file.mp4 | grep -i '^content-type:'
file --mime-type file.mp4

Frequently asked questions

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

Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options