Skip to content

fix(mcap): support LZ4 frame compression in MCAP decompress handler#18

Merged
joaner merged 1 commit into
ioai-tech:mainfrom
42arch:main
Jul 3, 2026
Merged

fix(mcap): support LZ4 frame compression in MCAP decompress handler#18
joaner merged 1 commit into
ioai-tech:mainfrom
42arch:main

Conversation

@42arch

@42arch 42arch commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Description

Some MCAP writers (e.g., nuscenes2mcap in Python) compress chunks using the full LZ4 Frame format instead of the raw LZ4 Block format defined by the MCAP specification. This caused decompression to fail with "Incorrect chunk CRC" errors. Add auto-detection for the LZ4 frame magic number (0x184D2204) at the beginning of the chunk records buffer. If detected, decompress the chunk as an LZ4 frame using lz4js.decompress; otherwise, fall back to raw block decompression via lz4js.decompressBlock.

Motivation / related issue

I have a nuScenes dataset (https://mcap-proxy.lichtblick.workers.dev/NuScenes-v1.0-mini-scene-sample.mcap) converted to MCAP format via https://github.com/foxglove/nuscenes2mcap. Opening it in RosView fails with the error: "Failed to fetch messages Error: Incorrect chunk CRC 2684863747 (expected 1648207168) [library=nuscenes2mcap]" (as shown in the screenshot). This PR fixes the issue.

Type of change

  • Bug fix (non-breaking change that fixes an issue)

Checklist

  • npm run lint passes with no errors
  • npm test passes (unit tests)
  • npm run build and npm run build:lib succeed
  • New behavior is covered by tests (or explain why tests aren't applicable)
  • Documentation updated (README, API.md, EMBEDDING.md) if the public API changed
  • Breaking change: all affected call sites updated and migration path described in PR description

API compatibility

N/A

Screenshots / recordings

20260703-104926

@joaner joaner merged commit da07e0b into ioai-tech:main Jul 3, 2026
@joaner

joaner commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for the fix! The LZ4 frame detection is correct and the fallback keeps existing MCAP files working. Merged and released in v1.6.1. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants