directshow – Synchronous video capture from multiple cameras

Question:

Introductory: there are multiple webcams. On Windows, they are presented as Video Capture Sources.

Task: to get synchronous (plus or minus one frame) recording of video streams to files. That is, it is necessary that the files start synchronously and do not scatter as they play.

As I understand it, when recording from multiple cameras, you need to build its own capture graph for each camera. Are there in-house tools in Directshow to synchronize graphs? Is it possible to provide synchronous start of recording for multiple graphs?

If it is impossible to synchronize the beginning, then are there any ways to at least find out the timestamp of the first frames in each record, so that you can manually align them in time?

Answer:

Perhaps it will help to create a separate filter that has input and output pins of video streams equal in number to the latter. This filter should pass frames to writers synchronously, that is, only when new video frames are ready at all inputs. It may be necessary to create video FIFO buffers for each of the streams, since the video capture rate in some may exceed the capture rate in others.

Scroll to Top