pymcap-cli 0.2.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/PKG-INFO +116 -233
  2. pymcap_cli-0.4.0/README.md +332 -0
  3. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/pyproject.toml +7 -1
  4. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cli.py +24 -0
  5. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/cat_cmd.py +154 -96
  6. pymcap_cli-0.4.0/src/pymcap_cli/cmd/diag_cmd.py +526 -0
  7. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/info_cmd.py +2 -2
  8. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/info_data.py +17 -105
  9. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/info_link.py +35 -41
  10. pymcap_cli-0.4.0/src/pymcap_cli/cmd/plot_cmd.py +421 -0
  11. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/video_cmd.py +14 -7
  12. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/display_utils.py +148 -46
  13. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/image_utils.py +34 -9
  14. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/info_types.py +27 -98
  15. pymcap_cli-0.2.0/README.md +0 -453
  16. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/__init__.py +0 -0
  17. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/__init__.py +0 -0
  18. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/_run_processor.py +0 -0
  19. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/compress_cmd.py +0 -0
  20. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/convert_cmd.py +0 -0
  21. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/du_cmd.py +0 -0
  22. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/filter_cmd.py +0 -0
  23. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/info_json_cmd.py +0 -0
  24. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/list_cmd.py +0 -0
  25. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/merge_cmd.py +0 -0
  26. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/process_cmd.py +0 -0
  27. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/rechunk_cmd.py +0 -0
  28. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/records_cmd.py +0 -0
  29. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/recover_cmd.py +0 -0
  30. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/recover_inplace_cmd.py +0 -0
  31. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/roscompress_cmd.py +0 -0
  32. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/tftree_cmd.py +0 -0
  33. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/cmd/topic_chunks_cmd.py +0 -0
  34. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/debug_wrapper.py +0 -0
  35. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/http_utils.py +0 -0
  36. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/input_handler.py +0 -0
  37. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/mcap_processor.py +0 -0
  38. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/msg_resolver.py +0 -0
  39. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/osc_utils.py +0 -0
  40. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/processors.py +0 -0
  41. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/py.typed +0 -0
  42. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/types_manual.py +0 -0
  43. {pymcap_cli-0.2.0 → pymcap_cli-0.4.0}/src/pymcap_cli/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pymcap-cli
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: High-performance Python CLI for MCAP file processing with advanced recovery, filtering, and optimization capabilities
5
5
  Keywords: mcap,cli,robotics,ros,ros2,recovery,filtering,compression
6
6
  Author: Marko Bausch
@@ -27,6 +27,8 @@ Requires-Dist: cyclopts>=4
27
27
  Requires-Dist: ros-parser
28
28
  Requires-Dist: platformdirs>=4.0.0
29
29
  Requires-Dist: typing-extensions>=4.15.0
30
+ Requires-Dist: pymcap-cli[video,pointcloud,plot] ; extra == 'all'
31
+ Requires-Dist: plotly>=6.0.0 ; extra == 'plot'
30
32
  Requires-Dist: pureini ; extra == 'pointcloud'
31
33
  Requires-Dist: av>=12.0.0 ; extra == 'video'
32
34
  Requires-Dist: numpy>=1.24.0 ; extra == 'video'
@@ -34,6 +36,8 @@ Requires-Python: >=3.10
34
36
  Project-URL: Homepage, https://github.com/mrkbac/robotic-tools
35
37
  Project-URL: Issues, https://github.com/mrkbac/robotic-tools/issues
36
38
  Project-URL: Repository, https://github.com/mrkbac/robotic-tools
39
+ Provides-Extra: all
40
+ Provides-Extra: plot
37
41
  Provides-Extra: pointcloud
38
42
  Provides-Extra: video
39
43
  Description-Content-Type: text/markdown
@@ -42,6 +46,12 @@ Description-Content-Type: text/markdown
42
46
 
43
47
  A high-performance Python CLI for MCAP file processing with advanced recovery, filtering, and optimization capabilities.
