7 releases (4 breaking)
Uses new Rust 2024
| new 0.5.1 | May 25, 2026 |
|---|---|
| 0.5.0 | May 3, 2026 |
| 0.4.1 | Apr 29, 2026 |
| 0.3.0 | Apr 2, 2026 |
| 0.1.0 | Feb 24, 2026 |
#1852 in Encoding
49KB
962 lines
transmcap
transmcap is a CLI that decodes MCAP messages through mcapdecode and writes results as JSON Lines, CSV, or Parquet.
Installation
cargo install transmcap
Usage
transmcap <command> <input.mcap> [options]
Commands:
convert: convert MCAP messages tojsonl/csv/parquetschema: print inferred field schema for a topic
Supported Schema Encodings
transmcap uses McapReader::with_default_decoders(). Supported encoding pairs:
| Schema encoding | Message encoding | Required mcapdecode feature |
Notes |
|---|---|---|---|
protobuf |
protobuf |
protobuf |
Uses schema.data as FileDescriptorSet |
ros2msg |
cdr |
ros2msg |
ROS 2 .msg schema |
ros2idl |
cdr |
ros2idl |
ROS 2 IDL schema |
mcapdecode default features are protobuf, ros2msg, ros2idl.
convert Options
-f, --format <FORMAT>:jsonl | csv | parquet(default:jsonl)-t, --topic <TOPIC>: topic name to convert (required)-o, --output <PATH>: output file path (jsonl/csvdefaults to stdout)--list-policy <POLICY>:drop | keep | flatten-fixed--list-flatten-size <N>: only valid with--list-policy flatten-fixed--array-policy <POLICY>:drop | keep | flatten--map-policy <POLICY>:drop | keep--fields <FIELDS>: comma-separated field paths to include (applied before flattening)-p, --parallel: enable parallel chunk decompression and decoding
schema Options
-t, --topic <TOPIC>: topic name (required)-o, --output <PATH>: output file path (default: stdout)
Policy Behavior
convert flattens Arrow RecordBatch columns before writing.
list-policy(List):drop | keep | flatten-fixedarray-policy(FixedSizeList):drop | keep | flattenmap-policy(Map):drop | keepstruct-policy(Struct): fixed by format (not a CLI option)
Semantics:
drop: skip the columnkeep: keep the column as-isflatten-fixed: expand list to fixed columns (name.0,name.1, ...)flatten: expand child fields into separate columns
If --list-flatten-size is set without --list-policy flatten-fixed, command returns an error.
Format Defaults
| Format | list-policy | array-policy | map-policy | struct-policy | list-flatten-size |
|---|---|---|---|---|---|
jsonl |
keep |
keep |
keep |
keep |
1 |
csv |
drop |
drop |
drop |
flatten |
1 |
parquet |
keep |
keep |
keep |
flatten |
1 |
CLI flags override defaults.
Examples
JSON Lines
transmcap convert sample.mcap --format jsonl --topic /imu/data [-o imu.jsonl]
CSV
transmcap convert sample.mcap --format csv --topic /imu/data [-o imu.csv]
Parquet to file
parquet output requires -o/--output:
transmcap convert sample.mcap --format parquet --topic /imu/data -o imu.parquet
Custom flatten policy
transmcap convert sample.mcap --format parquet --topic /imu/data \
--list-policy drop --array-policy flatten --map-policy drop \
-o out.parquet
Print schema
transmcap schema sample.mcap --topic /imu/data
Notes
--topicis required for both commands.parquetrequires-o/--output.convertruns sequentially by default; use-p/--parallelto enable parallel chunk decompression and decoding.- Column name collisions during flattening return an error.
Development
cargo run -p transmcap -- <command> <input.mcap> [options]
cargo test -p transmcap
Dependencies
~46MB
~1M SLoC