I'm new to v4l so forgive me if this question has been
answered many times before. I am using four USB webcams and would like to
access them directly using v4l. I am able to open and configure all four
cameras but when I go to take snaphots with them I can only get one from each
controller to work. Does anyone know why this doesn't work? Does
anyone have any work arounds?
Thanks,
Mike
PS. Code snippit trying to read from 4 cameras. If I make the
number of cameras 2 and just use /dev/video0 and /dev/video2 I get one image
from each. If I try to use /dev/video0 and /dev/video1 the program hangs
waiting for sync from camera 1.
for (i = 0; i < NUM_CAMERAS;
i++)
{
k = 0;
log("taking shot for cam %i\n", i);
if (ioctl(grab_fd[i], VIDIOCMCAPTURE, &grab_buf[i]) == -1)
{
perror("ioctl VIDIOCMCAPTURE");
return;
}
log("waiting for sync for cam %i\n", i);
while (ioctl(grab_fd[i], VIDIOCSYNC, &k) < 0) ;
{
k = 0;
log("taking shot for cam %i\n", i);
if (ioctl(grab_fd[i], VIDIOCMCAPTURE, &grab_buf[i]) == -1)
{
perror("ioctl VIDIOCMCAPTURE");
return;
}
log("waiting for sync for cam %i\n", i);
while (ioctl(grab_fd[i], VIDIOCSYNC, &k) < 0) ;
log("just took shot for cam
%i\n", i);
}
}