Hi Martin, On Tuesday 14 September 2010 11:36:56 Martin wrote: > On 13/09/10 00:11, Laurent Pinchart wrote: > > On Friday 27 August 2010 16:14:52 Martin wrote: > >> The problem: > [...] > > > The webcam sends a frame at high speed and then waits a (relatively) long > > time before sending the next frame. > > > >> *A possible solution* ? > >> > >> Instead, could the UVC driver 'simulate' a reduced framerate by instead > >> using the "STILL_IMAGE_FRAME" mode of the webcam and grab for itself a > >> set number of images per second? Or even only when polled by a read from > >> the user application? > > > > Still image capture isn't supported yet. The reason is that most webcams > > just ask the driver to take the next picture in the video stream to > > emulate still image capture. Very few cameras support out-of-band still > > image capture, and I don't own any that support that. > > > > As most cameras just ask the driver to capture the next frame in an > > active video stream this won't solve your problem anyway. > > That's quite a shame... And very wasteful of bandwidth. > > I guess we need slightly more expensive webcams that buffer an image into > local ram before forwarding it on at whatever USB rate might be available. > No go on that one I guess...
That's unfortunately not the kind of features found in consumer webcams. The problem with buffering is also that it can introduce lag. > >> Further details: > >> > >> I'm trying to use two webcams simultaneously: > >> iManufacturer 1 Sweex > >> iProduct 2 WC060 Series HD Webcam > > > > Please post the whole USB descriptors (lsusb -v) > > I've attached "lsusb -v -d 177f:0060". Thanks. I've added the camera to the supported devices list. > >> Can I tweak the UVC driver to preferentially choose the slower frame > >> rate available? > > > > You can select a frame rate explictly with VIDIOC_S_PARM. > > > >> Aside: The MJPG format doesn't seem to work, nor are any compression > >> settings visible... > > > > Maybe your webcam doesn't support MJPG. > > > >> Given a few hints or a patch, I can hack the kernel module to test :-) > >> > >> This is running on Gentoo, kernel 2.6.34 using the in-kernel uvc module. > >> > >> Any comment/ideas welcomed. > > > > If you don't need to capture frames simultaneously, you can just start > > the video stream, capture a frame, stop the video stream, and repeat the > > sequence on the second webcam. > > > > If you need higher frame rates, search the mailing list archives for > > discussions about bandwidth (dwMaxPayloadTransferSize is a keyword). You > > can also have a look at the "Multiple camera framerate." mail thread > > started by Dennis Muhlestein. > > Thanks for the pointers. > > I've had mixed results with (bash): > > while true > do > ffmpeg -v 5 -y -r 5 -vframes 2 -s xga -f video4linux2 -i /dev/video0 > -sameq -f image2 foo0-%03d.jpg > sleep 5 > ffmpeg -v 5 -y -r 5 -vframes 2 -s xga -f video4linux2 -i /dev/video1 > -sameq -f image2 foo1-%03d.jpg > sleep 5 > date -R > done > > That sometimes works fine, and then can randomly freeze at the point > where ffmpeg is to capture a frame. Usually, the freeze-up scenario is > that /dev/video0 is captured fine and then ffmpeg freezes on /dev/video1. > > The "-r 5" may well not be needed. "-vframes 1" also works for if you > just want one frame, although I've found the first frame can be > overexposed compared to the following frames. > > Not sure if -sameq is doing anything. Trying -bitexact always caused an > error for the options. > > The "sleep 5" appears to help to allow operation for longer (a minute or > so) before ffmpeg freezing. > > Running ffmpeg manually, one webcam at a time usually works fine. > > Using "-r 30 -s vga" for the default framerate and 640x480 always works... > > So... Is there some timing race or other untidiness whereby ffmpeg jams > or the video stream otherwise doesn't start? A 5 seconds sleep should be more than enough. It would be interested to find out what happens when ffmpeg freezes. You can attach strace to the frozen ffmpeg process to find out on which syscall it gets stuck (if any). > I've only got one PCI slot... Are there any PCI cards with multiple > separate USB hubs?! (I suspect not...) I suppose you mean with separate USB controllers. I don't know. -- Regards, Laurent Pinchart _______________________________________________ Linux-uvc-devel mailing list Linux-uvc-devel@lists.berlios.de https://lists.berlios.de/mailman/listinfo/linux-uvc-devel