rosbags
Pure Python library to read, modify, convert, and write rosbag files.
What it is and what it does
Rosbags is a pure Python library for reading, writing, and converting ROS bag files without requiring ROS to be installed. It supports both rosbag1 (the original format) and rosbag2 (the newer format), and includes an extensible type system for serializing and deserializing message data. The library was developed for MARV robotics and can be used standalone or alongside ROS1 or ROS2 installations.
The package provides high-level interfaces for common tasks like reading messages from a bag file and deserializing them into Python objects, as well as command-line tools for converting between rosbag formats. Its dependencies are minimal and well-established (numpy, lz4, zstandard for compression, ruamel.yaml for configuration, and apsw for database access), making it straightforward to integrate into robotics data pipelines or analysis workflows.
Use it for:
- Extract and analyze sensor data (IMU, camera, lidar) from rosbag files in a Python script without installing ROS.
- Convert rosbag1 files to rosbag2 format or vice versa using the rosbags-convert command-line tool.
- Build data processing pipelines that read rosbag messages, deserialize them, and feed them into machine learning or analysis frameworks.
- Inspect and validate rosbag file contents programmatically to verify message types and topics before processing.
- Integrate rosbag reading into CI/CD workflows or cloud-based systems where a full ROS installation is impractical.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Read, write, convert, and deserialize ROS bag files (rosbag1 and rosbag2 formats) without requiring ROS itself to be installed.
Yes. Rosbags is actively maintained, has no known vulnerabilities, supports current Python versions (3.10–3.14), and solves a real problem for robotics engineers who need to work with bag files outside a ROS environment. The pure Python implementation and low dependency footprint make it easy to integrate. Install it if you work with ROS data and need portable, lightweight bag file access.
Install
rosbags on PyPI
pip
pip install rosbagsuv
uv add rosbagspoetry
poetry add rosbagsInstalling rosbags
Before you install
Low friction: pure Python wheel with six runtime dependencies (apsw, lz4, numpy, ruamel.yaml, typing_extensions, zstandard). Actively maintained with a release 2 days ago.
License in practice
Apache-2.0 permissive license allows use in commercial and private projects with minimal restrictions.
Quickstart
pip install rosbags
from rosbags.highlevel import AnyReader
from rosbags.typesys import Stores, get_typestore
from pathlib import Path
typestore = get_typestore(Stores.ROS2_FOXY)
with AnyReader([Path('bagfile')], default_typestore=typestore) as reader:
for connection, timestamp, rawdata in reader.messages():
msg = reader.deserialize(rawdata, connection.msgtype)
Requires Python 3.10 or later.
Verify before relying
- Performance characteristics when handling large rosbag files or many messages in sequence.
- Whether the type store covers all ROS distributions or only a subset of common ones.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — apsw, lz4, numpy, ruamel.yaml, typing_extensions, zstandard |
| Maintenance | actively maintained — 2 days since the last release |
| First released | |
| Downloads | 732,647/month — #5,201 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: rosbags-0.11.4-py3-none-any.whl
Keywords: cdr, conversion, deserialization, idl, mcap, message, msg, reader, ros, ros2, rosbag, rosbag2, serialization, writer
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
mcap-ros2-supportAdds ROS2 message deserialization support to…
permissive · top 15,000 on PyPI
pyros-genmsgGenerates ROS message and service data…
permissive · top 15,000 on PyPI
pyulogParses ULog files (a self-describing logging…
permissive · top 15,000 on PyPI
rospkgProvides Python access to ROS package metadata…
permissive · top 15,000 on PyPI
mcap-ros1-supportAdds ROS1 message serialization and…
permissive · top 15,000 on PyPI
catkin-pkgParses and manages Catkin package metadata and…
permissive · top 5,000 on PyPI
pypcd4pypcd4 reads, writes, and manipulates Point…
permissive · top 15,000 on PyPI
FlowIOFlowIO reads and writes Flow Cytometry Standard…
permissive · top 15,000 on PyPI
bdbagbdbag creates, validates, and manages BagIt…
permissive · top 15,000 on PyPI
rosdistroParses and manipulates ROS distribution…
permissive · top 15,000 on PyPI