What is the MIME type of .mp4 files?
The MIME type (media type) for MPEG-4 video files with the .mp4 extension is video/mp4. Must support range requests (Accept-Ranges: bytes, 206 responses) so users can seek; without them Safari may refuse to play the video.
Content-Type header
Content-Type: video/mp4
Server configuration
| Server | Configuration |
|---|---|
Nginx (mime.types or types {}) | video/mp4 mp4; |
Apache (.htaccess) | AddType video/mp4 .mp4 |
IIS (web.config) | <mimeMap fileExtension=".mp4" mimeType="video/mp4" /> |
| Node.js / Express | res.type('mp4') or res.setHeader('Content-Type', 'video/mp4') |
| Amazon S3 | Set Content-Type: video/mp4 on the object (metadata), or pass --content-type video/mp4 to aws s3 cp |
Should .mp4 files be compressed?
No. MPEG-4 video files are already compressed internally, so gzip or Brotli would waste CPU and barely reduce — sometimes even increase — the size. Leave video/mp4 out of your compression configuration.
Why the MIME type matters
Browsers decide what to do with a response — render, run, play or download — from the Content-Type header, not the file extension. With X-Content-Type-Options: nosniff, a wrong type causes stylesheets and scripts to be blocked outright. For uploads, never trust the type sent by the client; check the file’s content (its magic bytes) on the server.
Frequently asked questions
What is the MIME type for .mp4?
video/mp4.How do I set the Content-Type for .mp4 in Nginx?
video/mp4 mp4; is listed in the types block (usually in /etc/nginx/mime.types) and reload Nginx.