feat(zed): add DuckDB segment timestamp indexer

Add a new mcap_video_bounds helper binary plus a zed_segment_time_index.py CLI that builds and queries an embedded DuckDB index for bundled ZED segment recordings.

The index stores segment folders, MCAP paths, video time bounds, durations, camera labels, and dataset metadata, and reuses the existing recursive multi-camera segment discovery logic so nested kindergarten layouts are indexed correctly.

Infer a dataset default timezone from folder names versus MCAP timestamps, and make point queries precision-aware so second-level folder timestamps like 2026-03-18T12-00-23 resolve to the matching segment instead of missing due to subsecond start offsets.

Verification:
- uv add 'duckdb>=1.0'
- cmake --build build --target mcap_video_bounds
- uv run python -m unittest tests.test_zed_segment_time_index
- uv run python scripts/zed_segment_time_index.py build /workspaces/data/kindergarten --jobs 8
- uv run python scripts/zed_segment_time_index.py query /workspaces/data/kindergarten --at 2026-03-18T12-00-23
This commit is contained in:
2026-03-23 09:35:54 +00:00
parent a0b9c95d5b
commit e3a423433e
7 changed files with 1185 additions and 0 deletions
+27
View File
@@ -365,7 +365,34 @@ set_target_properties(mcap_replay_tester PROPERTIES
OUTPUT_NAME "mcap_replay_tester"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
add_executable(mcap_video_bounds src/tools/mcap_video_bounds.cpp)
target_include_directories(mcap_video_bounds
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/include"
"${CMAKE_CURRENT_BINARY_DIR}")
target_link_libraries(mcap_video_bounds
PRIVATE
CLI11::CLI11
cvmmap_streamer_foxglove_proto
cvmmap_streamer_mcap_runtime
mcap::mcap
PkgConfig::ZSTD
PkgConfig::LZ4)
if (TARGET spdlog::spdlog)
target_link_libraries(mcap_video_bounds PRIVATE spdlog::spdlog)
elseif (TARGET spdlog)
target_link_libraries(mcap_video_bounds PRIVATE spdlog)
endif()
target_link_libraries(mcap_video_bounds PRIVATE cvmmap_streamer_protobuf)
if (TARGET PkgConfig::PROTOBUF_PKG)
target_link_libraries(mcap_video_bounds PRIVATE PkgConfig::PROTOBUF_PKG)
endif()
set_target_properties(mcap_video_bounds PROPERTIES
OUTPUT_NAME "mcap_video_bounds"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CVMMAP_STREAMER_INSTALL_TARGETS cvmmap_streamer)
list(APPEND CVMMAP_STREAMER_INSTALL_TARGETS mcap_video_bounds)
if (CVMMAP_HAS_ZED_SDK)
add_library(