MCAP file format specification knowledge: binary structure, record types, indexing strategies, compression options, and best practices for creating MCAP files that optimize Lichtblick reading performance.
69%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./.github/skills/mcap-format/SKILL.mdMCAP is an open-source container format for heterogeneous timestamped data, designed for high-performance reading of robotics/autonomous driving recordings.
Specification: https://mcap.dev/spec
Documentation:
┌─────────────────────────────────────────┐
│ Magic bytes (8 bytes) │
├─────────────────────────────────────────┤
│ Header record │
│ - profile: "ros1" | "ros2" | "" │
│ - library: writer identifier │
├─────────────────────────────────────────┤
│ DATA SECTION │
│ Schema records │
│ Channel records │
│ Message records (bulk of file) │
│ Attachment records (optional) │
│ Metadata records (optional) │
│ ─── grouped into Chunks ─── │
├─────────────────────────────────────────┤
│ DataEnd record │
├─────────────────────────────────────────┤
│ SUMMARY SECTION (optional but critical) │
│ Schema records (copy) │
│ Channel records (copy) │
│ ChunkIndex records │
│ AttachmentIndex records │
│ MetadataIndex records │
│ Statistics record │
├─────────────────────────────────────────┤
│ Footer record │
│ - summarySectionOffset │
│ - summarySectionCrc │
├─────────────────────────────────────────┤
│ Magic bytes (8 bytes) │
└─────────────────────────────────────────┘profile: Identifies message conventions (e.g., "ros1", "ros2")library: Identifies the writing library (for debugging)id: Unique schema identifier within the filename: Schema name (e.g., "sensor_msgs/PointCloud2")encoding: How to interpret schema data ("ros1msg", "ros2msg", "protobuf", "flatbuffer", "jsonschema", "ros2idl")data: Raw schema definition bytesid: Unique channel identifiertopic: Topic name (e.g., "/camera/image")schemaId: References a Schema recordmessageEncoding: How messages are serialized ("ros1", "cdr", "json", "protobuf", "flatbuffer")metadata: Key-value pairs (e.g., callerid for ROS 1 publisher identification)channelId: Which channel this message belongs tologTime: When the message was recorded (nanoseconds)publishTime: When the message was originally published (nanoseconds)data: Raw serialized message bytessequence: Optional sequence numbercompression: "zstd" | "lz4" | "" (none)data: Compressed block containing Schema + Channel + Message recordslogTimemessageStartTime / messageEndTime: Time range of messages in this chunkchunkOffset: Byte offset of the chunk in the filemessageIndexOffsets: Per-channel index within the chunkmessageCount: Total messages in filechannelMessageCounts: Per-channel message countsschemaCount: Number of schemaschannelCount: Number of channelschunkCount: Number of chunksmessageStartTime / messageEndTime: Global time boundsMcapIndexedReader → McapIndexedIterableSourceMcapStreamReader → McapUnindexedIterableSource| Algorithm | Ratio | Decompress Speed | Best For |
|---|---|---|---|
zstd | Excellent (~3-5x) | Fast | Storage, archival, remote files |
lz4 | Good (~2-3x) | Very fast | Real-time recording, low-latency playback |
| None | 1:1 | Instant | Debugging, maximum seek speed |
wasm-zstd, wasm-lz4, wasm-bz2)loadDecompressHandlers() is a singleton — loads once, shared across all readerslogTime ordering within chunkszstd (minimize download size, acceptable decompress cost)lz4 (fastest decompress, acceptable file size)lz4 or none (lowest CPU overhead during recording)| MCAP Concept | Lichtblick Code |
|---|---|
| Indexed reading | McapIndexedReader (from @mcap/core) |
| Streaming reading | McapStreamReader (from @mcap/core) |
| Indexed source | McapIndexedIterableSource.ts |
| Unindexed source | McapUnindexedIterableSource.ts |
| File readable | BlobReadable.ts (local), RemoteFileReadable.ts (HTTP Range) |
| Remote read coalescing | BatchingReadable.ts (merges nearby read() calls in a microtask tick) |
| Decompression | packages/mcap-support/src/decompressHandlers.ts |
| Schema parsing | packages/mcap-support/src/parseChannel.ts |
| 10s read-ahead (default) | BufferedIterableSource (DEFAULT_READ_AHEAD_DURATION = { sec: 10, nsec: 0 }) |
| Reverse iteration | McapIndexedIterableSource.getBackfillMessages() |
lichtblick-suite/lichtblick
9589f38
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.