syncfield 0.1.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.
@@ -0,0 +1,29 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ id-token: write
9
+
10
+ jobs:
11
+ publish:
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.12"
21
+
22
+ - name: Install build tools
23
+ run: python -m pip install --upgrade pip build
24
+
25
+ - name: Build package
26
+ run: python -m build
27
+
28
+ - name: Publish to PyPI
29
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,30 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install -e ".[dev]" || pip install -e . && pip install pytest
28
+
29
+ - name: Run tests
30
+ run: pytest -v
@@ -0,0 +1,28 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.so
5
+
6
+ # Distribution / Packaging
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+ *.egg
11
+
12
+ # Virtual environments
13
+ .venv/
14
+
15
+ # Testing
16
+ .pytest_cache/
17
+ .coverage
18
+ htmlcov/
19
+
20
+ # IDE
21
+ .idea/
22
+ .vscode/
23
+ *.swp
24
+ *.swo
25
+
26
+ # OS
27
+ .DS_Store
28
+ Thumbs.db
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 OpenGraph Labs
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,405 @@
1
+ Metadata-Version: 2.4
2
+ Name: syncfield
3
+ Version: 0.1.0
4
+ Summary: Lightweight timestamp capture SDK for SyncField multi-stream synchronization
5
+ Project-URL: Homepage, https://opengraphlabs.com/
6
+ Project-URL: Repository, https://github.com/OpenGraphLabs/syncfield-python
7
+ Project-URL: Documentation, https://github.com/OpenGraphLabs/syncfield-python#readme
8
+ Project-URL: Issues, https://github.com/OpenGraphLabs/syncfield-python/issues
9
+ Author: OpenGraph Labs
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: data-collection,multi-camera,robotics,synchronization,timestamp
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+
25
+ # syncfield-python
26
+
27
+ Lightweight Python SDK for [SyncField](https://opengraphlabs.com) multi-stream synchronization. Captures precise timestamps during multi-camera and sensor recording and produces JSONL files that the SyncField Docker service consumes for frame-level temporal alignment.
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ pip install syncfield
33
+ ```
34
+
35
+ **Zero dependencies** -- uses only the Python standard library.
36
+
37
+ ## Quick Start
38
+
39
+ ### Video Streams
40
+
41
+ Use `stamp()` to capture timestamps and `link()` to associate the saved video file with the stream.
42
+
43
+ ```python
44
+ import syncfield as sf
45
+
46
+ session = sf.SyncSession(host_id="rig_01", output_dir="./sync_data")
47
+ session.start()
48
+
49
+ for i in range(num_frames):
50
+ frame = camera.read()
51
+ session.stamp("cam_left", frame_number=i)
52
+ save_frame_to_video(frame, "cam_left.mp4")
53
+
54
+ session.link("cam_left", "/data/cam_left.mp4")
55
+ session.stop()
56
+ ```
57
+
58
+ Output:
59
+ ```
60
+ ./sync_data/
61
+ sync_point.json
62
+ cam_left.timestamps.jsonl
63
+ manifest.json
64
+ ```
65
+
66
+ ### Sensor Streams
67
+
68
+ Use `record()` to capture timestamps and sensor data in one call. This writes both a `.timestamps.jsonl` file (for alignment) and a `.jsonl` file (sensor channel values).
69
+
70
+ ```python
71
+ import syncfield as sf
72
+
73
+ session = sf.SyncSession(host_id="rig_01", output_dir="./sync_data")
74
+ session.start()
75
+
76
+ for i in range(num_samples):
77
+ data = imu.read()
78
+ session.record("imu", frame_number=i, channels={
79
+ "accel_x": data.ax,
80
+ "accel_y": data.ay,
81
+ "accel_z": data.az,
82
+ })
83
+
84
+ session.stop()
85
+ ```
86
+
87
+ Output:
88
+ ```
89
+ ./sync_data/
90
+ sync_point.json
91
+ imu.timestamps.jsonl
92
+ imu.jsonl
93
+ manifest.json
94
+ ```
95
+
96
+ ### Multi-Stream Example
97
+
98
+ A complete example with 2 cameras and 1 IMU, each in its own thread.
99
+
100
+ ```python
101
+ import threading
102
+ import syncfield as sf
103
+
104
+ session = sf.SyncSession(host_id="rig_01", output_dir="./sync_data")
105
+ session.start()
106
+
107
+ recording = True
108
+
109
+ def camera_loop(cam, stream_id, video_path):
110
+ i = 0
111
+ while recording:
112
+ frame = cam.read()
113
+ session.stamp(stream_id, frame_number=i)
114
+ save_frame(frame, video_path)
115
+ i += 1
116
+ session.link(stream_id, video_path)
117
+
118
+ def imu_loop(imu, stream_id):
119
+ i = 0
120
+ while recording:
121
+ data = imu.read()
122
+ session.record(stream_id, frame_number=i, channels={
123
+ "accel_x": data.ax, "accel_y": data.ay, "accel_z": data.az,
124
+ "gyro_x": data.gx, "gyro_y": data.gy, "gyro_z": data.gz,
125
+ })
126
+ i += 1
127
+
128
+ threads = [
129
+ threading.Thread(target=camera_loop, args=(cam_left, "cam_left", "/data/cam_left.mp4")),
130
+ threading.Thread(target=camera_loop, args=(cam_right, "cam_right", "/data/cam_right.mp4")),
131
+ threading.Thread(target=imu_loop, args=(imu_device, "imu")),
132
+ ]
133
+
134
+ for t in threads:
135
+ t.start()
136
+
137
+ # ... record for desired duration ...
138
+ recording = False
139
+
140
+ for t in threads:
141
+ t.join()
142
+
143
+ counts = session.stop()
144
+ # counts == {"cam_left": 900, "cam_right": 900, "imu": 9000}
145
+ ```
146
+
147
+ Output directory:
148
+ ```
149
+ ./sync_data/
150
+ sync_point.json
151
+ cam_left.timestamps.jsonl
152
+ cam_right.timestamps.jsonl
153
+ imu.timestamps.jsonl
154
+ imu.jsonl
155
+ manifest.json
156
+ ```
157
+
158
+ ## Best Practices
159
+
160
+ ### Call `stamp()`/`record()` immediately after I/O read
161
+
162
+ The timestamp should reflect when data arrived on the host, not when processing finished.
163
+
164
+ ```python
165
+ # GOOD -- timestamp reflects when data arrived on the host
166
+ data = device.read()
167
+ session.stamp("sensor", frame_number=i) # immediately after read
168
+
169
+ # BAD -- processing delay adds jitter to timestamp
170
+ data = device.read()
171
+ processed = expensive_transform(data)
172
+ session.stamp("sensor", frame_number=i) # too late!
173
+ ```
174
+
175
+ ### Use one thread per device
176
+
177
+ Each device should have its own thread with a tight read loop. Both `stamp()` and `record()` are thread-safe.
178
+
179
+ ```python
180
+ import threading
181
+
182
+ def camera_thread(cam, stream_id, session):
183
+ i = 0
184
+ while recording:
185
+ frame = cam.read()
186
+ session.stamp(stream_id, frame_number=i)
187
+ i += 1
188
+
189
+ def sensor_thread(imu, stream_id, session):
190
+ i = 0
191
+ while recording:
192
+ data = imu.read()
193
+ session.record(stream_id, frame_number=i, channels={
194
+ "accel_x": data.ax, "accel_y": data.ay, "accel_z": data.az,
195
+ })
196
+ i += 1
197
+
198
+ t1 = threading.Thread(target=camera_thread, args=(camera, "cam_left", session))
199
+ t2 = threading.Thread(target=sensor_thread, args=(imu_device, "imu", session))
200
+ t1.start()
201
+ t2.start()
202
+ ```
203
+
204
+ ## Integration with SyncField Docker
205
+
206
+ ### Using `manifest.json` (recommended)
207
+
208
+ After `stop()`, the SDK writes a `manifest.json` that maps all streams to their files. Use it to construct the API request body programmatically.
209
+
210
+ ```python
211
+ import json
212
+ import requests
213
+
214
+ # Read the manifest produced by the SDK
215
+ with open("./sync_data/manifest.json") as f:
216
+ manifest = json.load(f)
217
+
218
+ host_id = manifest["host_id"]
219
+
220
+ # Build the streams list from manifest entries
221
+ streams = []
222
+ for stream_id, info in manifest["streams"].items():
223
+ stream_entry = {"stream_id": stream_id}
224
+
225
+ if "path" in info:
226
+ stream_entry["path"] = info["path"]
227
+
228
+ if info.get("type") == "sensor":
229
+ stream_entry["stream_type"] = "sensor"
230
+
231
+ streams.append(stream_entry)
232
+
233
+ # Mark the first video stream as primary
234
+ for s in streams:
235
+ entry = manifest["streams"][s["stream_id"]]
236
+ if entry.get("type") == "video":
237
+ s["is_primary"] = True
238
+ break
239
+
240
+ # Submit to SyncField Docker
241
+ resp = requests.post("http://localhost:8080/api/v1/sync", json={
242
+ "hosts": [
243
+ {
244
+ "host_id": host_id,
245
+ "streams": streams,
246
+ }
247
+ ],
248
+ "timestamps_dir": "/timestamps",
249
+ })
250
+ print(resp.json()) # {"job_id": "a1b2c3d4"}
251
+ ```
252
+
253
+ ### Volume-mounted mode
254
+
255
+ Mount your data and timestamp directories into the container and call the API directly.
256
+
257
+ ```bash
258
+ docker run -v ./data:/data -v ./sync_data:/timestamps \
259
+ syncfield-app:latest
260
+ ```
261
+
262
+ ```bash
263
+ curl -X POST http://localhost:8080/api/v1/sync \
264
+ -H "Content-Type: application/json" \
265
+ -d '{
266
+ "hosts": [
267
+ {
268
+ "host_id": "rig_01",
269
+ "streams": [
270
+ {"path": "/data/cam_left.mp4", "stream_id": "cam_left", "is_primary": true},
271
+ {"path": "/data/cam_right.mp4", "stream_id": "cam_right"},
272
+ {"stream_id": "imu", "stream_type": "sensor"}
273
+ ]
274
+ }
275
+ ],
276
+ "timestamps_dir": "/timestamps"
277
+ }'
278
+ ```
279
+
280
+ The service automatically matches `{stream_id}.timestamps.jsonl` and `{stream_id}.jsonl` files to streams using the `timestamps_dir` path.
281
+
282
+ ### File upload mode
283
+
284
+ Upload files directly without volume mounts. Use `host_ids` to group streams by host.
285
+
286
+ ```python
287
+ import requests
288
+
289
+ files = [
290
+ ("files", open("cam_left.mp4", "rb")),
291
+ ("files", open("cam_right.mp4", "rb")),
292
+ ("timestamp_files", open("sync_data/cam_left.timestamps.jsonl", "rb")),
293
+ ("timestamp_files", open("sync_data/cam_right.timestamps.jsonl", "rb")),
294
+ ]
295
+ data = {
296
+ "stream_ids": "cam_left,cam_right",
297
+ "host_ids": "rig_01,rig_01",
298
+ "primary_id": "cam_left",
299
+ }
300
+ resp = requests.post("http://localhost:8080/api/v1/sync/upload", files=files, data=data)
301
+ print(resp.json()) # {"job_id": "a1b2c3d4"}
302
+ ```
303
+
304
+ ## Format Specification
305
+
306
+ This section defines the output format for implementors in other languages.
307
+
308
+ ### `sync_point.json`
309
+
310
+ ```json
311
+ {
312
+ "sdk_version": "0.1.0",
313
+ "monotonic_ns": 1234567890123456789,
314
+ "wall_clock_ns": 1709890101000000000,
315
+ "host_id": "rig_01",
316
+ "timestamp_ms": 1709890101000,
317
+ "iso_datetime": "2024-03-08T12:00:01.000000"
318
+ }
319
+ ```
320
+
321
+ ### `{stream_id}.timestamps.jsonl`
322
+
323
+ One JSON object per line (no trailing comma, no array wrapper):
324
+
325
+ ```jsonl
326
+ {"frame_number":0,"capture_ns":1234567890123456789,"clock_source":"host_monotonic","clock_domain":"rig_01","uncertainty_ns":5000000}
327
+ {"frame_number":1,"capture_ns":1234567890156789012,"clock_source":"host_monotonic","clock_domain":"rig_01","uncertainty_ns":5000000}
328
+ ```
329
+
330
+ | Field | Type | Description |
331
+ |-------|------|-------------|
332
+ | `frame_number` | int | 0-based sequential index |
333
+ | `capture_ns` | int | Monotonic nanoseconds at data arrival |
334
+ | `clock_source` | string | Always `"host_monotonic"` for SDK output |
335
+ | `clock_domain` | string | Must match `host_id` -- identifies the clock |
336
+ | `uncertainty_ns` | int | Timing uncertainty (default: 5000000 = 5ms) |
337
+
338
+ **Key rules:**
339
+ - `capture_ns` must be monotonically non-decreasing within each stream
340
+ - `clock_domain` must be identical across all streams on the same host
341
+ - File name must be `{stream_id}.timestamps.jsonl` for auto-matching
342
+
343
+ ### `{stream_id}.jsonl` (Sensor Data)
344
+
345
+ One JSON object per line, combining timestamp and channel values:
346
+
347
+ ```jsonl
348
+ {"frame_number":0,"capture_ns":1234567890123456789,"clock_source":"host_monotonic","clock_domain":"rig_01","uncertainty_ns":5000000,"channels":{"accel_x":0.12,"accel_y":-9.8,"accel_z":0.05}}
349
+ {"frame_number":1,"capture_ns":1234567890133456789,"clock_source":"host_monotonic","clock_domain":"rig_01","uncertainty_ns":5000000,"channels":{"accel_x":0.13,"accel_y":-9.7,"accel_z":0.06}}
350
+ ```
351
+
352
+ | Field | Type | Description |
353
+ |-------|------|-------------|
354
+ | `frame_number` | int | 0-based sequential index |
355
+ | `capture_ns` | int | Monotonic nanoseconds at data arrival (same clock as video timestamps) |
356
+ | `clock_source` | string | Origin of the timestamp (always `"host_monotonic"` for SDK) |
357
+ | `clock_domain` | string | Host identifier -- must match across all streams on the same host |
358
+ | `uncertainty_ns` | int | Timing uncertainty (default: 5000000 = 5ms) |
359
+ | `channels` | object | Sensor values as key-value pairs (e.g. `{"accel_x": 0.12}`) |
360
+
361
+ ### `manifest.json`
362
+
363
+ Written by `stop()`. Maps all streams in the session to their output files.
364
+
365
+ ```json
366
+ {
367
+ "sdk_version": "0.1.0",
368
+ "host_id": "rig_01",
369
+ "streams": {
370
+ "cam_left": {
371
+ "type": "video",
372
+ "timestamps_path": "cam_left.timestamps.jsonl",
373
+ "frame_count": 900,
374
+ "path": "/data/cam_left.mp4"
375
+ },
376
+ "cam_right": {
377
+ "type": "video",
378
+ "timestamps_path": "cam_right.timestamps.jsonl",
379
+ "frame_count": 900,
380
+ "path": "/data/cam_right.mp4"
381
+ },
382
+ "imu": {
383
+ "type": "sensor",
384
+ "sensor_path": "imu.jsonl",
385
+ "timestamps_path": "imu.timestamps.jsonl",
386
+ "frame_count": 9000
387
+ }
388
+ }
389
+ }
390
+ ```
391
+
392
+ | Field | Type | Description |
393
+ |-------|------|-------------|
394
+ | `sdk_version` | string | SDK version that produced this file |
395
+ | `host_id` | string | Host identifier for this recording session |
396
+ | `streams` | object | Map of `stream_id` to stream metadata |
397
+ | `streams.*.type` | string | `"video"` or `"sensor"` |
398
+ | `streams.*.timestamps_path` | string | Relative path to the timestamps JSONL file |
399
+ | `streams.*.frame_count` | int | Number of frames/samples recorded |
400
+ | `streams.*.path` | string | (video only) Path set via `link()` |
401
+ | `streams.*.sensor_path` | string | (sensor only) Relative path to the sensor data JSONL file |
402
+
403
+ ## License
404
+
405
+ Apache-2.0