mcap
A library for reading and writing MCAP files
0.25.0
9.0M downloads/mo
#3296 most downloaded on crates.io
foxglove/mcap
What this package is like to depend on
Last release 2 months ago
11 Jun 2026
Release timing varies
gaps range from 2 weeks to 6 months
Rarely documented
notes for 3 of 35 stable releases
2 versions withdrawn
withdrawn after publishing
4 years old
37 releases · first in 2022
3 releases in the last 12 months
see the full history below
Release timeline
37 releases · Sep 2022 to Jun 2026Releases
latest 37-
0.25.011 Jun 2026Release notes
Open source →Added
Writer::add_schema_with_idandWriter::add_channel_with_idfor writing records with explicit IDs without content de-duplication, so distinct IDs from a source file are preserved even when content is identical (#1632).- Public
mcap::VERSIONandmcap::LIBRARY_IDENTIFIERconstants (#1702). WriteOptions::DEFAULT_CHUNK_SIZEconstant.
Changed
- Default writer
Header.librarystring is nowmcap-rust/<version>(wasmcap-rs-<version>) (#1702). Breaking for anyone asserting on the exact string. - Default chunk size increased to 1 MiB (was 768 KiB), standardizing with the other MCAP libraries (#1659).
- Established a minimum supported Rust version (
rust-version = "1.81") (#1710). - Dependency bumps:
binrw0.12 → 0.15,thiserror1 → 2 (#1705, #1710).
Removed
- Removed unused
McapErrorvariantsAttachmentInProgress,RecordTooShort, andUnexpectedChunkRecord(#1494). Breaking for code matching on these variants.
Fixed
- Corrected typos in several
McapErrormessages (e.g.expeted→expected,mulitple→multiple) — note these are user-visible error string changes (#1492). - Fixed typos and inaccurate references in doc comments, including
ChunkIndex::compressed_data_offsetnow correctly documentingBadChunkStartOffset(#1607, #1516).
-
0.24.002 Dec 2025Nothing published for this version
-
0.23.404 Nov 2025Nothing published for this version
-
0.23.322 Aug 2025Nothing published for this version
-
0.23.201 Aug 2025Nothing published for this version
-
0.23.103 Jul 2025Nothing published for this version
-
0.23.030 Jun 2025Nothing published for this version
-
0.22.127 Jun 2025Nothing published for this version
-
0.22.019 Jun 2025Nothing published for this version
-
0.21.019 Jun 2025Nothing published for this version
-
0.20.018 Jun 2025Nothing published for this version
-
0.19.012 Jun 2025Nothing published for this version
-
0.18.030 Apr 2025Nothing published for this version
-
0.17.009 Apr 2025Nothing published for this version
-
0.16.026 Mar 2025Nothing published for this version
-
0.15.127 Feb 2025Nothing published for this version
-
0.15.005 Feb 2025Nothing published for this version
-
0.14.129 Jan 2025Nothing published for this version
-
0.14.007 Jan 2025Nothing published for this version
-
0.13.306 Jan 2025Nothing published for this version
-
0.13.219 Dec 2024Nothing published for this version
-
0.13.116 Dec 2024Nothing published for this version
-
0.13.008 Dec 2024Nothing published for this version
-
0.12.002 Dec 2024Nothing published for this version
-
0.11.030 Oct 2024Nothing published for this version
-
0.9.214 Aug 2024Nothing published for this version
-
0.9.124 Jun 2024Nothing published for this version
-
0.9.001 Nov 2023Nothing published for this version
-
0.8.004 Oct 2023Nothing published for this version
-
0.7.128 Jul 2023Nothing published for this version
-
0.6.002 Dec 2022Nothing published for this version
-
0.5.017 Oct 2022Nothing published for this version
-
0.4.016 Oct 2022Nothing published for this version
-
0.3.030 Sep 2022Release notes
Open source →Breaking changes
mcap filteris now lossless by default: metadata and attachments are kept unless you pass the new--exclude-metadata/--exclude-attachmentsflags. The old--include-metadata/--include-attachmentsflags are now hidden deprecated no-ops that warn on stderr. (#1756)mcap filter --start/--endnow apply to messages only; attachments are no longer dropped when theirlog_timefalls outside the window (use--exclude-attachmentsto drop them). (#1756)mcap filter,mcap compress, andmcap decompressno longer silently re-sort indexed inputs: an out-of-order indexed file was previously re-sorted to log time, but the default is now--order preserve(keep stored message order). Pass--order log_timeto restore the previous behavior. (#1762)- Rewrite commands (
filter,compress,decompress,sort) now write records in a standardized physical layout (metadata after the header → messages → attachments before Data End), so byte-level output can differ from 0.2.0 even when logical content is unchanged. (#1756, #1757)
New features
- Shared
--order <preserve|log_time|topic>flag onfilter,compress,decompress, andsort.preservekeeps stored order,log_timesorts by ascending log time (log-timealias), andtopicgroups each channel's messages together (channels by topic name then channel ID), placing each channel in its own chunk(s) when chunking is enabled for contiguous single-topic reads. Note thattopicalways buffers the selected messages in memory, andlog_timebuffers them when the input has no summary. (#1762, #1754, #1757) mcap filtergains--exclude-metadataand--exclude-attachmentsto opt out of the new lossless default. (#1756)mcap filtergains--no-chunks(write records outside of chunks). (#1763)mcap filter,compress, anddecompressgain--no-crc(disable all output CRC fields), matchingconvert/merge/sort. (#1763)mcap sortgains an overridable--orderflag (defaults tolog_time), and its input and output are now optional — it reads from stdin and writes to stdout when omitted. (#1757)- Expanded and corrected
--helptext across commands (remote URL inputs and--allow-remote-scan, log-time semantics for time filters, correctedcat --jsonencoding names, attachment retrieval, and in-placeaddcorruption warnings), and hid the deprecated--start-nsecs/--end-nsecsflags from help (they remain accepted). (#1774)
Bug fixes
mcap cat --jsonnow emits protobuf fields set to their proto3 default value (e.g.0,"",false, enum zero-variants) instead of omitting them from the output. (#1765)- Rewrite commands no longer silently drop messages when an indexed input's
Statisticsrecord disagrees with its chunk message indexes (or a message index can't be parsed); the engine falls back to a linear scan. (#1771) mcap compress --compressioninvalid values are now rejected at parse time (exit code 2,[possible values: zstd, lz4, none]) instead of failing at runtime. (#1767)
Deprecations
These flags were renamed for consistency across the rewrite commands; the old names still work as hidden aliases that print a stderr warning, so existing invocations keep functioning.
mcap filter --output-compressionrenamed to--compression, matchingsortand the other rewrite commands (which already used--compression);--compressionwins if both are set. (#1761)mcap sort --output-filerenamed to--output(-ois unchanged), matching the other rewrite commands — previously onlysortandmergeused--output-file.filter,compress, anddecompressalso accept the deprecated--output-fileas a hidden alias for uniformity. (#1757)mcap merge --output-filerenamed to--output(-ois unchanged), for the same cross-command consistency. (#1771)
Performance
- Bounded memory for piped stdin: rewrite commands now spool non-seekable stdin to a temporary file and memory-map it instead of buffering the whole MCAP in memory. (#1759)
- Standardizing record placement adds an up-front metadata scan on the linear (summaryless or fallback) path, a modest throughput regression (~12–22% in benchmarks); well-formed indexed inputs are unaffected. (#1756)
-
0.2.022 Sep 2022Release notes
Open source →New features
mcap list attachments,mcap list metadata,mcap get attachment, andmcap get metadatacan read local MCAP files that omit summary/index records by scanning when needed. (#1723)mcap mergenow guarantees log-time ordered output, using command-line file order and per-file input order as stable tie-breakers for equal timestamps. (#1730)
Bug fixes
mcap doctornow reports invalidStatisticschannel counts that lack prior summaryChannelrecords. (#1722)mcap infonow reports numeric counts for files without aStatisticsrecord instead ofunknownwhen the data can be derived. (#1725)mcap doctornow treats spec-legal out-of-order top-level message times as warnings by default, while--strict-message-orderstill errors. (#1724)- Output-writing commands now reject local output paths that resolve to the input file before truncating or writing. (#1729)
- Tarball/source-archive builds now stamp the short commit SHA into
mcap --versioninstead of reportingunknown. (#1727) mcap doctor -vno longer emits the low-valueExamining ...progress line on clean diagnostics. (#1731)- Human-readable byte output now consistently uses decimal SI units (
kB,MB,GB), and throughput labels use/s. (#1733)
Performance
- Added Criterion command benchmarks for
merge,filter,sort,compress, anddecompress; this is benchmark coverage rather than a runtime performance change. (#1732)
-
0.1.112 Sep 2022 withdrawnNothing published for this version
-
0.1.012 Sep 2022 withdrawnRelease notes
Open source →The
mcapCLI has been rewritten in Rust. It is a drop-in replacement for the
previous release (v0.0.x) with the same commands, a smaller binary, new remote
and read capabilities, and a number of other changes described below.New features
- Expanded remote reads: added HTTP(S) and Azure Blob Storage, alongside the
existing Amazon S3 and Google Cloud Storage support. Indexed reads (info,
list, single-recordget) use the file index to fetch only the bytes they
need, with no full download. - Self-contained ROS 2
.db3conversion.mcap convertreads the message
definitions embedded in ROS 2 bags (Iron and later) — no sourced workspace or
--ament-prefix-pathrequired. - Reads and sorts files without an index.
mcap catnow reads local files
that have no index by scanning them in file order, andmcap sortnow sorts
unindexed files, instead of refusing them. - Reads from pipes.
cat,filter,compress, anddecompressaccept piped
(non-seekable) stdin, soproducer | mcap filter -o out.mcapworks. - Reads files with missing or incomplete summaries.
info,list, andcat
fall back to scanning the data section when the summary is absent or incomplete
(printing asummary section not available; full scan may be slowwarning to
stderr), and resolve schemas/channels that are defined only inside chunks — the
previous CLI silently reported such files as empty. - Smaller binary: roughly half the size. The Linux amd64 binary is 14.3 MB,
down from 28.3 MB.
Bug fixes
mcap doctorno longer crashes when examining files with malformed summary
records (a truncated or corrupt ChunkIndex, AttachmentIndex, Schema, Channel,
Message, Metadata, MetadataIndex, or Header record previously caused a
segmentation fault).mcap recoveralways produces a valid, readable output file. Recovery
previously could write internally inconsistent chunk indexes for some inputs.mcap filtertopic-regex filtering behaves correctly.
Previously, when--include-topic-regexmatched no channels (or
--exclude-topic-regexmatched every channel), the resulting empty topic set
was treated as "no filter" and every message was silently passed through. Both
cases now produce an empty result, as expected.- No more crashes or silent data loss on malformed files. On chunk-indexed
files whose summary does not fully list their channels and schemas (disallowed
by the MCAP spec), the previous CLI could segfault and leave a corrupt partial
output (sort), or silently write a file containing none of the input's
messages (compress). The new CLI fails with a clear, actionable error
pointing tomcap recover. - Attachments are no longer silently dropped by
compress,decompress, and
filter. The previous CLI omitted attachments that weren't listed in an
attachment index; they are now preserved and indexed in the output. mcap dutotals now add up to the file size. Each record's reported size
includes its on-disk framing (the 1-byte opcode + 8-byte length prefix), and
attachment records are now included in the table; previously both were omitted,
so the totals undercounted the file. Percentages are computed in double
precision, removing rounding artifacts in the last digits (e.g.66.666667).
Removed
mcap versionsubcommand — usemcap --version, which now reports both the
CLI and library versions (replacingmcap version --library).--configglobal flag (no$HOME/.mcap.yamlconfig file) — the flag was
never actually used; no command ever read a value from the config file.--pprof-profileglobal flag.convert --ament-prefix-path— ROS 2.db3conversion now uses embedded
message definitions.compress --unchunked— compressed output is always chunked by definition.recover --always-decode-chunk— chunks are now always decoded.
Other changes
mcap recoversignals data loss through its exit code:0= full recovery,
3= recovered but lossy/truncated,1= nothing recovered. Previously it exited
0as long as recovery started, even when data was lost. It now defaults to
--compression preserve(waszstd) and always decodes and re-encodes every
chunk to guarantee valid output.mcap convertselects the input type by file extension (.bagfor ROS 1,
.db3for ROS 2) instead of inspecting file contents, so inputs must use a
recognized extension. To convert pre-Iron.db3bags that have no embedded
message definitions, useros2 bag convertfirst.- Writing over the input file is refused by
sortandconvert. Using the
same path for input and output previously truncated the input and lost data. - Invalid
--compressionvalues are now rejected everywhere instead of being
silently accepted. mcap add metadatarejects duplicate--keynames instead of silently
keeping the last value, and now allows=inside values (e.g.-k key=a=b).mcap completion <shell>now also supportselvish(in addition tobash,
zsh,fish, andpowershell), and rejects an unknown shell name with a usage
error instead of printing help.mcap doctorreports every structural problem it finds and writes all
diagnostics to stderr (previously it stopped at the first error and wrote some
warnings to stdout).- Usage/argument errors exit with code
2(the conventional code) and errors
are prefixed withError:on stderr. - CRC/chunk flags renamed:
--include-crc→--no-crcand--chunked→
--no-chunksonconvert,merge, andsort(effective defaults unchanged). - New global flags:
--color {auto,always,never},-v/--verbose
(repeatable), and--allow-remote-scan. - Remote whole-file scans require
--allow-remote-scan. Indexed reads
(info,list, single-recordget) need no flag, but commands that read or
download the whole file (filter,merge,convert,recover, or any
linear-scan fallback) require it. With multiple remote inputs, each is
downloaded independently, so peak temporary disk usage can approach the combined
input size. - Rewritten files record the CLI as the writing library
(Header.library = mcap-cli/<version> mcap-rust/<version>) forcompress,
decompress,filter,sort,recover,merge, andconvert, and no longer
carry forward the source file'slibraryvalue.mcap addleaves the original
header untouched. mcap infonow sorts compression lines, renders wall-clock start/end times
in UTC, and shows absolute RFC3339 timestamps only for recordings dated
2000-01-01 or later (older/relative timestamps render as decimal seconds).
- Expanded remote reads: added HTTP(S) and Azure Blob Storage, alongside the