44
48
 
49
+ <picture>
50
+ <source media="(prefers-color-scheme: light)" srcset="vhs/info-light.gif">
51
+ <source media="(prefers-color-scheme: dark)" srcset="vhs/info.gif">
52
+ <img src="vhs/info.gif" alt="pymcap-cli info" />
53
+ </picture>
54
+
45
55
  ## Installation
46
56
 
47
57
  ```bash
@@ -57,66 +67,55 @@ uv add pymcap-cli[video]
57
67
 
58
68
  ## Why pymcap-cli over the official Go CLI?
59
69
 
60
- - **Advanced Recovery**: Handles corrupt MCAP files with intelligent chunk-level recovery and MessageIndex validation
61
- - **Smart Chunk Copying**: Fast chunk copying without decompression when possible - up to 10x faster for filtering operations
62
- - **Unified Processing**: Single `process` command combines recovery + filtering + compression in one optimized pass
63
- - **Precise Filtering**: Regex topic filtering, time range filtering, and content type filtering with deferred schema/channel writing
64
- - **Rich Progress Display**: Beautiful progress bars with transfer speeds and time estimates using Rich console output
65
- - **Robust Error Handling**: Graceful degradation with detailed error reporting and recovery statistics
70
+ - **Advanced Recovery** handles corrupt MCAP files with intelligent chunk-level recovery and MessageIndex validation
71
+ - **Smart Chunk Copying** fast chunk copying without decompression when possible, up to 10x faster for filtering operations
72
+ - **Unified Processing** single `process` command combines recovery + filtering + compression in one optimized pass
73
+ - **Precise Filtering** regex topic filtering, time range filtering, and content type filtering with deferred schema/channel writing
74
+ - **Rich Terminal Output** colored topics, Unicode distribution histograms, tree views, and responsive layouts
75
+ - **Robust Error Handling** graceful degradation with detailed error reporting and recovery statistics
66
76
 
67
- ## Quick Start
77
+ ## Commands
68
78
 
69
- ```bash
70
- # Get file information
71
- pymcap-cli info data.mcap
79
+ ### `info` — File Information
72
80
 
73
- # Recover a corrupt MCAP file
74
- pymcap-cli recover corrupted.mcap -o fixed.mcap
81
+ Display detailed MCAP file information including schemas, channels, message counts, time ranges, and per-topic distribution histograms.
75
82
 
76
- # Filter messages by topic with compression
77
- pymcap-cli process large.mcap -o filtered.mcap -y "/camera.*" --compression zstd
78
-
79
- # Rechunk by topic patterns
80
- pymcap-cli rechunk data.mcap -o rechunked.mcap -p "/camera.*" -p "/lidar.*"
81
-
82
- # Show disk usage breakdown
83
- pymcap-cli du large.mcap
84
-
85
- # Compress files
86
- pymcap-cli compress input.mcap -o compressed.mcap --compression lz4
83
+ ```bash
84
+ pymcap-cli info data.mcap
87
85
  ```
88
86
 
89
- ## Available Commands
90
-
91
- ### `info` - File Information
87
+ Use `--tree` to group topics into a hierarchical tree view:
92
88
 
93
- Display detailed MCAP file information including schemas, channels, message counts, and time ranges.
89
+ <picture>
90
+ <source media="(prefers-color-scheme: light)" srcset="vhs/info-tree-light.gif">
91
+ <source media="(prefers-color-scheme: dark)" srcset="vhs/info-tree.gif">
92
+ <img src="vhs/info-tree.gif" alt="pymcap-cli info --tree" />
93
+ </picture>
94
94
 
95
95
  ```bash
96
- # Single file
97
- pymcap-cli info data.mcap
98
-
99
- # Multiple files (displays each file separately)
96
+ # Multiple files
100
97
  pymcap-cli info file1.mcap file2.mcap file3.mcap
101
98
 
102
- # JSON output for single file
99
+ # JSON output
103
100
  pymcap-cli info-json data.mcap
104
-
105
- # JSON output for multiple files (returns array)
106
- pymcap-cli info-json file1.mcap file2.mcap
107
101
  ```
