MCAP vs ROS bag: Simplifying Multi-Modal Sensor Data in Robotics

2 min read -
A young man with short hair wearing a beige sweater, in front of a geometric black and white background.
- March 25th, 2024 -

Jump to section

If you work with robotics or autonomous vehicle data, you’re likely familiar with the challenges of efficiently storing and transferring multimodal sensor data. This can cause some headaches when sharing data with external vendors: How do you send over your recordings containing large volumes of lidar, radar, camera, and calibration data? How to package and transform the data to make it compatible with the vendor’s system? That’s where the MCAP format comes in.

What is MCAP?

MCAP (short for “message capture”, pronounced “em-cap”) is an open-source container file format optimized for storing timestamped data from multiple sensors (lidar, radar, camera, GPS/IMU, …) and data streams (calibration data, sensor metadata, object detections, …).

It was developed by our friends at Foxglove with input from the robotics community to address the shortcomings of existing formats like ROS bags.

Why MCAP?

MCAP provides several advantages over existing robotics data formats:

  • 1
    Heterogeneous data support: MCAP can store data in multiple serialization formats (Protobuf, ROS, JSON, etc.) in a single file. This allows you to work with data from various sensors and sources in one self-contained format.
  • 2
    High-performance writing: MCAP uses an append-only structure optimized for high-throughput data writing. This minimizes disk I/O and reduces the risk of data corruption if recording is interrupted.
  • 3
    Efficient data access: MCAP files contain an optional index that enables fast random access and seeking, even over remote connections. This makes it efficient to extract subsets of data for analysis without needing to read the entire file.
  • 4
    Broad language support: MCAP has native libraries available in C++, Python, Go, Rust, and other languages, making it easy to integrate into various robotics and automotive software stacks.
  • 5
    Self-contained: With MCAP, message schemas are embedded directly in the file alongside the data. Files remain readable even as message definitions evolve, without relying on external dependencies. Optional attachments can also store calibration data and other metadata.

This makes MCAP ideal for recording and sharing high-frequency, multi-modal sensor data in automotive and robotics use cases.

MCAP and ROS

For teams using ROS, MCAP provides an upgrade path from the limitations of existing ROS bag formats. ROS 1 bags are difficult to use with non-ROS tools, while ROS 2 bags using SQLite are not fully self-contained.

Excitingly, the ROS 2 community has decided to adopt MCAP as the default bag format, starting with the ROS 2 Iron Irwini release in May 2023. This means you can now natively record to MCAP in ROS 2 and leverage its benefits out of the box.

Segments.ai adds MCAP support

At Segments.ai, we’re always looking for ways to make it easier for our automotive and robotics customers to label their multi-sensor data. That’s why we’re excited to announce that we’re adding support for uploading your data in the MCAP format. This functionality is still in beta, so please contact us if you want to try it out.

No more writing scripts to extract point cloud files and images from your recordings: just upload your MCAP files to a cloud bucket and let us do the heavy lifting. If your MCAP file can be visualized in Foxglove, we should be able to import it too.

We believe MCAP has the potential to become a standardized format and to greatly streamline data management across the industry. Supporting it is part of our commitment to provide the best tools for working with robotics and autonomous vehicle data.

To learn more about MCAP, check out the references section below.

References