Convert a ROS 2 .db3 bag to MCAP (and play Jazzy bags in Humble)

Convert a ROS 2 .db3 bag to MCAP (and play Jazzy bags in Humble)

Short answer: ros2 bag convert -i my_bag -o out.yaml, where out.yaml sets storage_id: mcap. On Humble you first need sudo apt install ros-humble-rosbag2-storage-mcap. Without it, the convert fails and leaves an empty output folder behind, and that folder blocks your next try. If the bag came from Jazzy, Humble can't read its metadata.yaml. Point Humble at the .mcap file itself and pass a QoS override file.

What happened when I ran it — measured results table
At a glance: the main measured table from this article. Full details below.

What happened when I ran it

I recorded a small bag (/chatter, std_msgs/msg/String at 10 Hz for about 5 seconds) in the official ros:humble-ros-base and ros:jazzy-ros-base Docker images on 2026-10-26. Then I converted it in both directions and opened the Jazzy bag from Humble.

Results at a glance (Docker ros:humble-ros-base / ros:jazzy-ros-base, 2026-10-26)
What I ran Distro Result
sqlite3 → MCAP on the stock image Humble Fails: Could not load/open plugin with storage id 'mcap'
Same convert after installing ros-humble-rosbag2-storage-mcap Humble Fails: Database directory already exists (empty folder from the first run)
Same convert after deleting that folder Humble Works, 48 of 48 messages
MCAP → sqlite3 Jazzy Works first try, 42 of 42 messages
ros2 bag info on the Jazzy bag directory Humble Fails: yaml-cpp bad conversion
ros2 bag info on the .mcap file Humble Works
ros2 bag play (.mcap, reindexed copy, or converted sqlite3) Humble Fails, recorder got 0 messages
ros2 bag play with --qos-profile-overrides-path Humble Works, 42 of 42 messages

1. Humble: sqlite3 → MCAP

Humble records to sqlite3 by default. Its help text says so:

-s {sqlite3,my_test_plugin}, --storage {sqlite3,my_test_plugin}
                      storage identifier to be used, defaults to 'sqlite3'

The output YAML I used:

output_bags:
- uri: h_mcap
  storage_id: mcap
  all_topics: true

On the stock image the convert fails:

$ ros2 bag convert -i h_sqlite -o to_mcap.yaml
[ERROR] [rosbag2_storage]: Could not load/open plugin with storage id 'mcap'
No storage could be initialized. Abort

The MCAP plugin is a separate package on Humble. Install it:

sudo apt install ros-humble-rosbag2-storage-mcap

(The version I got was 0.15.17.) After that, mcap shows up in --storage. But running the same convert again failed in a new way:

Database directory already exists (h_mcap), can't overwrite existing database

The first failed run had already created an empty h_mcap/ directory. Delete it (rm -rf h_mcap) and the convert works:

$ ros2 bag info h_mcap
Files:             h_mcap_0.mcap
Bag size:          5.5 KiB
Storage id:        mcap
Duration:          4.672787243s
Messages:          48
Topic information: Topic: /chatter | Type: std_msgs/msg/String | Count: 48 | Serialization Format: cdr

All 48 messages came through. The data file went from 24,576 bytes (.db3) to 4,674 bytes (.mcap). That ratio comes from a tiny test bag, so don't expect the same on a real one.

2. Jazzy: MCAP is already the default

-s {sqlite3,mcap}, --storage {sqlite3,mcap}
                      Storage identifier to be used, defaults to 'mcap'.

The MCAP plugin ships with ros:jazzy-ros-base, so there's nothing to install. Converting back to sqlite3 with storage_id: sqlite3 worked on the first try (42 of 42 messages). Bags recorded on Jazzy are already MCAP.