108
102
 
109
- ### `cat` - Stream Messages
103
+ ### `cat` Stream Messages
110
104
 
111
105
  Stream MCAP messages to stdout. Outputs as Rich tables when interactive, JSONL when piped.
112
106
 
107
+ Use `--query` to extract nested fields from deeply structured ROS messages with JSONPath-like syntax:
108
+
109
+ <picture>
110
+ <source media="(prefers-color-scheme: light)" srcset="vhs/cat-query-light.gif">
111
+ <source media="(prefers-color-scheme: dark)" srcset="vhs/cat-query.gif">
112
+ <img src="vhs/cat-query.gif" alt="pymcap-cli cat --query" />
113
+ </picture>
114
+
113
115
  ```bash
114
- # Display messages in a table (interactive)
116
+ # Display messages in a table
115
117
  pymcap-cli cat recording.mcap
116
118
 
117
- # Pipe to file as JSONL
118
- pymcap-cli cat recording.mcap > messages.jsonl
119
-
120
119
  # Filter specific topics
121
120
  pymcap-cli cat recording.mcap --topics /camera/image
122
121
 
@@ -131,45 +130,38 @@ pymcap-cli cat recording.mcap --query '/odom.pose.position.x'
131
130
 
132
131
  # Filter array elements
133
132
  pymcap-cli cat recording.mcap --query '/detections.objects[:]{confidence>0.8}'
134
- ```
135
-
136
- ### `recover` - Advanced Recovery
137
-
138
- Recover data from potentially corrupt MCAP files with intelligent error handling.
139
-
140
- ```bash
141
- # Basic recovery
142
- pymcap-cli recover corrupt.mcap -o fixed.mcap
143
133
 
144
- # Force chunk decoding for maximum recovery
145
- pymcap-cli recover corrupt.mcap -o fixed.mcap --always-decode-chunk
134
+ # Pipe to file as JSONL
135
+ pymcap-cli cat recording.mcap > messages.jsonl
146
136
  ```
147
137
 
148
- ### `recover-inplace` - In-Place Recovery
138
+ ### `tftree` TF Transform Tree
149
139
 
150
- Rebuild an MCAP file's summary and footer in place without creating a new file.
140
+ Visualize the ROS TF transform tree with colored static/dynamic transforms, translation and rotation values.
151
141
 
152
- ```bash
153
- # Rebuild summary/footer in place
154
- pymcap-cli recover-inplace data.mcap
142
+ <picture>
143
+ <source media="(prefers-color-scheme: light)" srcset="vhs/tftree-light.gif">
144
+ <source media="(prefers-color-scheme: dark)" srcset="vhs/tftree.gif">
145
+ <img src="vhs/tftree.gif" alt="pymcap-cli tftree" />
146
+ </picture>
155
147
 
156
- # With exact size calculation
157
- pymcap-cli recover-inplace data.mcap --exact-sizes
148
+ ```bash
149
+ # Show complete TF tree (both /tf and /tf_static)
150
+ pymcap-cli tftree data.mcap
158
151
 
159
- # Skip confirmation prompt
160
- pymcap-cli recover-inplace data.mcap --force
152
+ # Show only static transforms
153
+ pymcap-cli tftree data.mcap --static-only
161
154
  ```
162
155
 
163
- ### `process` - Unified Processing
156
+ ### `process` Unified Processing
164
157
 
165
- The most powerful command - combines recovery, filtering, and optimization in a single pass.
158
+ The most powerful command combines recovery, filtering, and optimization in a single pass.
166
159
 
167
160
  ```bash
168
161
  # Filter by topic regex
169
162
  pymcap-cli process data.mcap -o filtered.mcap -y "/camera.*" -y "/lidar.*"
170
163
 
171
164
  # Time range filtering (nanoseconds or RFC3339)
