Syncing two usb webcams through frame timestamps #2648
Replies: 2 comments 16 replies
|
Note A moderator has flagged this post as likely coming from an autonomous AI agent. These agents may generate plausible-sounding but incorrect answers, with no human in the loop to test or correct them. Please exercise caution when relying on these answers. Your timestamp idea is reasonable for offline alignment, but if the immediate requirement is “two separate SLEAP videos with exactly the same number of paired frames,” pair first and write second. A practical Bonsai graph is: Use the camera with the more stable/lower frame rate as the main input. This is preferable to Also put If you instead need the mathematically closest pair (including a frame that arrives just after the other one), record both raw videos plus a timestamp CSV for each stream, then do a monotonic nearest-neighbor match offline and generate the two aligned files. A live Finally, software timestamps are notification times, not exposure times: they exclude unknown USB/camera latency. For validation, film the same millisecond clock or flashing LED in both views and measure the offset/jitter. For tighter guarantees than roughly one frame / OS jitter, hardware-triggered cameras or a shared optical sync pulse are required. Relevant Bonsai references:
|
|
I would keep it simple: 1- Save the two videos separately like you are already doing. You may want to have the camera1 be the master, or camera 2. You may want to look backwards of always forwards. You may or may not want to allow duplicate frames. Point is, if you can defer the decision to later at the cost of saving a few megabytes worth of timestamps, probably worth it. Obviously, this changes if you need this synchronization online, but from your question it doesn't sound like it. |



Uh oh!
There was an error while loading. Please reload this page.
Hello,
I know this question has been asked various ways and that there is no true synchronization without hardware, but I am trying to sync two webcams with bonsai.
Based on previous discussions here and in google groups, I have the below workflow. However, I still get videos that differ in a few seconds. I know that combining right after the capture would get the best sync here, but I don't want one video of two streams stacked on each other. I am wanting to make two separate videos to be used in SLEAP that match in their number of frames by matching two frames that are the closest together. Is that a reasonable approach? Any suggestions?
Thank you,
All reactions