The switch happened in Iron, not Jazzy. The Iron release notes say "This release switches to using mcap as the default file format for writing new bags" (ros2/rosbag2#1160). So Iron, Jazzy, Kilted and Rolling all record MCAP by default, and sqlite3 is still available with -s sqlite3. The metadata version numbers in the next section come from rosbag2_storage/include/rosbag2_storage/bag_metadata.hpp: int version = 5; on the humble branch and int version = 9; on jazzy, kilted and rolling.

3. Opening a Jazzy bag in Humble

Jazzy writes metadata.yaml as version: 9. Humble writes version: 5. Pointing Humble at the bag directory fails for both info and play:

$ ros2 bag info j_mcap
Exception on parsing info file: yaml-cpp: error at line 15, column 11: bad conversion

Line 15 is offered_qos_profiles. Jazzy writes it as a YAML list with history: unknown. Humble expects it as a string. The plain info problem goes away if you pass the .mcap file instead of the directory, which skips the file Humble can't read:

$ ros2 bag info j_mcap/j_mcap_0.mcap
Files:             j_mcap/j_mcap_0.mcap
Bag size:          6.1 KiB
Storage id:        mcap

Playing it was a different story. Each of these failed with yaml-cpp: error at line 1, column 12: bad conversion and published nothing (a recorder running alongside caught 0 messages):

  • ros2 bag reindex on a copy of the .mcap. It writes a fresh version: 5 metadata.yaml and info works, but play still fails.
  • A sqlite3 bag converted from the Jazzy .mcap inside Humble. The convert reports 42 messages, but the bad QoS string comes along with them.

What worked is overriding the recorded QoS at play time:

# qos.yaml
/chatter:
  reliability: reliable
  durability: volatile
  history: keep_last
  depth: 10
ros2 bag play j_mcap/j_mcap_0.mcap --qos-profile-overrides-path qos.yaml

With that, a recorder on the Humble side got all 42 messages, both from the .mcap file directly and from the reindexed copy. If your bag has many topics, the override file needs an entry for each topic you want to play.

Match each override to the topic's original QoS. My /chatter test used durability: volatile. A latched topic such as /tf_static needs transient_local, or late subscribers get nothing. (Not run in our containers. The rosbag2 maintainers describe this effect in PR #2553.)

Update, 2026-11-24: rosbag2 has fixed this for Humble. ros2/rosbag2#2553 was merged into the humble branch on 2026-11-05. It makes Humble read the version 9 offered_qos_profiles list and the QoS policy names that Jazzy and newer write. The PR's own test shows info and play working on both the bag directory and the bare file. It came after my 2026-10-26 test, and as of 2026-11-24 it is not in a Humble release yet (the latest is 0.15.17). Check ros2 pkg xml rosbag2_storage | grep version. A version newer than 0.15.17 should include the fix. Until then, use the override file above.

Gotchas

  • Delete the output folder after a failed convert. Otherwise you get "Database directory already exists" and it looks like a new problem.
  • Use all: true if the same YAML must work on Humble and Jazzy. The rosbag2 README warns that the output bag is empty if no topic selection is given. In my Humble run, a YAML with only uri and storage_id still copied all 48 messages. The source code explains why. Humble's output options read the key all, not all_topics, so the all_topics: true line in my YAML did nothing there. Humble's topic filter also takes every topic when nothing is selected. Jazzy reads all_topics and drops everything when nothing is selected, so the README warning applies there. Jazzy also accepts all: true for backward compatibility, and it selects all topics and all services. (Not run in our containers. This comes from record_options.cpp and topic_filter.cpp in ros2/rosbag2.)
  • The -i second value is the input storage. -i bag.mcap mcap tells convert how to read the input. The output format always comes from the YAML.
  • Not tested: Humble bags played on Jazzy, Iron or Rolling, compressed bags, and multi-GB bags.

Copy-paste version

# Humble only: add the plugin
sudo apt install ros-humble-rosbag2-storage-mcap

cat > to_mcap.yaml <<'EOF'
output_bags:
- uri: my_bag_mcap
  storage_id: mcap
  all_topics: true
EOF

rm -rf my_bag_mcap          # leftovers from a failed run block the write
ros2 bag convert -i my_bag -o to_mcap.yaml
ros2 bag info my_bag_mcap

Related: ROS 2 Humble EOL (May 2027) vs Jazzy vs Lyrical: which distro to use.

Related: if the converted MCAP bag is missing topics or comes out empty even though ros2 bag convert exited 0, see ros2 bag convert db3 to MCAP: missing topics, empty bag.

FAQ

How do I convert a ROS 2 sqlite3 bag to MCAP?

Run ros2 bag convert -i my_bag -o out.yaml, where out.yaml sets storage_id: mcap. On Humble, first install ros-humble-rosbag2-storage-mcap.

Why does convert fail with "Could not load/open plugin with storage id 'mcap'" on Humble?

The MCAP plugin is a separate package on Humble. Install it with sudo apt install ros-humble-rosbag2-storage-mcap. The version I got was 0.15.17.

What does "Database directory already exists" mean after a failed convert?

The first failed run had already created an empty output directory. Delete it (rm -rf h_mcap in my test) and the convert works.

Why can't Humble open a bag recorded on Jazzy?

Jazzy writes metadata.yaml as version: 9 with offered_qos_profiles as a YAML list, and Humble expects version: 5 with a string. Passing the .mcap file instead of the directory makes ros2 bag info work.

How do I play a Jazzy bag on Humble?

Point ros2 bag play at the .mcap file and pass --qos-profile-overrides-path qos.yaml. With that, a recorder on the Humble side got all 42 messages. The override file needs an entry for each topic you want to play.

Sources: rosbag2 README (humble), rosbag2 README (jazzy). Questions this answers: Convert ROS2 SQLite bag to MCAP format and Convert ROS2 bags from Jazzy to Humble. Related: splitting bags by size vs duration.