172
- pymcap-cli process data.mcap -o subset.mcap -S 1640995200000000000 -E 1640995260000000000
173
165
  pymcap-cli process data.mcap -o subset.mcap -S "2022-01-01T00:00:00Z" -E "2022-01-01T01:00:00Z"
174
166
 
175
167
  # Exclude topics and metadata
@@ -182,7 +174,34 @@ pymcap-cli process zstd.mcap -o lz4.mcap --compression lz4 -y "/important.*"
182
174
  pymcap-cli process corrupt.mcap -o recovered.mcap -y "/camera.*" --recovery-mode
183
175
  ```
184
176
 
185
- ### `merge` - Merge Files
177
+ ### `recover` Advanced Recovery
178
+
179
+ Recover data from potentially corrupt MCAP files with intelligent error handling.
180
+
181
+ ```bash
182
+ # Basic recovery
183
+ pymcap-cli recover corrupt.mcap -o fixed.mcap
184
+
185
+ # Force chunk decoding for maximum recovery
186
+ pymcap-cli recover corrupt.mcap -o fixed.mcap --always-decode-chunk
187
+ ```
188
+
189
+ ### `recover-inplace` — In-Place Recovery
190
+
191
+ Rebuild an MCAP file's summary and footer in place without creating a new file.
192
+
193
+ ```bash
194
+ # Rebuild summary/footer in place
195
+ pymcap-cli recover-inplace data.mcap
196
+
197
+ # With exact size calculation
198
+ pymcap-cli recover-inplace data.mcap --exact-sizes
199
+
200
+ # Skip confirmation prompt
201
+ pymcap-cli recover-inplace data.mcap --force
202
+ ```
203
+
204
+ ### `merge` — Merge Files
186
205
 
187
206
  Merge multiple MCAP files chronologically into a single output file.
188
207
 
@@ -197,7 +216,7 @@ pymcap-cli merge *.mcap -o all_recordings.mcap --compression lz4
197
216
  pymcap-cli merge file1.mcap file2.mcap -o merged.mcap --metadata exclude
198
217
  ```
199
218
 
200
- ### `convert` - Convert DB3 to MCAP
219
+ ### `convert` Convert DB3 to MCAP
201
220
 
202
221
  Convert ROS2 DB3 (SQLite) bag files to MCAP format.
203
222
 
@@ -210,43 +229,25 @@ pymcap-cli convert input.db3 -o output.mcap --distro jazzy
210
229
 
211
230
  # With custom message definitions
212
231
  pymcap-cli convert input.db3 -o output.mcap --extra-path /path/to/msgs
213
-
214
- # Multiple custom paths
215
- pymcap-cli convert input.db3 -o output.mcap \
216
- --extra-path /path/to/msgs1 \
217
- --extra-path /path/to/msgs2
218
232
  ```
219
233
 
220
- ### `rechunk` - Topic-Based Rechunking
234
+ ### `rechunk` Topic-Based Rechunking
221
235
 
222
- Reorganize MCAP messages into separate chunk groups based on topic patterns. This is useful for optimizing file layout when different topics are accessed independently, improving playback performance for topic-specific queries.
236
+ Reorganize MCAP messages into separate chunk groups based on topic patterns for optimized playback.
223
237
 
224
238
  ```bash
225
239
  # Group camera and lidar topics into separate chunks
226
240
  pymcap-cli rechunk data.mcap -o rechunked.mcap -p "/camera.*" -p "/lidar.*"
227
241
 
228
- # Multiple patterns - each gets its own chunk group
242
+ # Multiple patterns each gets its own chunk group
229
243
  pymcap-cli rechunk data.mcap -o rechunked.mcap \
230
244
  -p "/camera/front.*" \
231
245
  -p "/camera/rear.*" \
232
246
  -p "/lidar.*" \
233
247
  -p "/radar.*"
