Add the MKV recorder so a node can Record, not only preview

The recorder was the gap: it is FTF's own customised SDK example (a 1139-line
K4A MKV writer), not a stock sample, and it lived only in one machine's build
tree. Bring its source into the repo and build it as part of install.

It writes K4A-format MKV — the format the rest of Ithaca reads — so it stays,
and gets its libk4a from the Orbbec K4A wrapper rather than Microsoft's Azure
Kinect SDK, which is set aside. build_k4a_wrapper.sh builds that wrapper;
build_sdk.sh injects the recorder into the SDK examples tree and builds it there
against the wrapper (it depends on the SDK's own cmake targets). Found by rpath
at runtime, so no LD_LIBRARY_PATH.

install.sh now builds wrapper -> SDK+recorder -> preview server, each reusing an
existing build so the Nano is untouched. If the wrapper is unavailable the
install still completes preview-only and says so.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
AngePierreandClaude Opus 5 committed 2026-09-10 16:21:44 +02:00
1 parent c167c836e6
commit 23b30ac1e8
7 files changed
+1460 -49

No files matched your search

+52 -21
View File
@@ -1,9 +1,11 @@
# Ithaca capture node
The software a Jetson runs to join an Ithaca RGBD capture rig: a Python bridge that
puts the node on the WebSocket mesh and answers Preview / Record, and a C++ preview
puts the node on the WebSocket mesh and answers Preview / Record, a C++ preview
server that streams each camera's colour (the sensor's own JPEG) and depth (its own
16-bit millimetres, LZ4-compressed) straight to the Unity viewer.
16-bit millimetres, LZ4-compressed) straight to the Unity viewer, and a C++ recorder
that writes K4A-format MKV takes on Record — the same format the rest of Ithaca
reads.
One checkout, one command, on any Jetson:
@@ -44,6 +46,9 @@ bridge/
server/
ithaca_rgbd_server.cpp the preview server
CMakeLists.txt links a prebuilt libOrbbecSDK, no GStreamer
recorder/
depth_color_k4arec_pipeline.cpp the MKV recorder — FTF source, not a stock example
CMakeLists.txt built inside the SDK examples tree, links the K4A wrapper
systemd/
ithaca-bridge.service.in templated with the user and repo path
usbfs-memory.service raises usbfs_memory_mb for the camera bandwidth
@@ -52,41 +57,67 @@ udev/
scripts/
detect_platform.sh L4T / JetPack / SoC, as KEY=value
install_deps.sh apt + websockets
build_sdk.sh reuse or build OrbbecSDK v2 for this platform
build_k4a_wrapper.sh reuse or build the Orbbec K4A wrapper (libk4a)
build_sdk.sh reuse or build OrbbecSDK v2 + inject/build the recorder
build_server.sh cmake + make the preview server
```
## The three C++ pieces, and how each is built
- **Preview server** (`server/`) — our source, built standalone against the
prebuilt `libOrbbecSDK.so`. Simple.
- **Recorder** (`recorder/`) — FTF's own source, a customised SDK example, so it is
injected into the SDK's `examples/` tree and built there (it uses the SDK's own
cmake targets). It writes K4A-format MKV, and at runtime dlopens `libk4a.so` /
`libk4arecord.so` — provided by the **Orbbec K4A wrapper**, *not* Microsoft's
Azure Kinect SDK. Found by rpath, so no `LD_LIBRARY_PATH`.
- **Orbbec K4A wrapper** — Orbbec's `libk4a`, backed by their own SDK, cloned and
built by `build_k4a_wrapper.sh`. This is what makes Record work while setting the
Microsoft SDK aside.
## What install.sh does
1. Detects L4T / JetPack / SoC (`scripts/detect_platform.sh`).
2. Installs build and run dependencies (no GStreamer — the direct route encodes no
video).
3. Locates a working OrbbecSDK build, or clones and builds one. A node that already
has a good build (the Nano) is left untouched.
4. Builds `ithaca_rgbd_server` against it.
5. Generates `bridge/config.json` for the current user — this is where all the
2. Installs build and run dependencies (OpenCV for the recorder; no GStreamer — the
direct route encodes no video).
3. Builds (or reuses) the Orbbec K4A wrapper — `libk4a` for the recorder.
4. Builds (or reuses) the OrbbecSDK, injecting and building the recorder example
against the wrapper. A node that already has a good build (the Nano) is left
untouched; the recorder is added to it only if missing.
5. Builds `ithaca_rgbd_server` against the SDK.
6. Generates `bridge/config.json` for the current user — this is where all the
machine-specific paths live, so `bridge.py` itself stays unmodified.
6. Installs the udev rules and the `usbfs-memory` service, and adds the user to the
7. Installs the udev rules and the `usbfs-memory` service, and adds the user to the
`video` group.
7. Generates and starts the `ithaca-bridge` systemd service.
8. Generates and starts the `ithaca-bridge` systemd service.
If the K4A wrapper is unavailable, install.sh still completes: the node then does
**preview only**, and says so. Record needs the wrapper.
Re-run it after a `git pull`: it rebuilds, regenerates the unit and config, and
restarts the service. It keeps an existing `config.json` (delete it to regenerate)
and an existing SDK build.
## The SDK is the one thing to watch on a new JetPack
## The two source builds to watch on a new JetPack
`build_sdk.sh` reuses an existing build when it finds one. On a machine with none it
clones the official OrbbecSDK v2 and builds it — this is the step most likely to
need attention on a JetPack it has not been tried on. If it fails, build the SDK by
hand once and re-run with its location:
Both scripts reuse an existing build when they find one. On a machine with none they
clone and build from source — the steps most likely to need attention on a JetPack
they have not been tried on:
```sh
OB_SDK_ROOT=/path/to/OrbbecSDK_v2 ./install.sh
```
- **Orbbec K4A wrapper** — `OB_K4A_REPO` / `OB_K4A_REF` pin the source (default
`v1.10.4`). If it fails, build it by hand once and re-run with its location:
```sh
K4A_WRAPPER_DIR=/path/to/OrbbecSDK-K4A-Wrapper ./install.sh
```
- **OrbbecSDK v2** — `OB_SDK_REPO` / `OB_SDK_REF` pin the source (default `main`).
Likewise:
```sh
OB_SDK_ROOT=/path/to/OrbbecSDK_v2 ./install.sh
```
Override the source with `OB_SDK_REPO` / `OB_SDK_REF` to pin a tag known to build on
your JetPack.
Both can be passed together. Neither is Microsoft's Azure Kinect SDK — the recorder
gets its `libk4a` from the Orbbec wrapper, which is buildable from source across
platforms.
## Operating the node