My follow-up on this subject:
-
In attachment, a table with experiments on the cameras I have. Entries are in the format “laptop / BBB”.
-
To test the USB bandwidth, I experimented playing some video files on a USB pen connected to the BBB with mplayer and redirecting X to my laptop (connecting with ssh -Y). The movie files were:
a) RIFF (little-endian) data, AVI, 608 x 256, 23.98 fps, video: XviD, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)
b) RIFF (little-endian) data, AVI, 720 x 404, ~30 fps, video: DivX 5, audio: MPEG-1 Layer 3 (stereo, 48000 Hz)
c) ISO Media, MPEG v4 system, version 1
Results are: a) played OK, b) played a little slow and c) played really slowly, almost stopped.
-
I have a theory on why the Logitech camera works and the others don’t. The Logitech is the only one which is able of fps = 5, 10, 15, 20, 25 and 30. The others are 30 fps (YUYV) and one of them is 60 fps (MJPG). This goes along with what Matthew (?) said: fps must be reduced in order to be able to capture. This reduction is probably made automatically with the Logitech, while the others are not able to go below 30 or 60 fps.
-
I’ve been experimenting with this v4l2 code:
fd_set fds;
FD_ZERO(&fds);
FD_SET(fd, &fds);
struct timeval tv = {0};
tv.tv_sec = 0;
if(-1 == xioctl(fd, VIDIOC_STREAMON, &buf.type))
{
perror(“Start Capture”);
return 1;
}
/* int r = select(fd+1, &fds, NULL, NULL, &tv);
if(-1 == r)
{
perror(“Waiting for Frame”);
return 1;
}*/
if(-1 == xioctl(fd, VIDIOC_DQBUF, &buf))
{
perror(“Retrieving Frame”);
return 1;
}
if(-1 == xioctl(fd, VIDIOC_STREAMOFF, &buf.type))
{
perror(“Stop Capture”);
return 1;
}
to see if I could reduce the interval during which the stream is open (and data is transferred through the bus). This code is more or less the same in Derek Molloy’s examples, v4l2grab, etc. but I’m using it from capturev4l2. I had to add the VIDIOC_STREAMOFF, otherwise my laptop would crash with kernel panic. I moved the FD_* code out of the interval and commented the call to select, but it does not change the result.
cameras.pdf (36.9 KB)