234
-
235
- # With custom chunk size and compression
236
- pymcap-cli rechunk data.mcap -o rechunked.mcap \
237
- -p "/high_freq.*" \
238
- --chunk-size 8388608 \
239
- --compression lz4
240
248
  ```
241
249
 
242
- **How it works:**
243
- - Messages are grouped by the first matching pattern (first match wins)
244
- - Each pattern gets its own chunk group that can span multiple chunks
245
- - Topics not matching any pattern go into a separate "unmatched" group
246
- - Messages within each group preserve their original order
247
- - Useful for optimizing access patterns when different topics are read independently
248
-
249
- ### `filter` - Topic Filtering
250
+ ### `filter` — Topic Filtering
250
251
 
251
252
  Filter messages by topic patterns (simpler version of `process`).
252
253
 
@@ -258,17 +259,16 @@ pymcap-cli filter data.mcap -o filtered.mcap --include-topics "/camera/image" "/
258
259
  pymcap-cli filter data.mcap -o filtered.mcap --exclude-topics "/debug.*" "/test.*"
259
260
  ```
260
261
 
261
- ### `compress` - Compression Tool
262
+ ### `compress` Compression Tool
262
263
 
263
264
  Change MCAP file compression.
264
265
 
265
266
  ```bash
266
- # Compress with different algorithms
267
267
  pymcap-cli compress input.mcap -o output.mcap --compression zstd
268
268
  pymcap-cli compress input.mcap -o output.mcap --compression lz4
269
269
  ```
270
270
 
271
- ### `du` - Disk Usage Analysis
271
+ ### `du` Disk Usage Analysis
272
272
 
273
273
  Analyze MCAP file size breakdown by chunks, schemas, channels, and message counts.
274
274
 
@@ -276,54 +276,21 @@ Analyze MCAP file size breakdown by chunks, schemas, channels, and message count
276
276
  pymcap-cli du large.mcap
277
277
  ```
278
278
 
279
- ### `list` - List Records
279
+ ### `list` List Records
280
280
 
281
- List various record types in an MCAP file with detailed information.
281
+ List various record types in an MCAP file.
282
282
 
283
283
  ```bash
284
- # List channels
285
284
  pymcap-cli list channels data.mcap
286
-
287
- # List chunks
288
285
  pymcap-cli list chunks data.mcap
289
-
290
- # List schemas
291
286
  pymcap-cli list schemas data.mcap
292
-
293
- # List attachments
294
287
  pymcap-cli list attachments data.mcap
295
-
296
- # List metadata
297
288
  pymcap-cli list metadata data.mcap
298
289
  ```
299
290
 
300
- ### `info-json` - JSON Statistics
301
-
302
- Output comprehensive MCAP file statistics as JSON, including message distribution, channel rates, and compression stats.
303
-
304
- ```bash
305
- # Basic JSON output
306
- pymcap-cli info-json data.mcap
307
-
308
- # Rebuild from scratch with exact sizes
309
- pymcap-cli info-json data.mcap --rebuild --exact-sizes
310
- ```
311
-
312
- ### `tftree` - TF Transform Tree
313
-
314
- Display ROS TF transform tree from MCAP files with visual hierarchy.
315
-
316
- ```bash
317
- # Show complete TF tree (both /tf and /tf_static)
318
- pymcap-cli tftree data.mcap
319
-
320
- # Show only static transforms
321
- pymcap-cli tftree data.mcap --static-only
322
- ```
323
-
324
- ### `video` - Video Generation
291
+ ### `video` Video Generation
325
292
 
326
- Generate MP4 videos from image topics (CompressedImage or Image) using hardware-accelerated encoding. Requires the `video` extra.
293
+ Generate MP4 videos from image topics using hardware-accelerated encoding. Requires the `video` extra.
327
294
 
328
295
  ```bash
329
296
  # Basic video generation
@@ -334,12 +301,9 @@ pymcap-cli video data.mcap --topic /camera/rear --output rear.mp4 --quality high
334
301
 
335
302
  # Use specific codec and encoder
