Skip to main content

MCAP Tools: Rust and Python writing and video export

CI PyPI

Write standard MCAP recordings with separate chunk groups for video and telemetry, encode and decode ROS 2/Foxglove messages, and export camera topics from MCAP to MP4. Python and Rust share the official Rust MCAP writer through a small grouping layer. Maintained by Hebbian Robotics; this is an independent Foxglove-compatible project, not an official Foxglove product.

Install

uv add 'hebbian-mcap==0.1.1'

Prebuilt CPython 3.11+ wheels support Linux (glibc 2.17+, x86_64/aarch64), macOS (x86_64/aarch64) and Windows (x86_64), without a Rust installation. Source builds require Rust 1.92+. The Rust crate is available through a pinned Git dependency and is not published to crates.io; see the Rust crate guide.

Write grouped MCAP recordings

from hebbian_mcap import GroupedMcapWriter, NO_SCHEMA_ID

with GroupedMcapWriter("recording.mcap") as writer:
    channel = writer.register_channel("/state", "json", NO_SCHEMA_ID, group="telemetry")
    writer.write_message(channel, 123, b'{"position": 1}')

Groups buffer independently, so indexed readers can select camera data without fetching telemetry chunks, or vice versa. Standard MCAP compression, indexes, metadata and attachments are preserved. Python path outputs are published atomically; caller-owned streams stay open.

See the writer behavior reference for timestamps, flush rules and lifecycle. For reading, use the official Python MCAP reader.

Read and rewrite video messages

Read a channel's CompressedVideo messages, or replace a payload and keep every other field:

from hebbian_mcap import CompressedVideoCodec

codec = CompressedVideoCodec(channel.message_encoding, schema.encoding, schema.name, schema.data)
video = codec.decode(message.data)
repaired = codec.replace_data(message.data, new_payload)

Foxglove protobuf and ROS 2 CDR channels are supported. CDR messages are read through the channel's schema, so fields a recorder added are preserved. See standard messages.

Export MCAP camera video to MP4

Install the video extra, then select a camera topic:

uv add 'hebbian-mcap[video]==0.1.1'
mcap-export recording.mcap front.mp4 --topic /cameras/front/video

The equivalent Python API is:

from pathlib import Path
from hebbian_mcap.video import export_mcap_camera

result = export_mcap_camera(
    Path("recording.mcap"), Path("front.mp4"), camera_topic="/cameras/front/video"
)

Export requires at least two frames and fixed dimensions. It preserves log-time gaps, leaves the source unchanged and refuses to overwrite an existing output. See video export behavior for supported formats, timing and limits.

Only the video extra installs PyAV, NumPy and message decoders. The base Python writer and Rust crate do not need video codecs. hebbian_mcap.h264 provides standard-library-only Annex B inspection and repair helpers.

References and development

Rust/Python code uses Apache-2.0, with MIT exceptions described in NOTICE. Browser utilities use MIT.

Browser playback

The TypeScript library provides HTTP byte-range reading for MCAP, H.264 remuxing to MP4 and a shared playback clock for multiple cameras. It is independent of the Rust/Python writer and any robot application.

Metadata

Release files for hebbian-mcap 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hebbian-mcap 0.1.1
File Size Uploaded Provenance Actions
hebbian_mcap-0.1.1.tar.gz 45.1 kB Without provenance Details for hebbian_mcap-0.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for hebbian-mcap 0.1.1
File Actions
hebbian_mcap-0.1.1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for hebbian_mcap-0.1.1-cp311-abi3-win_amd64.whl
hebbian_mcap-0.1.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for hebbian_mcap-0.1.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
hebbian_mcap-0.1.1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for hebbian_mcap-0.1.1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
hebbian_mcap-0.1.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for hebbian_mcap-0.1.1-cp311-abi3-macosx_11_0_arm64.whl
hebbian_mcap-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for hebbian_mcap-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 3.2 MB

Release files / hebbian_mcap-0.1.1.tar.gz

Download URL hebbian_mcap-0.1.1.tar.gz
Size 45.1 kB
Tags Source
SHA-256 checksum
How to use checksums
89c41bfaedea4dc78f5c21015538b5ae19ee6ed764443b2fd3b5bcc636976b17
BLAKE2b-256 checksum
How to use checksums
360093440d933a7b0f6238cfbfc15ecaa63687bb93a735de1f5c68961a779b19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / hebbian_mcap-0.1.1-cp311-abi3-win_amd64.whl

Download URL hebbian_mcap-0.1.1-cp311-abi3-win_amd64.whl
Size 507.2 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
a7704c336cd77ebcc51c3b30ef4dc7b97e9b0c767a60b56d951f39c980833fe7
BLAKE2b-256 checksum
How to use checksums
6417ec82211116102e6a1fd35daa07ca01f16c004dee3976d0a1d6d947fe22f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / hebbian_mcap-0.1.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL hebbian_mcap-0.1.1-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 708.2 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
b596562a8be241de0ab4e404f9859e43640ade2ff270558fad7ebef78540d1f0
BLAKE2b-256 checksum
How to use checksums
18cc0ea8816b7c8c97f661d5af6016cb4f9878dc31014fe6129ab1cc70c97332
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / hebbian_mcap-0.1.1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL hebbian_mcap-0.1.1-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 709.2 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
8c4289507648799032a84804a4b13c47ea5c5ff606cb78aa4ef3a2664a5df342
BLAKE2b-256 checksum
How to use checksums
21631bb0a63aac128c9eb627cd255ad2a9dac9100efb3ed8450aec5d35344634
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / hebbian_mcap-0.1.1-cp311-abi3-macosx_11_0_arm64.whl

Download URL hebbian_mcap-0.1.1-cp311-abi3-macosx_11_0_arm64.whl
Size 578.2 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
cc319552d6514b5210a14ce3099cb07b6804e7bf5e20d99fef88664439bca213
BLAKE2b-256 checksum
How to use checksums
48c8212378fe1cd2fb9030a50032e0f3a43131965b20cd84d615187776d7b812
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / hebbian_mcap-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL hebbian_mcap-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl
Size 634.3 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9ab2dd5c1ff0b665968ffa08dbc122a49778a5d303e2bc40c12a1953432e737f
BLAKE2b-256 checksum
How to use checksums
bda36d9e987cc4c6f6b5c61ac1beed8df46db31c03b1b935591244dbd80ee22b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for hebbian-mcap 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page