# What is an M2TS File?

An M2TS file holds a BDAV MPEG-2 transport stream, the variant of the MPEG-2 transport stream used by Blu-ray Disc and AVCHD, in which a 4-byte header precedes every 188-byte transport packet. It can multiplex video, audio, subtitle graphics, and other elementary streams in one file.

<span aria-hidden="true" id="how-it-works"></span>

## How M2TS Files work

The Blu-ray Disc read-only format stores each clip’s audio and video as a BDAV MPEG-2 transport stream in a `.m2ts` file. The stream is a sequence of 192-byte source packets, each a 4-byte `TP_extra_header` followed by a standard 188-byte MPEG-2 transport packet, grouped into 6144-byte aligned units of 32 packets. Inside the transport packets the usual MPEG-2 Systems rules apply: the Program Association Table points to a Program Map Table, which identifies the program’s elementary streams by packet identifier. On a disc, the `.m2ts` file is only half of a clip. A same-numbered `.clpi` file stores the time stamps of access points into the stream, and `.mpls` playlist files describe what to play as a list of play items, each an in-point and out-point on a clip’s time axis. AVCHD camcorders record into the same container, and the Library of Congress format description lists `mts` as a second extension for it.

<span aria-hidden="true" id="key-facts"></span>

## Key facts

1. Each source packet is 192 bytes: a 4-byte `TP_extra_header` followed by a standard 188-byte MPEG-2 transport packet. A parser that steps through the file in 188-byte packets will not stay aligned, because the transport sync byte sits at offset 4 of every source packet. FFmpeg’s MPEG-TS demuxer handles this by probing the packet size and skipping the first 4 bytes of each 192-byte packet.
2. A lone `.m2ts` file holds one clip’s stream, not a title. On a Blu-ray disc the `.mpls` playlists in `BDMV/PLAYLIST` select intervals of clips and their order, and the `.clpi` clip-information files in `BDMV/CLIPINF` hold the access-point time stamps a player uses to find where to start reading. Titles sit one level higher: the disc’s index table points each title to a movie object or BD-J object, and movie objects, stored in `BDMV/MovieObject.bdmv`, launch playlist playback. Opening the files in `BDMV/STREAM` one by one therefore yields each clip’s streams without the playing order and in- and out-points that the playlists define.
3. Blu-ray subtitles can live in two places. Bitmap presentation graphics streams are multiplexed in the BDAV transport stream alongside video and audio. Text subtitles are a separate, out-of-mux clip, which a playlist attaches through a sub-path, so they are not in the main clip’s `.m2ts`. That clip’s stream file sits in `BDMV/STREAM` with the audio and video clips, and the subtitle fonts are separate `.otf` files in the `AUXDATA` directory.
4. Rewrapping M2TS into another container with stream copy leaves the encoded video and audio untouched, because nothing is decoded or re-encoded; FFmpeg notes that stream copy can still fail when the target container needs information the source does not provide. Blu-ray clips may carry MPEG-2, H.264/AVC, or VC-1 video, so check each stream against what the target container accepts. Subtitles show the limit: in the FFmpeg 8.0 source, the MP4 muxer has no codec tag for either Blu-ray subtitle codec and rejects those streams. Clips from commercial discs are a separate case: the Library of Congress notes that M2TS itself has no encryption support but that Blu-ray discs are often protected with AACS.

<span aria-hidden="true" id="when-it-matters"></span>

## When M2TS Files matter

Media pipelines meet M2TS when ingesting AVCHD camcorder recordings or the clip files in the `BDMV/STREAM` directory of a Blu-ray Disc structure. The decision that matters is whether to treat a file as a standalone stream or as one clip of a disc: a single `.m2ts` can be demultiplexed on its own, but playing order and access-point tables are defined in companion playlist and clip-information files, and the disc’s titles in its index table.

<span aria-hidden="true" id="at-scale"></span>

## Working with M2TS Files

FFmpeg’s MPEG-TS muxer has an m2ts mode that writes the 4-byte prefix before every transport packet and uses fixed packet identifiers. In the FFmpeg 8.0 source the automatic setting turns the mode on when the output name ends in `.m2ts`, and the muxer refuses more than one program in that mode. The value FFmpeg writes into the prefix is a 30-bit timestamp taken from the stream’s program clock.

Writing a file of 192-byte packets is not the same as authoring a disc. A Blu-ray `BDMV` structure also needs index, movie-object, playlist, and clip-information files, and players navigate through those rather than through the stream files. To read a playlist instead of a single clip, FFmpeg offers a `bluray` input protocol that reads a playlist from a mounted disc structure.

<span aria-hidden="true" id="references"></span>

## Sources

* [Library of Congress: MPEG-2 Transport Stream for Blu-ray Discs (BDAV) and AVCHD (M2TS) format description](https://www.loc.gov/preservation/digital/formats/fdd/fdd000636.shtml)
* [Blu-ray Disc Association: White Paper, Blu-ray Disc Read-Only Format, 2.B Audio Visual Application Format Specifications for BD-ROM Version 2.5 (2011, archived copy), sections 2.1 to 2.3, 3.1 to 3.6, and 4.1.3](https://web.archive.org/web/20151028131505/http://www.blu-raydisc.com/assets/Downloadablefile/BD-ROM-AV-WhitePaper%5F110712.pdf)
* [ITU-T H.222.0 (08/2018) | ISO/IEC 13818-1: MPEG-2 Systems (transport stream packets, program association and program map tables)](https://www.itu.int/rec/T-REC-H.222.0-201808-S/en)
* [FFmpeg Formats Documentation: mpegts demuxer and mpegts muxer (m2ts mode options)](https://ffmpeg.org/ffmpeg-formats.html)
* [FFmpeg 8.0 source: libavformat/mpegts.c (packet-size probing, 192-byte source packet handling, and Blu-ray subtitle stream types)](https://github.com/FFmpeg/FFmpeg/blob/n8.0/libavformat/mpegts.c)
* [FFmpeg 8.0 source: libavformat/movenc.c (MP4 muxer codec tags)](https://github.com/FFmpeg/FFmpeg/blob/n8.0/libavformat/movenc.c)
* [FFmpeg Protocols Documentation: bluray (reading a Blu-ray playlist)](https://ffmpeg.org/ffmpeg-protocols.html)
* [FFmpeg tool documentation: Streamcopy](https://ffmpeg.org/ffmpeg.html)

[← Low-Latency DASH](/glossary/low-latency-dash.md)[M2V File →](/glossary/m2v-file.md)

More in file formats & compression

* [JPM File](/glossary/jpm-file.md)
* [JPX File](/glossary/jpx-file.md)
* [Lossy Compression](/glossary/lossy-compression.md)
* [M2V File](/glossary/m2v-file.md)
* [M3U8](/glossary/m3u8.md)
* [M4P File](/glossary/m4p-file.md)

[All 505 terms](/glossary.md)

## Turn media knowledge into a working pipeline

Connect uploads, processing, AI, storage, and delivery through one declarative API — with the encoding stack, scaling, and format churn handled for you.

[Try Transloadit for free](/c/signup/)