336
303
  pymcap-cli video data.mcap --topic /lidar/image --output lidar.mp4 --codec h265 --encoder videotoolbox
337
-
338
- # Manual CRF quality control
339
- pymcap-cli video data.mcap --topic /camera/debug --output debug.mp4 --crf 18
340
304
  ```
341
305
 
342
- ### `roscompress` - ROS Image Compression
306
+ ### `roscompress` ROS Image Compression
343
307
 
344
308
  Compress ROS MCAP files by converting CompressedImage/Image topics to CompressedVideo format. Requires the `video` extra.
345
309
 
@@ -347,134 +311,53 @@ Compress ROS MCAP files by converting CompressedImage/Image topics to Compressed
347
311
  # Basic compression
348
312
  pymcap-cli roscompress data.mcap -o compressed.mcap
349
313
 
350
- # Specify quality (CRF: lower = better, 0-51)
351
- pymcap-cli roscompress data.mcap -o compressed.mcap --quality 28
352
-
353
- # Specify codec
354
- pymcap-cli roscompress data.mcap -o compressed.mcap --codec h265
355
-
356
- # Force specific encoder
357
- pymcap-cli roscompress data.mcap -o compressed.mcap --encoder libx264
314
+ # Specify quality and codec
315
+ pymcap-cli roscompress data.mcap -o compressed.mcap --quality 28 --codec h265
358
316
  ```
359
317
 
360
318
  ### Shell Autocompletion
361
319
 
362
- pymcap-cli supports automatic shell completion for bash, zsh, fish, and PowerShell using Typer's built-in completion system.
363
-
364
- #### Quick Install (recommended)
365
320
  ```bash
366
321
  # Automatically install completion for your current shell
367
322
  pymcap-cli --install-completion
368
323
 
369
- # That's it! Restart your shell or source your config file
370
- ```
371
-
372
- #### Manual Install
373
- ```bash
374
- # Bash - add to ~/.bashrc
375
- eval "$(pymcap-cli --show-completion bash)"
376
-
377
- # Zsh - add to ~/.zshrc
378
- eval "$(pymcap-cli --show-completion zsh)"
379
-
380
- # Fish - add to ~/.config/fish/config.fish
381
- pymcap-cli --show-completion fish | source
382
-
383
- # PowerShell - add to your profile
384
- Invoke-Expression (& pymcap-cli --show-completion powershell)
385
- ```
386
-
387
- ## Advanced Usage
388
-
389
- ### Performance Optimization
390
-
391
- ```bash
392
- # Fast chunk copying (default) - up to 10x faster for large files
393
- pymcap-cli process data.mcap -o filtered.mcap -y "/camera.*" --chunk-copying
394
-
395
- # Disable chunk copying for maximum compatibility
396
- pymcap-cli process data.mcap -o filtered.mcap -y "/camera.*" --no-chunk-copying
397
-
398
- # Always decode chunks (slower but handles edge cases)
399
- pymcap-cli process data.mcap -o filtered.mcap -y "/camera.*" --always-decode-chunk
400
- ```
401
-
402
- ### Recovery Modes
403
-
404
- ```bash
405
- # Graceful error handling (default)
406
- pymcap-cli process corrupt.mcap -o recovered.mcap --recovery-mode
407
-
408
- # Strict mode - fail on any errors
409
- pymcap-cli process data.mcap -o output.mcap --no-recovery
410
- ```
411
-
412
- ### Time Filtering Options
413
-
414
- ```bash
415
- # Using seconds (automatically converted to nanoseconds)
416
- pymcap-cli process data.mcap -o subset.mcap --start-secs 1640995200 --end-secs 1640995260
417
-
418
- # Using nanoseconds directly
419
- pymcap-cli process data.mcap -o subset.mcap --start-nsecs 1640995200000000000
420
-
421
- # Using RFC3339 timestamps (most readable)
422
- pymcap-cli process data.mcap -o subset.mcap -S "2022-01-01T00:00:00Z" -E "2022-01-01T01:00:00Z"
324
+ # Or manually for a specific shell
325
+ eval "$(pymcap-cli --show-completion bash)" # bash
326
+ eval "$(pymcap-cli --show-completion zsh)" # zsh
327
+ pymcap-cli --show-completion fish | source # fish
423
328
  ```
