Steve, thanks for your reply, as said I cannot use genlocks since I have not the hw available for the project. This means I will need to stick to the two standard camera solution trying to minimize the drifting problems. Basically I can live with some little drift which would mean that I would mean that the capturing of the images from the first and second camera would sometimes be off by one frame. But my primary question was how to address the capturing of video from two sources. (I'd prefer if it was possibile to use one single thread because (IMHO) it ensures better sync. For example to capture a single stream I do the following in a loop: while (1) { mm.frame = doublebuf_frame; if(ioctl(fd, VIDIOCMCAPTURE, &mm)<0) perror("VideoIO::acquireFrame:VIDIOCMCAPTURE"); doublebuf_frame=1-doublebuf_frame; vsync_frame=doublebuf_frame; do { e=ioctl(fd, VIDIOCSYNC, &vsync_frame); if(e>=0) break; } while(errno==-EINTR); if(e<0) perror("VIDIOCSYNC"); // videoin_line is the current pointer to an array of scanlines that point to the scanlines in the two v4l acquisition buffers // videoin_line0 points to the first buffer's scanlines , _line1 to the second videoin_line=videoin_line0; if(doublebuf_frame) videoin_line=videoin_line1; // here can you read out the data from the current buffer } ---- I was wondering what the correct way to acquire two streams in one single loop looks like. Is it enough to replicate the body of the above while loop for the 2nd v4l device and read out the two buffers at the end ? What will happen when devices will go out of sync ? (eg you loose (= you read out the same buffer for 2 consecutive frames ?) a frame on the device that runs at the faster frequency and then everything gets back to normality. Any thoughts ? > > I'd be interested in how it works out. My video acquisition stuff is part of an university project about tracking markers on objects in 3D space (and related realtime animation of 3d models in opengl), I'll release the source this autumn when the project will be finished. cheers, Benno. Stephen Davies wrote: > On Wed, 26 Jun 2002, Benno Senoner wrote: > > > My question: what's the best way to capture two images (almost) > > simultaneously ? > > Hi, > > The video capture process is tied to the frame rate coming from the video > source. The video capture card doesn't "clock" for itself. > > You need your two cameras to be synchronised. Some pro-ish cameras have a > facility to lock their frame rates I believe. Failing that, gen-lock > devices can be bought to synchronise two video sources. > > But I suspect that if you just read frames from both cards you'll be fine. > The cameras should both deliver frames very close to the "right" rate. > v4l2 provides driver generated timestamps so that would simplify staying > in step (though, 99%+ of the time you ought to get one-for-one frames). > > I'd be interested in how it works out. > > Regards, > Steve