The Rerun Viewer has built-in support for opening MCAP files, an open container format for storing timestamped messages.
Supported message formats
Here's a quick summary of Rerun's MCAP importer:
- Automatic conversion to Rerun archetypes is supported for common ROS 2 & Foxglove messages.
- Other ROS 2 & Foxglove messages are decoded into queryable components via reflection.
For a detailed overview of Rerun's built-in MCAP support, please refer to our Supported Message Formats page. To request support for a new message type, see Adding support for new types.
Quick start
Loading MCAP files
The simplest way to get started is to load an MCAP file directly:
# View an MCAP file in the Rerun Viewer
rerun your_data.mcapYou can also drag and drop MCAP files into the Rerun Viewer or load them using the SDK:
"""Load an MCAP file using the Python SDK."""
import sys
import rerun as rr
path_to_mcap = sys.argv[1]
# Initialize the SDK and give our recording a unique name
rr.init("rerun_example_load_mcap", spawn=True)
# Load the MCAP file
rr.log_file_from_path(path_to_mcap)
recording = rr.get_data_recording()
assert recording is not None
recording.flush()
Python McapReader
For custom ingestion or processing pipelines, use the Python McapReader to read an MCAP file into a LazyChunkStream that can be used to build custom data wrangling pipelines.
For example, you can inspect file metadata with reader.info(), select decoders, filter topics or time ranges, transform chunks using Lenses, and write the result to RRD:
from rerun.chunk import McapReader
reader = McapReader(mcap_path)
print(reader.info().message_count)
# Stream chunks, optionally filter or transform them, and write to RRD.
reader.stream().write_rrd(
output_path,
application_id="rerun_example_process_mcap",
recording_id="example",
)See the Chunk Processing API for examples of filtering and transforming MCAP chunks. For a comprehensive example covering a full robotics pre-processing pipeline, see the robot_data_preprocessing example.
Basic conversion
Convert MCAP files to Rerun's native format for faster loading:
# Convert MCAP to RRD format for faster loading
rerun mcap convert input.mcap -o output.rrd
# View the converted file
rerun output.rrdROS bags that are not MCAP
Rerun only reads ROS bags stored as MCAP.
ROS 2
.db3(SQLite) bags are not supported. Convert them to MCAP withros2 bag convert(part of rosbag2, not Rerun), which takes an output-options YAML file:# convert.yaml output_bags: - uri: my_bag_mcap storage_id: mcap all_topics: true # Use `all: true` on ROS 2 Humble.Without a topic selection, the output bag is empty. See the rosbag2 docs for all options.
ros2 bag convert -i my_bag -o convert.yamlThis needs the MCAP storage plugin for rosbag2 (
ros-$ROS_DISTRO-rosbag2-storage-mcap). Newer ROS 2 distributions record to MCAP by default.ROS 1
.bagfiles are not supported. Convert them to a ROS 2 MCAP withrosbags-convert, see ROS 1 message types.
Recording ROS 2 bags as RRD
If you use rosbag2, you can record straight to RRD with rosbag2_storage_rrd, an experimental rosbag2 storage plugin:
ros2 bag record -s rrd --allros2 bag play replays the bag, and Rerun opens and queries it like any other .rrd.
It can also stream to a running Viewer while recording.
See the plugin's README for its current status and build instructions.
Data model
Rerun's data model is based on an entity component system (ECS) that is a bit different to the message-based model of MCAP. To map MCAP messages to Rerun entities we make the following assumptions:
- MCAP topics correspond to Rerun entities.
- Messages from the same topic within an MCAP chunk will be placed into a corresponding Rerun chunk.
- The contents of an MCAP message will be extracted to Rerun components and grouped under a corresponding Rerun archetype.
message_log_timeandmessage_publish_timeof an MCAP message will be carried over to Rerun as two distinct timelines.
Decoder architecture
Rerun uses decoders to process MCAP files at different levels of abstraction, from keeping only the raw message bytes up to a full semantic conversion to Rerun archetypes. See MCAP decoders explained for what each decoder does and which ones run by default, and the MCAP CLI reference for how to select them.
Advanced usage
For advanced command-line options and automation workflows, see the CLI Reference for complete documentation of all available commands and flags.