424
329
 
425
330
  ## Common Use Cases
426
331
 
427
- ### Clean Up Debug Data
428
-
429
332
  ```bash
430
- # Remove debug topics and metadata to reduce file size
431
- pymcap-cli process raw_data.mcap -o clean_data.mcap \
333
+ # Remove debug topics and compress
334
+ pymcap-cli process raw.mcap -o clean.mcap \
432
335
  -n "/debug.*" -n "/test.*" --exclude-metadata --compression zstd
433
- ```
434
336
 
435
- ### Extract Camera Data
436
-
437
- ```bash
438
- # Extract only camera topics with time filtering
439
- pymcap-cli process full_log.mcap -o camera_only.mcap \
337
+ # Extract camera data with time range
338
+ pymcap-cli process full_log.mcap -o camera.mcap \
440
339
  -y "/camera.*" -S "2024-01-01T10:00:00Z" -E "2024-01-01T11:00:00Z"
441
- ```
442
-
443
- ### Recover and Compress
444
340
 
445
- ```bash
446
341
  # Recover corrupt file and compress in one pass
447
- pymcap-cli process corrupt.mcap -o recovered.mcap \
448
- --recovery-mode --compression lz4
449
- ```
342
+ pymcap-cli process corrupt.mcap -o recovered.mcap --recovery-mode --compression lz4
450
343
 
451
- ### High-Performance Filtering
452
-
453
- ```bash
454
- # Fast filtering with chunk copying for maximum performance
344
+ # Fast filtering with chunk copying (up to 10x faster)
455
345
  pymcap-cli process 100gb_file.mcap -o filtered.mcap \
456
346
  -y "/lidar.*" --chunk-copying --compression zstd
457
- ```
458
-
459
- ### Optimize for Topic-Specific Playback
460
347
 
461
- ```bash
462
- # Rechunk by sensor type for faster topic-specific access
348
+ # Optimize for topic-specific playback
463
349
  pymcap-cli rechunk robot_log.mcap -o optimized.mcap \
464
- -p "/camera.*" \
465
- -p "/lidar.*" \
466
- -p "/imu.*" \
467
- -p "/gps.*"
350
+ -p "/camera.*" -p "/lidar.*" -p "/imu.*" -p "/gps.*"
468
351
  ```
469
352
 
470
353
  ## Technical Details
471
354
 
472
- - **Smart Chunk Processing**: Automatically chooses between fast chunk copying and individual record processing based on filter criteria
473
- - **MessageIndex Validation**: Validates and rebuilds MessageIndexes when necessary for data integrity
474
- - **Deferred Schema Writing**: Only writes schemas and channels that are actually used by included messages
475
- - **Compression Support**: zstd, lz4, and uncompressed formats with configurable chunk sizes
476
- - **Memory Efficient**: Streams processing with configurable buffer sizes for handling large files
477
- - **Error Recovery**: Multiple fallback strategies for handling corrupt or incomplete MCAP files
355
+ - **Smart Chunk Processing** automatically chooses between fast chunk copying and individual record processing based on filter criteria
356
+ - **MessageIndex Validation** validates and rebuilds MessageIndexes when necessary for data integrity
357
+ - **Deferred Schema Writing** only writes schemas and channels that are actually used by included messages
358
+ - **Compression Support** zstd, lz4, and uncompressed formats with configurable chunk sizes
359
+ - **Memory Efficient** streams processing with configurable buffer sizes for handling large files
360
+ - **Error Recovery** multiple fallback strategies for handling corrupt or incomplete MCAP files
478
361
 
479
362
  ## Development
480
363