video/mp4

All MIME types
Video · Standards tree · RFC 4337.mp4 .mp4v .mpg4

Media type / video

video/mp4

The MPEG-4 container, usually H.264 or H.265 video with AAC audio — the default for web delivery.

Served inline: Browsers display this in the tab without granting it script access to the page. Safe to serve inline, provided the bytes really are what the header claims.

Browser behaviour

Renders inertly

Charset

no charset

Compression

Already compressed

Send it like this

Content-Type: video/mp4

A binary payload has no character encoding. A charset parameter here is meaningless and occasionally confuses strict parsers.

Handling verdict

InlineRenders inertly

Browsers display this in the tab without granting it script access to the page. Safe to serve inline, provided the bytes really are what the header claims.

Charsetno charset

A binary payload has no character encoding. A charset parameter here is meaningless and occasionally confuses strict parsers.

CompressionAlready compressed

The format compresses internally. Another transport encoding costs CPU on both ends and typically changes the size by less than a percent — sometimes upward.

NameStandards tree

Registered with IANA through a public review process, so the name is stable and every implementation can rely on it meaning the same thing.

Anatomy of the name

RFC 6838

Top-level type

video

Video

Subtype

mp4

Registered in the standards tree.

Structured syntax

none

No suffix, so the payload format is defined entirely by the subtype itself.

Parameters

codecs

Defined for this type in addition to any charset rule above.

What trips people up

2 notes
  • Progressive playback needs the moov atom at the front of the file ("faststart"); otherwise the browser must download everything before the first frame.
  • Range request support is what makes seeking work — a server that ignores Range serves video that cannot be scrubbed.

Response headers

Content-Type: video/mp4
X-Content-Type-Options: nosniff
Content-Disposition: inline

nosniff stops the browser second-guessing the type you declared, which is what makes the rest of this reliable. Serving it inline is safe here because the browser renders it without granting it script access.

Server configuration

extension mapping

nginx

types {
    video/mp4  mp4 mp4v mpg4;
}

Apache

AddType video/mp4 .mp4 .mp4v .mpg4

Caddy

@type path *.mp4 *.mp4v *.mpg4
header @type Content-Type "video/mp4"

Extensions and other spellings

with signature

File extensions

.mp4.mp4v.mpg4

File signature

?? ?? ?? ?? 66 74 79 70

Check these bytes rather than the client-supplied Content-Type when validating an upload. The header is a claim; the signature is evidence.

Related media types

8
Familyvideo
Treestandards
Suffix
Inlinepassive