Utilo

TS MIME Type – Free, Online, Private

video/mp2t is the IANA type for an MPEG transport stream, the .ts segments in HLS. A .ts file of TypeScript source is not this type.

What .ts is

An MPEG transport stream is a sequence of 188-byte packets. Each packet starts with the sync byte 47. The header carries a PID. Elementary streams for video and audio are identified by program-map tables, not by a file extension. HLS used this format for years, and the playlist that points at the segments is application/vnd.apple.mpegurl. IANA's name is video/MP2T. Send video/mp2t. The same three letters are the extension of TypeScript source, which is text and has no registered media type. If the file is source code, do not send video/mp2t. text/plain is the honest fallback for source you are not executing, and a download of a module is not a video segment.

IANA registers video/MP2T in RFC 3555. Media types are case-insensitive, so video/mp2t is the same type. .ts is also the extension TypeScript uses, and TypeScript has no IANA media type. The media type is video/mp2t. Extensions that use it on this page: .ts. A client compares the type, not the filename, once the response has arrived. The filename still matters on disk and in Content-Disposition, which is why a wrong extension and a wrong header are two different bugs.

What sends video/mp2t

What sends video/mp2t: Send video/mp2t for a .ts HLS segment whose first byte is 47 and whose packet spacing stays 188, or 192 if you have a 4-byte timestamp prefix you have already agreed with the player. Do not send it for a TypeScript file a bundler should read. Static hosts that map every .ts URL to video/mp2t will break a site that publishes TypeScript sources next to media. Split those trees, or set the header from the application based on the directory. A video element does not play a naked transport stream. A player that understands HLS plays the playlist, and the playlist references these segments. The file on disk is still .ts. Once the response exists, a client trusts video/mp2t, not the filename. Fragmented MP4 HLS uses .m4s or .mp4 segments and video/mp4. If you migrate a stream from MPEG-TS to fMP4, change the extension, the type, and the playlist tags together. Leaving video/mp2t on an fMP4 body makes the player hunt for a sync byte that is not there.

Content-Type for .ts

Send video/mp2t and do not add a charset parameter. The body is binary. A charset tells a text decoder to reinterpret bytes that are not text, which corrupts a download and does not help a browser sniff the format.

Content-TypeContent-Type: video/mp2t

nginx, Apache, and Express

These snippets map .ts to video/mp2t. nginx reads the types block when it picks a type from the URL's extension. A location that sets default_type, or an application that sets the header itself, overrides that map. Apache AddType applies in the directory context where you put it. The Express static example writes the header for files ending in .ts so a stale mime database in the framework cannot disagree with the type on this page.

nginx# /etc/nginx/mime.types, inside the types { } block
video/mp2t                  ts;
ApacheAddType video/mp2t .ts
Expressimport express from "express";

const app = express();
app.use(express.static("public", {
  setHeaders(res, filePath) {
    if (filePath.endsWith(".ts")) {
      res.setHeader("Content-Type", "video/mp2t");
    }
  },
}));

Pitfalls for video/mp2t

Pitfalls that show up for video/mp2t, and not for a neighboring type with a similar extension: The production incident is a new static host whose mime.types says video/mp2t ts, deployed in front of a documentation site full of example.ts files. Browsers download the examples as video. Scope the mapping to the media origin. The reverse incident is an HLS origin that serves segments as video/mp4 or text/plain, which some players reject even when the bytes are valid. A third is a 192-byte timestamped packet that a packager did not strip. The sync byte is then at offset 4 and a checker that only looks at byte 0 reports garbage.

  • video/MP2T and video/mp2t are the same type. Pick one spelling and keep it stable so caches and logs group together.
  • TypeScript, TSX, and MPEG-TS cannot share a single static mapping if both are published on one host.
  • A segment without a PAT and PMT may still be the right type and still not be decodable alone. Players need the program tables or a previous segment that had them.
  • Do not add a charset. A sync byte of 47 is not the character G in a text file you should transcode.

Frequently asked questions

Is every .ts file video/mp2t?

No. MPEG-TS is video/mp2t. TypeScript source uses the same extension and is not an MPEG transport stream.

How do I recognize a transport stream?

Sync byte 0x47 every 188 bytes. TypeScript is text and will not pass that check.

What type is the HLS playlist?

application/vnd.apple.mpegurl, on the .m3u8 file. This type is only the segments.

Did IANA use this exact spelling?

The registry entry is video/MP2T. Types are case-insensitive. video/mp2t is the usual header spelling.