MCAP
Open log file format and libraries for robot data, the default for ROS 2 bags
License
MIT
Code: MIT, per the LICENSE file at the root of the GitHub repository. Packages: the C++ library, the TypeScript packages, the Python packages and the Rust crates each declare MIT as well. Specification: the format specification and documentation live in the same repository under the same licence. Name and logo: MCAP and its logo belong to Foxglove and are not granted by the code licence. Checked 2026-11-10 against LICENSE, cpp/mcap/LICENSE, the TypeScript package LICENSE files, the Python setup.cfg files and the Rust Cargo.toml files.
Overview
MCAP is an open container file format for recording timestamped, multi-channel publish-subscribe data, the kind of log a robot writes while it runs. One file can hold messages in several serializations at once, such as ROS 1, ROS 2, Protobuf, FlatBuffers or JSON, and it carries every message schema inside it, so it can be decoded without the original code. Data is written append-only in chunks that can be compressed with zstd or LZ4, and an index at the end lets readers jump to a topic or time range without scanning the whole file. Foxglove develops MCAP in the open under the MIT licence, with libraries in C++, Go, Python, Rust, Swift and TypeScript and a command-line tool for inspecting, filtering, merging and repairing files. Since the ROS 2 Iron Irwini release of 23 May 2023 it has been the default storage format of rosbag2, the ROS 2 recording tool. In November 2026 Foxglove described a shared benchmark harness for its libraries and the write speed-ups it measured with it.
MCAP (pronounced "em-cap") is a file format and a set of libraries for logging robot data, developed in the open by Foxglove, a company that also sells a commercial robotics data platform. Before it, the format a team recorded in depended on its framework: ROS 1 had its .bag files, which are hard to use outside ROS, ROS 2 wrote SQLite databases that did not carry their own message definitions, and many other teams built in-house binary formats. Foxglove's evaluation of existing formats found none that fit robotics well, and MCAP was designed to fill that gap. Its specification, documentation and source code are public, and the format has its own registered media type, application/vnd.mcap.
An MCAP file is a sequence of records. Messages are grouped into channels, such as one sensor topic, and every channel points to a schema that describes its messages. The format does not care how messages are serialized: the registry of well-known encodings includes ROS 1 and ROS 2 messages, Protobuf, FlatBuffers, JSON Schema, CBOR and Cap'n Proto, and one file can mix them. Because schemas are stored in the file, a recording can be decoded years later on a machine that never had the original message packages. Writers only append, which keeps recording fast and lets a partly written file be recovered if the robot loses power. Messages can be grouped into chunks compressed with zstd or LZ4, each with an optional checksum, and an optional summary section at the end indexes chunks, channels, metadata and attachments. That index lets a reader fetch one topic or one time window without reading the rest of the file, including over a network.
Libraries exist for C++, Go, Python, Rust, Swift and TypeScript, all tested against the specification, though the support matrix shows that they do not all offer the same reading features. The Python package adds helpers for ROS 1, ROS 2 and Protobuf data. The MCAP command-line tool, installed with Homebrew or downloaded as a release binary, reports file statistics, filters, merges, sorts, compresses and recovers files, and converts ROS 1 .bag and ROS 2 .db3 recordings to MCAP. In 2026 Foxglove rewrote it from Go in Rust with the same interface.
In ROS 2, rosbag2 records through storage plugins, and its MCAP plugin became the default with the Iron Irwini release of 23 May 2023, following a pull request that replaced SQLite as the default. SQLite is still available as an option. Many viewers and tools for robot data open MCAP files, among them Foxglove's own app, Lichtblick, BAGEL, PlotJuggler and Rerun.
On 9 November 2026 Foxglove published Measuring and improving MCAP performance, about a shared benchmark harness added in pull request 1611. It drives the C++, Rust, Go, Python and TypeScript libraries through three scenarios with byte-identical data: one million 100-byte messages on one channel in each storage mode (unchunked, chunked, zstd and LZ4); a simulated 10-second robot recording with 5 channels, from a 200 Hz inertial sensor to 512 KB camera frames, about 102 MB in total; and reads of that recording filtered by topic, by time range or both. Each run checks the written bytes and the number of messages read back, and records time, file size and peak memory. By Foxglove's own measurements, on an AMD Ryzen AI MAX+ 395 pinned to 3.0 GHz and writing to a RAM-backed file system, C++ LZ4 writes in the one-million-message test are about 8 times as fast as in January 2026, and Rust's write time in that test is less than half what it was. Some of the gain comes from new defaults rather than faster code: Go and C++ now use the fastest LZ4 setting, which makes files 15% to 30% larger, while C++ zstd moved to level 3, giving files about 31% smaller at the cost of slower writes. The published results cover writing only, and Foxglove names the Python library as much slower than the others on small messages.
Why it matters
Recording is how robotics teams debug, investigate incidents and collect training data, and a log is only useful if the tools around it can read it. MCAP is the file that ROS 2 writes when anyone runs ros2 bag record on a current release, and the format that viewers such as Lichtblick, PlotJuggler and Rerun accept, so it is widely used for robot logs both inside and outside ROS. It is open under MIT, has a written specification and a registered media type, and carries its own schemas, so data recorded today can still be decoded later without the code that produced it. Foxglove, a commercial company, stewards it, and the shared benchmark harness in the repository gives anyone a common way to check how its libraries perform on their own hardware instead of relying on Foxglove's numbers. Rerun's rosbag2 plugin for its RRD format is an alternative for teams that want their bags stored for querying and visualisation rather than recording speed.
Problem it solves
Robot logs mix many data streams at different rates and sizes, and before MCAP the file a team recorded into depended on its framework: ROS 1 bags that are hard to read outside ROS, ROS 2 SQLite databases that did not carry their own message definitions, or custom in-house formats that every tool had to learn. MCAP gives them one open, self-describing container that writes fast, survives interrupted recordings, holds any serialization in the same file and can be searched by topic and time through an index, with libraries in six languages so tools can read and write it without each building their own parser.
Key takeaways
- An open container file format for timestamped publish-subscribe data such as robot logs, with a public specification and the media type application/vnd.mcap
- Serialization-agnostic: ROS 1, ROS 2, Protobuf, FlatBuffers, JSON and more in one file, with every schema stored inside it
- Append-only writing, recovery of interrupted files, chunk compression with zstd or LZ4 and an index for reading by topic or time range
- Libraries in C++, Go, Python, Rust, Swift and TypeScript, plus a command-line tool now written in Rust
- The default rosbag2 storage format since ROS 2 Iron Irwini, released on 23 May 2023
- A shared benchmark harness for five of the libraries, with Foxglove's own write results published on 9 November 2026
- MIT licence, developed in the open by Foxglove
Who it is for
- ROS 2 developers recording, replaying and converting bags
- Robotics teams outside ROS who need one log format for mixed Protobuf, JSON or FlatBuffers data
- Developers of data tools, viewers and pipelines that need to read and write robot logs
- Teams collecting robot data for machine learning who want self-describing, indexed recordings
Limitations
- Foxglove, a commercial company, stewards the format and most of the libraries, and its own robotics data platform is a commercial product
- The libraries do not all offer the same features: the support matrix lists, for example, no timestamp-ordered reading in Rust and no indexed unordered reading in Swift
- The performance figures in the November 2026 post are Foxglove's own, measured on one AMD Ryzen AI MAX+ 395 machine writing to a RAM-backed file system
- Those results cover writing only; reading speed is not part of the published comparison
- The Python library is much slower than the others on small messages, by Foxglove's own account
- Writer defaults such as compression and chunking still differ between languages, so the same data can give different file sizes and speeds
- The index sits in the summary section at the end of the file, so a recording cut off before it is closed has no index until it is recovered with the CLI