# 同步方法对比

> 把同步相机、IMU 和其他设备的每一种方法放在一张表里：每种方法同步的是什么、已发表的精度、所需硬件，以及能否跨独立设备使用。然后是如何选择、如何验证你的同步，以及可以交给 AI 的提示词。

Page: https://egocam.ai/zh-cn/sync/sync-methods-compared/

本页把[硬件同步](https://egocam.ai/zh-cn/sync/hardware-sync/)和[软件同步与视觉同步](https://egocam.ai/zh-cn/sync/software-and-visual-sync/)两页中的每一种方法并排放在一起。术语的定义见[为什么同步很重要](https://egocam.ai/zh-cn/sync/why-sync-matters/)。

## 所有方法汇总表

精度数字是各来源在各自条件下发表的数字。它们不能直接比较：有的是最大误差，有的是标准差，有的是 RMSE，有的是厂商的宣称值。“视情况而定”表示我们没有找到已发表的数字。

| 方法 | 同步的对象 | 已发表的精度 | 所需硬件 | 能否跨独立设备？ | 最适合 |
|---|---|---|---|---|---|
| 硬件触发，主相机（primary）与副相机（secondary） | 曝光起点 | "within microseconds of each other"（意为：彼此相差在几微秒以内）（[Teledyne FLIR](https://www.teledynevisionsolutions.com/globalassets/support/iis/application-notes/tan2016008-configuring-synchronized-capture.pdf)） | 带触发输入和频闪输出（strobe）的相机，接线 | 仅在用线连在一起时 | 同一台刚性采集设备上的相机 |
| 传感器级帧同步（XVS、XHS、FSIN） | 帧起点 | 视情况而定 | 同步引脚已引出的传感器（[Raspberry Pi](https://www.raspberrypi.com/documentation/accessories/camera.html#synchronous-captures)、[Arducam](https://docs.arducam.com/USB-Industrial-Camera/Connect-and-Sync-Multi-Stereo-Cameras/Hardware-Trigger-with-External-Signal/)） | 仅在用线连在一起时 | 嵌入式双目或多传感器电路板 |
| Genlock（触发信号启动曝光） | 曝光起点 | 从脉冲到曝光的固定延迟约 790–880 µs；深度到彩色约 170–260 µs（[FRAMOS](https://docs.framos.com/en/latest/D400e/ApplicationGuides/ExternalEventCameraSynchronization.html)） | 带 genlock 模式的全局快门相机 | 仅在用线连在一起时 | 布置在采集空间四周的深度相机 |
| 触发信号选取下一个自由运行的帧（“外部事件”，external event） | 保留哪一帧 | 最多一帧："will never exceed the 1 frame readout time"（意为：绝不会超过 1 帧的读出时间）（[FRAMOS](https://docs.framos.com/en/latest/D400e/ApplicationGuides/ExternalEventCameraSynchronization.html)） | 触发输入 | 仅在用线连在一起时 | 事件驱动的采集，不适合运动 |
| 曝光补偿触发 | 曝光中点 | 相机与相机之间 "better than"（意为：优于）0.5 ms（[VersaVIS](https://arxiv.org/abs/1912.02469)） | 能读取曝光信号的微控制器触发板 | 仅在用线连在一起时 | 带 IMU 的自动曝光相机 |
| 相机和 IMU 共用一个微控制器时钟 | 时间戳 | 约 10 µs，LiDAR 到 IMU（[Faizullin et al.](https://arxiv.org/abs/2107.02625)）；传感器的恒定延迟仍然存在（[TUM-VIE](https://arxiv.org/abs/2108.07329)） | 带触发线和中断线的微控制器 | 仅在用线连在一起时 | 头戴式视觉惯性采集设备 |
| UVC 的 PTS 和 SCR | 相机自身时钟上的时间戳 | 视情况而定 | 发送这些字段的 UVC 相机（[UVC 1.5](https://www.usb.org/document-library/video-class-v15-document-set)） | 否 | 单台 USB 相机 |
| 主机到达时间戳 | 计算机时钟上的时间戳 | 抖动：ROS 处理 LiDAR 数据包时标准差为 82.64 µs，极端值达 8931.40 µs（[Faizullin et al.](https://arxiv.org/abs/2107.02625)）；USB 转串口链路上为 ±5 ms（[VersaVIS](https://arxiv.org/abs/1912.02469)） | 无 | 仅限同一台计算机内 | 快速原型 |
| 带硬件时间戳的 PTP | 时钟 | "sub-microsecond accuracy"（意为：亚微秒级精度）（[Red Hat](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ptp_using_ptp4l)）；对于与最高级主时钟（grandmaster）对齐的自由运行相机，曝光 "ideally"（意为：理想情况下）"within 1μs"（意为：在 1μs 以内）（[Vision Systems Design](https://www.vision-systems.com/articles/print/volume-22/issue-4/features/integration-insights-ieee1588-simplifies-camera-synchronization.html)） | 支持 PTP 的网卡、交换机、GigE 相机 | 能，通过以太网 | 布置在空间四周的固定相机 |
| NTP（chrony） | 时钟 | 在 chrony 的仿真中为 35 ± 8 µs 到 1603 ± 447 µs，取决于网络抖动（[chrony](https://chrony-project.org/comparison.html)） | 网络 | 能 | 各自给自己的传感器打时间戳的多台计算机 |
| GPS 和 PPS | 时钟 | PPS 比报文时间 "much more accurate"（意为：准确得多），而报文时间 "accurate to milliseconds"（意为：精确到毫秒）（[chrony FAQ](https://chrony-project.org/faq.html)） | 带 PPS 输出的 GNSS 接收机，能看到天空 | 能 | 户外采集 |
| Lab Streaming Layer | 时间戳 | 两路数据流之间的标准差约 0.5 ms（[Kothe et al.](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC12434378/)） | 网络；设备延迟需另行测量 | 能 | 混合传感器：眼动仪、EEG、相机 |
| Project Aria TICSync（第 1 代） | 时间戳 | "better than 1ms on average after approximately 45 seconds warm-up"（意为：预热约 45 秒后，平均优于 1ms）（[Meta](https://facebookresearch.github.io/projectaria_tools/docs/ARK/sdk/concepts/about_ticsync)） | 连在同一个 Wi-Fi 热点上的 Aria 第 1 代眼镜 | 能 | 多名 Aria 佩戴者 |
| Project Aria SubGHz（第 2 代） | 时间戳 | 视情况而定 | Aria 第 2 代眼镜 | 能 | 多名 Aria 佩戴者 |
| SMPTE 时间码 | 帧标签 | 帧级；在 Aria 试点数据集中为 "sub-millisecond"（意为：亚毫秒级）（[Meta](https://facebookresearch.github.io/Aria_data_tools/docs/pilotdata/timestamps)） | 每台设备一个时间码发生器或同步盒 | 能 | 与影视和音频器材混用 |
| GPS 时间码（GoPro Labs） | 帧标签 | "typically within a frame or two"（意为：通常在一两帧以内）（[GoPro](https://gopro.github.io/labs/control/gpssync)） | 带 GPS 的 GoPro，能看到天空 | 能 | 户外运动相机 |
| 由相机读取的二维码 | 相机时钟 | 50 ms 以内，由 [RocSync](https://arxiv.org/abs/2511.14948) 转引自 GoPro | 手机屏幕；GoPro Labs 或 Tentacle 应用 | 能 | 运动相机，粗略同步 |
| 从录像中解码的二维码 | 事后得到的时间戳 | 视情况而定；见[精度极限](https://egocam.ai/zh-cn/sync/software-and-visual-sync/) | 任意屏幕 | 能 | 任意相机，开头和结尾各同步一次 |
| 单次闪光 | 一个时刻 | 视情况而定 | 一盏灯 | 能，前提是所有相机都看到它 | 快速检查 |
| 随机 LED 闪烁（ROOLS） | 偏移 | "up to subframe interval precision"（意为：可达亚帧间隔的精度）（[Zhao and Chen](https://doi.org/10.1117/1.3247860)） | 一个 LED 和控制器 | 能，前提是所有相机都看到它 | 共享同一视野的固定相机 |
| LED 时钟（RocSync） | 时间戳和曝光窗口 | 相对硬件同步为 "1.34 ms RMSE"（意为：RMSE 为 1.34 ms）（[Meyer et al.](https://arxiv.org/abs/2511.14948)） | LED 时钟板，约 20 美元 | 能，依次给每台相机看 | 消费级相机与可穿戴相机混用 |
| 卷帘快门 LED 灯带 | 亚帧时间 | "approximately 15 µs"（意为：约 15 µs）（[Nazarenus et al.](https://arxiv.org/abs/2511.22459)） | LED 灯带和微控制器 | 能，前提是所有相机都看到它 | 高速固定相机 |
| 拍手声或音频互相关 | 音轨 | 声音穿过 10 m 的房间需要 "roughly 30 milliseconds"（意为：大约 30 毫秒）（[Meyer et al.](https://arxiv.org/abs/2511.14948)） | 麦克风 | 能 | 视频与声音的粗略对齐 |
| 运动相关（陀螺仪与图像旋转） | 相机–IMU 偏移 | "within a domain of ±0.2 ms"（意为：在 ±0.2 ms 的范围内）（[Furgale et al.](https://furgalep.github.io/bib/furgale_iros13.pdf)） | 运动，Kalibr 需要标定板 | 能，前提是刚性连接 | 相机–IMU 偏移，每次采集都做 |
| Raspberry Pi 软件相机同步 | 帧起点（相位） | "several tens of microseconds"（意为：几十微秒），同一块板上的同型号相机（[Raspberry Pi](https://www.raspberrypi.com/documentation/computers/camera_software.html#software-camera-synchronisation)） | Raspberry Pi 相机，网络 | 能 | 不接线的 Raspberry Pi 采集设备 |
| 智能手机相位对齐（libsoftwaresync） | 曝光相位 | 两部手机之间最大 121 µs（[Ansari et al.](https://arxiv.org/abs/1812.09366)） | 连在 Wi-Fi 上的 Android 手机 | 能 | 手机阵列 |
| 智能手机视频同步（RecSync） | 曝光相位 | "does not exceed 250 µs"（意为：不超过 250 µs）（[Akhmetyanov et al.](https://arxiv.org/abs/2107.00987)） | 提供实时时间戳的 Android 手机 | 能 | 带 IMU 的手机视频 |

## 如何选择

> **Diagram:** The six patterns published rigs use to share time across devices, each with a published example (the examples are tabled on Syncing Multiple Devices). Only the first, one trigger and one clock on one board, aligns exposures by construction; network and radio sync align clocks, and visual events and latency matching align streams after the fact.

先回答那个决定大部分结果的问题：传感器是在一台可以接线的刚性采集设备上，还是在各自独立的设备上？

**传感器在同一台采集设备上**。使用硬件同步。由一个信号源触发所有相机，用同一个时钟给曝光和 IMU 采样打时间戳，并记录曝光时间，以便计算曝光中点。然后用 Kalibr 或在线估计器标定剩下的恒定偏移，例如 IMU 的读出延迟，做法见 [IMU 标定指南](https://egocam.ai/zh-cn/calibration/imu-calibration/)。

**由你控制的独立设备**。在录制期间持续同步时钟：设备在以太网上就用 PTP，Aria 眼镜用 TICSync 这类厂商方法，混合的实验室设备用 LSL，或者用带本地服务器的 NTP。时钟同步不会对齐曝光，所以如果需要亚帧精度，要在开头和结尾各加一个视觉事件。

**你无法改装的相机**。在每次录制的开头和结尾使用事件同步。LED 时钟的已发表精度最好，还能测量曝光。二维码时间戳只需要一块屏幕。用两端的读数拟合一条直线来去除漂移；如果处理流程需要亚帧时序，就在帧与帧之间插值。

**手机**。使用 RecSync 或 OpenCamera Sensors 这类相位对齐应用，并检查手机报告的时间戳来源是实时的。

**任何情况下**。在一次采集过程中或结束时重复同步。只在开头同步一次，无法测量漂移。

## 如何验证你的同步

同步方法可能无声无息地失效：一切看起来都合理，直到三维重建或跟踪的效果比应有的差。下面这些检查能把它抓出来。

### 拍摄快速变化的灯或毫秒时钟

把每台相机都对准一个变化得比一帧还快的光源，比较各台相机在同一个声称时刻拍到的内容。上文的研究项目就是这么做的：Ansari et al. 拍摄了一块每 200 µs 步进一次的 LED 面板，VersaVIS 用一块 1 kHz 的 LED 计时板检查了 400 对图像，RocSync 的 LED 环每毫秒前进一个 LED。最便宜的做法是用单个 LED 按已知的模式闪烁。使用短曝光，这样光不会拖过很多个步进。

### 对照 IMU 检查

在多次录制上用 Kalibr 估计相机–IMU 时间偏移，或者从你的在线估计器中读出它。使用硬件同步时，这个偏移每次都应该几乎相同；VersaVIS 报告说，在各种曝光设置下标准差都低于 0.05 ms。偏移在不同采集之间变化，或在一次采集内变化，说明用的是软件时间戳，或者存在漂移。

### 直接测量漂移

在开头和结尾各同步一次，然后计算漂移。把它与晶振的标称值比较：消费级晶振的标称值通常为 ±20 到 ±50 ppm，所以两台设备之间最多可相差 100 ppm（[Fora Soft](https://www.forasoft.com/learn/audio-for-video/articles-audio/drift-correction-resampling-frame-drop)；另见[实测漂移](https://egocam.ai/zh-cn/sync/why-sync-matters/)）。如果中间也有读数，要查看有没有阶跃。在时间由帧计数算出的数据流中，一次丢帧或重复帧表现为偏移突然跳变一个帧间隔，而不是稳定的斜率。

### 使用运动的目标

没有参考时钟时，就利用场景。RocSync 比较各种同步方法的做法是，用一块快速运动的棋盘格标定两台相机：重投影误差 "is minimized when the video streams are perfectly synchronized, thus providing a direct and quantitative measure of the temporal alignment achieved by each approach"（意为：在视频流完全同步时达到最小，因此可以直接、定量地衡量每种方法达到的时间对齐程度）（[Meyer et al., 2025](https://arxiv.org/abs/2511.14948)）。用手也可以做同样的事：从多台相机对它做三角化，检查手快速运动时误差没有变大。

### 检查计数器

读出每一路数据流的帧序号和时间戳间隔。间隔出现空缺或变成两倍，就是丢帧；不均匀的成批到达，就是缓冲。Kalibr 的指南给出了一种典型的坏模式：IMU 采样的发送方式是 "at a rate of 1ms with gaps of 6ms between"（意为：以 1ms 的间隔发送，中间有 6ms 的空缺）（[Kalibr camera–IMU guide](https://github.com/ethz-asl/kalibr/wiki/camera-imu-calibration)）。

## 可以交给 AI 的提示词

这些提示词是为粘贴到编程助手中而写的。每一条要的都是你自己能检查的代码；在信任输出之前先读一遍。

### 解码二维码时间戳并估计偏移和漂移

```text
写一个 Python 脚本，输入是若干视频文件，每台相机一个。每个视频在录制的开头附近
和结尾附近都拍到一块屏幕，屏幕上的二维码编码的是当前时间，单位是自 Unix 纪元
起的毫秒数。对每一帧：从容器中读出该帧的显示时间戳（使用 PyAV），用 OpenCV 的
QRCodeDetector 解码其中的二维码，并记录 (frame_time, qr_time)。解码失败的帧
跳过。对每台相机，用鲁棒拟合（RANSAC 或 Huber）拟合 qr_time = a * frame_time + b，
报告偏移 b（单位 ms）、漂移 (a - 1)（单位为百万分之一，ppm）、残差标准差，以及
两端各自的读数个数。如果只有一端有读数就给出警告，因为这样无法测量漂移。写出
一个 CSV，把每台相机的每一帧映射到公共时间基准上。按相机绘制残差图。
```

### 用陀螺仪和光流估计相机–IMU 偏移

```text
写一个 Python 脚本，估计刚性连接在一起的一台相机和一个 IMU 之间的时间偏移。
输入：一个带逐帧时间戳的视频，以及一个 IMU 的 CSV，其中有时间戳和陀螺仪的
x、y、z，单位 rad/s。用跟踪到的特征估计相机的帧间旋转（OpenCV 的
goodFeaturesToTrack 和 calcOpticalFlowPyrLK，然后用给定的内参调用
findEssentialMat 和 recoverPose），把它换算成角速度大小，再与陀螺仪的角速度
大小比较。把两者重采样到同一个采样率，然后在正负 200 ms 的范围内找出使两者
归一化互相关最大的时间平移，并在峰值附近用抛物线拟合细化到亚采样精度。以 ms
为单位报告偏移，符号约定为 t_imu = t_cam + shift，并绘制对齐后的两路信号。
说明这个结果是粗略的，最终数值应使用 Kalibr 或在线估计器得到。
```

### 用两个同步点计算漂移并修正时间戳

```text
我每次录制有两个同步事件。在每个事件上，我知道参考时钟上的时间和设备时钟上的
时间。写一个简短的 Python 函数，计算两个时钟之间的偏移和以百万分之一（ppm）
为单位的漂移，然后用线性插值把任意设备时间戳换算成参考时间（在两个事件之外
则外推，并给出警告）。用下面这个例子写单元测试：设备在开头快 1240 ms，60 分钟
后快 1312 ms，结果应为 20 ppm，且在 30 分钟处的偏移为 1276 ms。
```

### 检查一次录制中的丢帧和时间戳抖动

```text
写一个 Python 脚本，读取若干路相机数据流和一路 IMU 数据流的逐帧时间戳（CSV
文件，其中有一列以纳秒为单位的时间戳）。对每一路数据流，报告标称速率、间隔的
中位数、间隔的标准差、长于中位数 1.5 倍的间隔个数（很可能是丢失的采样），以及
连续若干个间隔远短于中位数的成批到达（很可能是缓冲）。按数据流绘制间隔的
直方图，并绘制一条标出每个空缺的时间线。标记出时间戳出现倒退的任何数据流。
```

## 参考来源

- Teledyne FLIR (2017). [TAN2016008: Configuring synchronized capture](https://www.teledynevisionsolutions.com/globalassets/support/iis/application-notes/tan2016008-configuring-synchronized-capture.pdf).
- Raspberry Pi. [Camera hardware: synchronous captures](https://www.raspberrypi.com/documentation/accessories/camera.html#synchronous-captures) 和 [software camera synchronisation](https://www.raspberrypi.com/documentation/computers/camera_software.html#software-camera-synchronisation)。
- Arducam. [Hardware trigger with external signal](https://docs.arducam.com/USB-Industrial-Camera/Connect-and-Sync-Multi-Stereo-Cameras/Hardware-Trigger-with-External-Signal/).
- FRAMOS. [External event camera synchronization (D400e)](https://docs.framos.com/en/latest/D400e/ApplicationGuides/ExternalEventCameraSynchronization.html).
- Tschopp, F. et al. (2020). [VersaVIS: An open versatile multi-camera visual-inertial sensor suite](https://arxiv.org/abs/1912.02469). *Sensors*.
- Faizullin, M., Kornilova, A. and Ferrer, G. (2021). [Open-source LiDAR time synchronization system by mimicking GNSS-clock](https://arxiv.org/abs/2107.02625). arXiv.
- Klenk, S., Chui, J., Demmel, N. and Cremers, D. (2021). [TUM-VIE: The TUM stereo visual-inertial event dataset](https://arxiv.org/abs/2108.07329). *IEEE/RSJ IROS*.
- USB Implementers Forum. [USB Video Class 1.5 document set](https://www.usb.org/document-library/video-class-v15-document-set).
- Red Hat. [RHEL 7: Configuring PTP using ptp4l](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ptp_using_ptp4l).
- Eikawa, S. (2017). [Integration insights: IEEE1588 simplifies camera synchronization](https://www.vision-systems.com/articles/print/volume-22/issue-4/features/integration-insights-ieee1588-simplifies-camera-synchronization.html). Vision Systems Design.
- chrony. [Frequently asked questions](https://chrony-project.org/faq.html) 和 [comparison of NTP implementations](https://chrony-project.org/comparison.html)。
- Kothe, C. et al. (2025). [The lab streaming layer for synchronized multimodal recording](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC12434378/). *Imaging Neuroscience*.
- Meta Project Aria：[About TICSync](https://facebookresearch.github.io/projectaria_tools/docs/ARK/sdk/concepts/about_ticsync) 和 [pilot data timestamps](https://facebookresearch.github.io/Aria_data_tools/docs/pilotdata/timestamps)。
- GoPro Labs. [GPS time synchronization](https://gopro.github.io/labs/control/gpssync).
- Meyer, J. et al. (2025). [RocSync: Millisecond-accurate temporal synchronization for heterogeneous camera systems](https://arxiv.org/abs/2511.14948). arXiv.
- Zhao, Q. and Chen, Y. Q. (2009). [High-precision synchronization of video cameras using a single binary light source](https://doi.org/10.1117/1.3247860). *Journal of Electronic Imaging* 18(4).
- Nazarenus, J. et al. (2025). [Gaussians on Fire](https://arxiv.org/abs/2511.22459). arXiv.
- Furgale, P., Rehder, J. and Siegwart, R. (2013). [Unified temporal and spatial calibration for multi-sensor systems](https://furgalep.github.io/bib/furgale_iros13.pdf). *IEEE/RSJ IROS*.
- Ansari, S., Wadhwa, N., Garg, R. and Chen, J. (2019). [Wireless software synchronization of multiple distributed cameras](https://arxiv.org/abs/1812.09366). *IEEE ICCP*.
- Akhmetyanov, A. et al. (2021). [Sub-millisecond video synchronization of multiple Android smartphones](https://arxiv.org/abs/2107.00987). *IEEE Sensors*.
- Fora Soft. [Drift correction: resampling, frame drop, frame insertion](https://www.forasoft.com/learn/audio-for-video/articles-audio/drift-correction-resampling-frame-drop).
- Kalibr：[camera–IMU calibration](https://github.com/ethz-asl/kalibr/wiki/camera-imu-calibration)，ETH Zurich ASL。
