Hi Martin,

On Friday 27 August 2010 16:14:52 Martin wrote:
> The problem:
> 
> From reading around this list and elsewhere, it appears that you simply
> cannot run more than one webcam video stream per USB root hub.
>
> When enabled for video streaming, the webcam reserves the full
> isochronous bandwidth needed to stream data at the selected resolution
> and framerate, regardless of whether your application acquires the full
> framerate or just samples at one frame per second.

That's not correct. The webcam reports its bandwidth requirements, and the 
driver allocates bandwidth accordingly. Some cameras are buggy and report high 
bandwidth requirements when they could use lower bandwidths.

> Hence, trying to set a low framerate in your user application has no effect
> to reduce the bandwidth from the webcam.

That's correct, because most webcams can't buffer a whole frame of video data 
and send it slowly over USB (embedded RAM is expensive). Even at lower frame 
rates, webcams might thus need high bandwidth for a short time. As USB 
bandwidth reservation takes the peak bandwidth into account, bandwidth will be 
wasted.

> The webcam is still streaming at the maximum framerate regardless.
> 
> I'm guessing that the video stream is being 'pushed' out by the webcam
> firmware and so the UVC driver must take all that it is given...

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.

> On *nix, "everything is a file"... Could the uvc driver accept reading
> of /dev/videoX by the command "cp" so that still image data is copied,
> formatted for a jpg or png?

It would need to process the image (compress it to JPG or PNG), and that's not 
the job of a kernel driver, so no.

> Could the "quirks" setting be abused to set the image grab rate? Or some
> other neater method?
> 
> 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)

> On separate hubs, they work fine. On the same hub, the second one to
> start shows the error:
> 
> "Error starting stream VIDIOC_STREAMON: No space left on device".
> 
> I've only got the one root hub on the system I want to use for the two
> webcams!
> 
> Their descriptors show:
> 
>         bFrameIntervalType                  2
>         dwFrameInterval( 0)           2000000
>         dwFrameInterval( 1)           4000000
> 
> 
> 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.

-- 
Regards,

Laurent Pinchart
_______________________________________________
Linux-uvc-devel mailing list
Linux-uvc-devel@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to