Discussion:
[linux-uvc-devel] force a lower USB bandwidth allotment / compressed streams / multiple webcams
u***@viop.ca
2014-02-05 09:49:44 UTC
Permalink
Goal:
As many webcams as possible running on 1 host controller, running at
***@30fps with native H.264 compression.

Problem:
USB bandwith allocation (60%) seems too high for each C920 webcam
running at ***@30fps, when using native H.264 compression. This
limit allows only 1 Webcam per USB controller.

=======

Previous tests:
1. One Logitech C920; ***@30fps; MJPG; Alloc 60%; 19% CPU;
network bandwidth ~50Mb/s (megabits per second)
2. One Logitech C920; ***@30fps; H.264; Alloc 60%; 1.3% CPU;
network bandwidth ~3.2Mb/s
3. Two Logitech C920's; ***@1920x1080@30fps; ***@1280x720@30fps; H.264;
Alloc 92%; 3% CPU; network bandwidth ~6.4Mb/s
4. Three Logitech C920's; ***@1280x720@30fps; H.264; Alloc 96%; 5% CPU;
network bandwidth ~9.6Mb/s
5. Four Logitech C920's; ***@640x360@30fps; H.264; Alloc 32%; 5.5%CPU;
network bandwidth ~11.2Mb/s*

*one cam was viewing a dark scene, so the network bandwidth was
reporting low. In reality the expected bandwidth would be ~12.8Mb/s.

=======

Commands used:
#enable USB debugging
sudo mount -t debugfs none_debugs /sys/kernel/debug
sudo modprobe usbmon
cat /sys/kernel/debug/usb/devices |grep Alloc
#available formats/resolutions
v4l2-ctl --list-formats-ext --device=/dev/video1
#to stream
cvlc -vvv v4l2:///dev/video1:chroma=h264:width=1920:height=1080
--sout='#standard{access=udp,mux=ts,dst=192.168.1.255:8081,name=stream}'
#to play
vlc udp://@:8083

=======

Hardware used:
1. Asus Digimatrix HTPC
-SiS 651 chipset (315 series)
-Intel P4 2.66GHz
-4x SiS USB 1.1 Controller (PCI :03.1, :03.2, :09.0, :09.1) (4
external USB ports)
-2x SiS USB 2.0 Controller (PCI :03.3, :09.2) (4 external USB ports)

2. D-Link DUB-H4; USB 2.0, 4-port, powered hub

3. 4x Logitech C920 Webcams; ***@30fps capabable
4. 5x StarTech USB2FAAEXT15; 16ft USB 2.0 active extension cable

=======

Topology of the 4-webcam test setup: (view properly with a
monospace/console font)
*--------------------*
| USB 2.0 Controller |
*--------------------*
|
*--------------------*
| 16ft USB Extension |
*--------------------*
|
*----------------------------*
| USB 2.0 4-port powered Hub |
*----------------------------*
| | | |
| | | \_*-------------*
| | | | C920 Webcam |
| | | *-------------*
| | |
| | \_*-------------*
| | | C920 Webcam |
| | *-------------*
| |
| \_*--------------------* *--------------------* *-------------*
| | 16ft USB Extension |--| 16ft USB Extension |--| C920 Webcam |
| *--------------------* *--------------------* *-------------*
|
\_*--------------------* *--------------------* *-------------*
| 16ft USB Extension |--| 16ft USB Extension |--| C920 Webcam |
*--------------------* *--------------------* *-------------*

=======

Observations:
1. USB full speed is 480Mb/s. The network bandwidth needed to carry
each native H.264 ***@30fps stream is ~3.2Mb/s. If we
(incorrectly?) assume that the USB bandwidth needs are approximately the
same as the network bandwidth needs, then 150 webcams on one USB
controller would theoretically be possible. Even if that assumption is
wrong by a factor of 10 (because of other limitations), then 15 webcams
at full HD should still be possible.

2. Default USB allocation seems to be 60% for all resolutions that I
tried, except for 2, which are significantly lower (better):
160x90: 60%
320x180: 60%
640x360: 8%
1280x720: 32%
1920x1080: 60%

=======

Questions:
1. Is there a bug in the way the USB bandwidth allocation is fixed at
60% for most resolutions?

2. Is 60% really required for 1920x1080 H.264?

3. With regard to the uvcvideo FAQ[1], is this where these issues can
be addressed in the source code (for those who possess the skills):
uvc_init_video():
/* Isochronous endpoint, select the alternate setting. */
bandwidth = stream->ctrl.dwMaxPayloadTransferSize;

4. Is this something that could/should be addressed in a
webcam-model-specific way, or generally.

5. BONUS question: What is a realistic maximum number of (IP broadcast
streaming) ***@30fps webcams on this computer (the Digimatrix),
and what is the limiting factor?

footnotes:
[1] uvcvideo FAQ: "I get a "No space left on device" (-28) error when
trying to stream from more than one camera simultaneously."
http://www.ideasonboard.org/uvc/faq/

=======
u***@viop.ca
2014-02-07 09:04:10 UTC
Permalink
I am more aware now that this type of problem has been asked about many
times before, forgive me if the solution is out there, but I didn't see
it anywhere.

Anyhow, I have downloaded the linuxtv media-build source and played with
it for a couple of evenings now. As lost as I am, I've managed to force
a change from:
uvcvideo: Device requested 3020 B/frame bandwidth
to:
uvcvideo: Device requested 2265 B/frame bandwidth
and various other numbers, but the automatic nature of the functions in
uvcvideo.c rolls through all of the alternate settings (resolutions) and
then gives up without finding a suitable one. (The first alternate, 0, I
think is the highest resolution, and is also what I think should be
selected.)

For myself, I would just like to manually make the change from:
$cat /sys/kernel/debug/usb/devices |grep Alloc
B: Alloc=480/900 us (60%), #Int= 1, #Iso= 1
to:
B: Alloc=360/900 us (45%), #Int= 1, #Iso= 1
so that it will let me try 2 cameras at once (if that is even the right
way to go about it).

Any pointers would be helpful as I am flying blind here. e.g.
Does "480 us" mean 480 microseconds?
Does "3020 B/frame" mean 3020 bytes per frame?
Is a "frame" a frame of video or a frame of packet data?
Post by u***@viop.ca
As many webcams as possible running on 1 host controller, running at
USB bandwith allocation (60%) seems too high for each C920 webcam
limit allows only 1 Webcam per USB controller.
=======
snip<
=======
1. Is there a bug in the way the USB bandwidth allocation is fixed at
60% for most resolutions?
2. Is 60% really required for 1920x1080 H.264?
3. With regard to the uvcvideo FAQ[1], is this where these issues can
/* Isochronous endpoint, select the alternate setting. */
bandwidth = stream->ctrl.dwMaxPayloadTransferSize;
4. Is this something that could/should be addressed in a
webcam-model-specific way, or generally.
5. BONUS question: What is a realistic maximum number of (IP
broadcast
and what is the limiting factor?
[1] uvcvideo FAQ: "I get a "No space left on device" (-28) error when
trying to stream from more than one camera simultaneously."
http://www.ideasonboard.org/uvc/faq/
=======
u***@viop.ca
2014-02-10 05:33:01 UTC
Permalink
Today, we tried to analyze whether the C920 is being allotted too much
USB bandwidth (60%) when running at full specification (1920x1080 30fps)
with native h.264 compression.

Again, the reason for thinking this is possible is:

Surely if the network bandwidth of the video stream is only 3.3Mb/s,
then you would think the USB 2.0 controller at 480Mb/s should be able to
handle several of them.

So, after playing with wireshark while streaming 1920x1080, 30fps,
h.264, we have learned that:
-250 packets per second leave the host for the C920.
--All of these packets seem to be 576 bytes long.
-250 packets per second leave the C920 for the host.
--Most of those packets are 576 bytes long, except for:
--1 packet in about 8 is a large packet with a maximum size of 62016
bytes.

I read here[1] that the USB bandwidth allotment must be able to handle
the bursts of data from the webcam. So, if we consider that every
packet coming from the C920 contained the maximum observed packet size
of 62016 bytes, and they were sent at a rate of 250/second, then the
required bandwidth allocation would be 15.5MB/s (or 124Mb/s). Even with
this figure at 26% of the 480Mb/s maximum, you would think that it
should still be possible to have 3 cameras streaming simultaneously on
the same controller at 78% Alloc (which is 2% under the 80% maximum
limitation).

With this information, we believe a single USB host controller will
support 2 (possibly more) C920 cameras streaming video at their full
specification (1920x1080 30fps) with h.264 compression.

We still need help to understand what needs to be changed in the source
code to accomplish the goal of lowering the USB bandwidth allocation
from 60% down to (theoretically) 26%. Any pointers or suggestions are
appreciated.

[1] http://www.ideasonboard.org/uvc/faq/#faq7
Post by u***@viop.ca
I am more aware now that this type of problem has been asked about many
times before, forgive me if the solution is out there, but I didn't see
it anywhere.
Anyhow, I have downloaded the linuxtv media-build source and played with
it for a couple of evenings now. As lost as I am, I've managed to force
uvcvideo: Device requested 3020 B/frame bandwidth
uvcvideo: Device requested 2265 B/frame bandwidth
and various other numbers, but the automatic nature of the functions in
uvcvideo.c rolls through all of the alternate settings (resolutions) and
then gives up without finding a suitable one. (The first alternate, 0, I
think is the highest resolution, and is also what I think should be
selected.)
$cat /sys/kernel/debug/usb/devices |grep Alloc
B: Alloc=480/900 us (60%), #Int= 1, #Iso= 1
B: Alloc=360/900 us (45%), #Int= 1, #Iso= 1
so that it will let me try 2 cameras at once (if that is even the right
way to go about it).
Any pointers would be helpful as I am flying blind here. e.g.
Does "480 us" mean 480 microseconds?
Does "3020 B/frame" mean 3020 bytes per frame?
Is a "frame" a frame of video or a frame of packet data?
Post by u***@viop.ca
As many webcams as possible running on 1 host controller, running at
USB bandwith allocation (60%) seems too high for each C920 webcam
limit allows only 1 Webcam per USB controller.
=======
snip<
=======
1. Is there a bug in the way the USB bandwidth allocation is fixed at
60% for most resolutions?
2. Is 60% really required for 1920x1080 H.264?
3. With regard to the uvcvideo FAQ[1], is this where these issues can
/* Isochronous endpoint, select the alternate setting. */
bandwidth = stream->ctrl.dwMaxPayloadTransferSize;
4. Is this something that could/should be addressed in a
webcam-model-specific way, or generally.
5. BONUS question: What is a realistic maximum number of (IP broadcast
and what is the limiting factor?
[1] uvcvideo FAQ: "I get a "No space left on device" (-28) error when
trying to stream from more than one camera simultaneously."
http://www.ideasonboard.org/uvc/faq/
=======
-----------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
//pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Linux-uvc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linux-uvc-devel
u***@viop.ca
2014-02-10 09:08:52 UTC
Permalink
A quick update since I found some information here[1] about changing the
URB buffers in usbcore worked in a similar situation (user wanting to
operate 10 webcams on a single USB host controller). Sorry if this was
the wrong mailing list for my issue. Anyhow, I'm off to investigate
usbcore, I guess.

[1]
Post by u***@viop.ca
Today, we tried to analyze whether the C920 is being allotted too much
USB bandwidth (60%) when running at full specification (1920x1080 30fps)
with native h.264 compression.
Surely if the network bandwidth of the video stream is only 3.3Mb/s,
then you would think the USB 2.0 controller at 480Mb/s should be able to
handle several of them.
So, after playing with wireshark while streaming 1920x1080, 30fps,
-250 packets per second leave the host for the C920.
--All of these packets seem to be 576 bytes long.
-250 packets per second leave the C920 for the host.
--1 packet in about 8 is a large packet with a maximum size of 62016
bytes.
I read here[1] that the USB bandwidth allotment must be able to handle
the bursts of data from the webcam. So, if we consider that every
packet coming from the C920 contained the maximum observed packet size
of 62016 bytes, and they were sent at a rate of 250/second, then the
required bandwidth allocation would be 15.5MB/s (or 124Mb/s). Even with
this figure at 26% of the 480Mb/s maximum, you would think that it
should still be possible to have 3 cameras streaming simultaneously on
the same controller at 78% Alloc (which is 2% under the 80% maximum
limitation).
With this information, we believe a single USB host controller will
support 2 (possibly more) C920 cameras streaming video at their full
specification (1920x1080 30fps) with h.264 compression.
We still need help to understand what needs to be changed in the source
code to accomplish the goal of lowering the USB bandwidth allocation
from 60% down to (theoretically) 26%. Any pointers or suggestions are
appreciated.
[1] http://www.ideasonboard.org/uvc/faq/#faq7
Post by u***@viop.ca
I am more aware now that this type of problem has been asked about many
times before, forgive me if the solution is out there, but I didn't see
it anywhere.
Anyhow, I have downloaded the linuxtv media-build source and played with
it for a couple of evenings now. As lost as I am, I've managed to force
uvcvideo: Device requested 3020 B/frame bandwidth
uvcvideo: Device requested 2265 B/frame bandwidth
and various other numbers, but the automatic nature of the functions in
uvcvideo.c rolls through all of the alternate settings (resolutions) and
then gives up without finding a suitable one. (The first alternate, 0, I
think is the highest resolution, and is also what I think should be
selected.)
$cat /sys/kernel/debug/usb/devices |grep Alloc
B: Alloc=480/900 us (60%), #Int= 1, #Iso= 1
B: Alloc=360/900 us (45%), #Int= 1, #Iso= 1
so that it will let me try 2 cameras at once (if that is even the right
way to go about it).
Any pointers would be helpful as I am flying blind here. e.g.
Does "480 us" mean 480 microseconds?
Does "3020 B/frame" mean 3020 bytes per frame?
Is a "frame" a frame of video or a frame of packet data?
Post by u***@viop.ca
As many webcams as possible running on 1 host controller, running at
USB bandwith allocation (60%) seems too high for each C920 webcam
This
limit allows only 1 Webcam per USB controller.
=======
snip<
=======
1. Is there a bug in the way the USB bandwidth allocation is fixed at
60% for most resolutions?
2. Is 60% really required for 1920x1080 H.264?
3. With regard to the uvcvideo FAQ[1], is this where these issues can
/* Isochronous endpoint, select the alternate setting. */
bandwidth = stream->ctrl.dwMaxPayloadTransferSize;
4. Is this something that could/should be addressed in a
webcam-model-specific way, or generally.
5. BONUS question: What is a realistic maximum number of (IP broadcast
and what is the limiting factor?
[1] uvcvideo FAQ: "I get a "No space left on device" (-28) error when
trying to stream from more than one camera simultaneously."
http://www.ideasonboard.org/uvc/faq/
=======
----------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
/pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Linux-uvc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linux-uvc-devel
-----------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
//pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Linux-uvc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linux-uvc-devel
u***@viop.ca
2014-02-19 11:22:40 UTC
Permalink
I'm happy to report (partial) success! It is possible to:
-use old Pentium computer with USB2.0 port,
-plug in powered USB hub,
-add 4 Logitech C920 cameras to the hub,
-stream all 4 cameras simultaneously over the network,
-using 1920x1080 H.264,
-with at least 15fps (at first try - hoping to achieve 30fps),
-and USB bandwidth Allocation only at 15% (meaning: potential for 8 or
16 cameras per USB2.0 controller!).

I have tried so many things over the past 2 weeks and learned a little
about USB and C and compiling and also gstreamer and v4l2.
I can't say it was time well spent, barking up so many wrong trees, but
I am glad to have succeeded.

It did turn out that the fix was in uvcvideo, and this seems to be the
only hack that is required:
in uvc_video.c
(/your-kernel-source-code-dir/drivers/media/usb/uvc/uvc_video.c):
/* Comment out this line, which for me was line number 1499.
urb->interval = ep->desc.bInterval;
* and add this line with a value of 16, but a value of 2, 4, or 8 is
more conservative */
urb->interval = 16;

*Making this modification may restrict your use of higher-bandwidth
modes (MJPEG / Uncompressed), plus it will affect the operation any
other connected uvcvideo devices. If anyone reading this can provide an
if-statemnt which makes the above hack only apply to the Logitech C920,
it would be greatly appreciated.

Some additional information for anyone else attempting this:
I ran out of virtual memory while streaming 4 cameras at once, so this
guide helped me increase my virtual memory:
http://www.mythtv.org/wiki/Common_Problem:_vmalloc_too_small

These are the commands I used on the server to stream over the network:
cvlc -vvv v4l2:///dev/video1:chroma=h264:width=1920:height=1080

ard{access=udp,mux=ts,dst=192.168.1.255:8080,name=stream,mime=video/ts}"
cvlc -vvv v4l2:///dev/video2:chroma=h264:width=1920:height=1080

ard{access=udp,mux=ts,dst=192.168.1.255:8081,name=stream,mime=video/ts}"
cvlc -vvv v4l2:///dev/video3:chroma=h264:width=1920:height=1080

ard{access=udp,mux=ts,dst=192.168.1.255:8082,name=stream,mime=video/ts}"
cvlc -vvv v4l2:///dev/video4:chroma=h264:width=1920:height=1080

ard{access=udp,mux=ts,dst=192.168.1.255:8083,name=stream,mime=video/ts}"

And these to watch the streams on the client:
vlc udp://@:8080
vlc udp://@:8081
vlc udp://@:8082
vlc udp://@:8083

Something else to note is that it is possible to change the bitrate of
the H.264 stream and many other interesting settings using
gstreamer1.2's uvch264src "bad" plugin (freshly compiled from git repo,
and with much trial and error and a lot of help from these websites (not
just these specific pages):

index.php/gstreamer/487-using-the-logitech-c920-webcam-with-gstreamer-12
http://wiki.matthiasbock.net/index.php/Logitech_C920,_streaming_H.264

Similarly, there was some work done to make these settings available to
v4l2, but I did have not attempted to try it yet:
http://sourceforge.net/projects/libv4l2-hw/

Don't forget that you can disassemble these cameras and turn the lens a
bit which allows them to focus further away (to the horizon).

Now I have my sights on the Logitech C930e for a wider 90 degree field
of view, set for longer distance focusing, and possibly a higher
resolution image sensor for digital pan and zoom while keeping 1920x1080
resolution.
Post by u***@viop.ca
A quick update since I found some information here[1] about changing the
URB buffers in usbcore worked in a similar situation (user wanting to
operate 10 webcams on a single USB host controller). Sorry if this was
the wrong mailing list for my issue. Anyhow, I'm off to investigate
usbcore, I guess.
[1]
Post by u***@viop.ca
Today, we tried to analyze whether the C920 is being allotted too much
USB bandwidth (60%) when running at full specification (1920x1080 30fps)
with native h.264 compression.
Surely if the network bandwidth of the video stream is only 3.3Mb/s,
then you would think the USB 2.0 controller at 480Mb/s should be able to
handle several of them.
So, after playing with wireshark while streaming 1920x1080, 30fps,
-250 packets per second leave the host for the C920.
--All of these packets seem to be 576 bytes long.
-250 packets per second leave the C920 for the host.
--1 packet in about 8 is a large packet with a maximum size of 62016
bytes.
I read here[1] that the USB bandwidth allotment must be able to handle
the bursts of data from the webcam. So, if we consider that every
packet coming from the C920 contained the maximum observed packet size
of 62016 bytes, and they were sent at a rate of 250/second, then the
required bandwidth allocation would be 15.5MB/s (or 124Mb/s). Even with
this figure at 26% of the 480Mb/s maximum, you would think that it
should still be possible to have 3 cameras streaming simultaneously on
the same controller at 78% Alloc (which is 2% under the 80% maximum
limitation).
With this information, we believe a single USB host controller will
support 2 (possibly more) C920 cameras streaming video at their full
specification (1920x1080 30fps) with h.264 compression.
We still need help to understand what needs to be changed in the source
code to accomplish the goal of lowering the USB bandwidth allocation
from 60% down to (theoretically) 26%. Any pointers or suggestions are
appreciated.
[1] http://www.ideasonboard.org/uvc/faq/#faq7
Post by u***@viop.ca
I am more aware now that this type of problem has been asked about many
times before, forgive me if the solution is out there, but I didn't see
it anywhere.
Anyhow, I have downloaded the linuxtv media-build source and played with
it for a couple of evenings now. As lost as I am, I've managed to force
uvcvideo: Device requested 3020 B/frame bandwidth
uvcvideo: Device requested 2265 B/frame bandwidth
and various other numbers, but the automatic nature of the functions in
uvcvideo.c rolls through all of the alternate settings (resolutions) and
then gives up without finding a suitable one. (The first alternate,
0,
I
think is the highest resolution, and is also what I think should be
selected.)
$cat /sys/kernel/debug/usb/devices |grep Alloc
B: Alloc=480/900 us (60%), #Int= 1, #Iso= 1
B: Alloc=360/900 us (45%), #Int= 1, #Iso= 1
so that it will let me try 2 cameras at once (if that is even the right
way to go about it).
Any pointers would be helpful as I am flying blind here. e.g.
Does "480 us" mean 480 microseconds?
Does "3020 B/frame" mean 3020 bytes per frame?
Is a "frame" a frame of video or a frame of packet data?
Post by u***@viop.ca
As many webcams as possible running on 1 host controller, running at
USB bandwith allocation (60%) seems too high for each C920 webcam
This
limit allows only 1 Webcam per USB controller.
=======
snip<
=======
1. Is there a bug in the way the USB bandwidth allocation is fixed at
60% for most resolutions?
2. Is 60% really required for 1920x1080 H.264?
3. With regard to the uvcvideo FAQ[1], is this where these issues can
/* Isochronous endpoint, select the alternate setting. */
bandwidth = stream->ctrl.dwMaxPayloadTransferSize;
4. Is this something that could/should be addressed in a
webcam-model-specific way, or generally.
5. BONUS question: What is a realistic maximum number of (IP broadcast
Digimatrix),
and what is the limiting factor?
[1] uvcvideo FAQ: "I get a "No space left on device" (-28) error when
trying to stream from more than one camera simultaneously."
http://www.ideasonboard.org/uvc/faq/
=======
Oleksij Rempel
2014-02-19 11:29:29 UTC
Permalink
Post by u***@viop.ca
-use old Pentium computer with USB2.0 port,
-plug in powered USB hub,
-add 4 Logitech C920 cameras to the hub,
-stream all 4 cameras simultaneously over the network,
-using 1920x1080 H.264,
-with at least 15fps (at first try - hoping to achieve 30fps),
-and USB bandwidth Allocation only at 15% (meaning: potential for 8 or
16 cameras per USB2.0 controller!).
I have tried so many things over the past 2 weeks and learned a little
about USB and C and compiling and also gstreamer and v4l2.
I can't say it was time well spent, barking up so many wrong trees, but
I am glad to have succeeded.
It did turn out that the fix was in uvcvideo, and this seems to be the
in uvc_video.c
/* Comment out this line, which for me was line number 1499.
urb->interval = ep->desc.bInterval;
* and add this line with a value of 16, but a value of 2, 4, or 8 is
more conservative */
urb->interval = 16;
*Making this modification may restrict your use of higher-bandwidth
modes (MJPEG / Uncompressed), plus it will affect the operation any
other connected uvcvideo devices. If anyone reading this can provide an
if-statemnt which makes the above hack only apply to the Logitech C920,
it would be greatly appreciated.
For some time i did similar work for JPEG stream. The problem, different
cams use different compression. And compression will be minimal in some
situations. For example: capturing printed Text or continues motion will
produce high bandwidth which will produce codec artefacts and frame
drops. This is why there is no good limit for compressed stream.

It means. If you make some security cameras servialence system: make one
cam playing crazy, will kill other cams too.
Post by u***@viop.ca
I ran out of virtual memory while streaming 4 cameras at once, so this
http://www.mythtv.org/wiki/Common_Problem:_vmalloc_too_small
cvlc -vvv v4l2:///dev/video1:chroma=h264:width=1920:height=1080
ard{access=udp,mux=ts,dst=192.168.1.255:8080,name=stream,mime=video/ts}"
cvlc -vvv v4l2:///dev/video2:chroma=h264:width=1920:height=1080
ard{access=udp,mux=ts,dst=192.168.1.255:8081,name=stream,mime=video/ts}"
cvlc -vvv v4l2:///dev/video3:chroma=h264:width=1920:height=1080
ard{access=udp,mux=ts,dst=192.168.1.255:8082,name=stream,mime=video/ts}"
cvlc -vvv v4l2:///dev/video4:chroma=h264:width=1920:height=1080
ard{access=udp,mux=ts,dst=192.168.1.255:8083,name=stream,mime=video/ts}"
Something else to note is that it is possible to change the bitrate of
the H.264 stream and many other interesting settings using
gstreamer1.2's uvch264src "bad" plugin (freshly compiled from git repo,
and with much trial and error and a lot of help from these websites (not
index.php/gstreamer/487-using-the-logitech-c920-webcam-with-gstreamer-12
http://wiki.matthiasbock.net/index.php/Logitech_C920,_streaming_H.264
Similarly, there was some work done to make these settings available to
http://sourceforge.net/projects/libv4l2-hw/
Don't forget that you can disassemble these cameras and turn the lens a
bit which allows them to focus further away (to the horizon).
Now I have my sights on the Logitech C930e for a wider 90 degree field
of view, set for longer distance focusing, and possibly a higher
resolution image sensor for digital pan and zoom while keeping 1920x1080
resolution.
Post by u***@viop.ca
A quick update since I found some information here[1] about changing the
URB buffers in usbcore worked in a similar situation (user wanting to
operate 10 webcams on a single USB host controller). Sorry if this was
the wrong mailing list for my issue. Anyhow, I'm off to investigate
usbcore, I guess.
[1]
Post by u***@viop.ca
Today, we tried to analyze whether the C920 is being allotted too much
USB bandwidth (60%) when running at full specification (1920x1080 30fps)
with native h.264 compression.
Surely if the network bandwidth of the video stream is only 3.3Mb/s,
then you would think the USB 2.0 controller at 480Mb/s should be able to
handle several of them.
So, after playing with wireshark while streaming 1920x1080, 30fps,
-250 packets per second leave the host for the C920.
--All of these packets seem to be 576 bytes long.
-250 packets per second leave the C920 for the host.
--1 packet in about 8 is a large packet with a maximum size of 62016
bytes.
I read here[1] that the USB bandwidth allotment must be able to handle
the bursts of data from the webcam. So, if we consider that every
packet coming from the C920 contained the maximum observed packet size
of 62016 bytes, and they were sent at a rate of 250/second, then the
required bandwidth allocation would be 15.5MB/s (or 124Mb/s). Even with
this figure at 26% of the 480Mb/s maximum, you would think that it
should still be possible to have 3 cameras streaming simultaneously on
the same controller at 78% Alloc (which is 2% under the 80% maximum
limitation).
With this information, we believe a single USB host controller will
support 2 (possibly more) C920 cameras streaming video at their full
specification (1920x1080 30fps) with h.264 compression.
We still need help to understand what needs to be changed in the source
code to accomplish the goal of lowering the USB bandwidth allocation
from 60% down to (theoretically) 26%. Any pointers or suggestions are
appreciated.
[1] http://www.ideasonboard.org/uvc/faq/#faq7
Post by u***@viop.ca
I am more aware now that this type of problem has been asked about many
times before, forgive me if the solution is out there, but I didn't see
it anywhere.
Anyhow, I have downloaded the linuxtv media-build source and played with
it for a couple of evenings now. As lost as I am, I've managed to force
uvcvideo: Device requested 3020 B/frame bandwidth
uvcvideo: Device requested 2265 B/frame bandwidth
and various other numbers, but the automatic nature of the functions in
uvcvideo.c rolls through all of the alternate settings (resolutions) and
then gives up without finding a suitable one. (The first alternate,
0,
I
think is the highest resolution, and is also what I think should be
selected.)
$cat /sys/kernel/debug/usb/devices |grep Alloc
B: Alloc=480/900 us (60%), #Int= 1, #Iso= 1
B: Alloc=360/900 us (45%), #Int= 1, #Iso= 1
so that it will let me try 2 cameras at once (if that is even the right
way to go about it).
Any pointers would be helpful as I am flying blind here. e.g.
Does "480 us" mean 480 microseconds?
Does "3020 B/frame" mean 3020 bytes per frame?
Is a "frame" a frame of video or a frame of packet data?
Post by u***@viop.ca
As many webcams as possible running on 1 host controller, running at
USB bandwith allocation (60%) seems too high for each C920 webcam
This
limit allows only 1 Webcam per USB controller.
=======
snip<
=======
1. Is there a bug in the way the USB bandwidth allocation is fixed at
60% for most resolutions?
2. Is 60% really required for 1920x1080 H.264?
3. With regard to the uvcvideo FAQ[1], is this where these issues can
/* Isochronous endpoint, select the alternate setting. */
bandwidth = stream->ctrl.dwMaxPayloadTransferSize;
4. Is this something that could/should be addressed in a
webcam-model-specific way, or generally.
5. BONUS question: What is a realistic maximum number of (IP broadcast
Digimatrix),
and what is the limiting factor?
[1] uvcvideo FAQ: "I get a "No space left on device" (-28) error when
trying to stream from more than one camera simultaneously."
http://www.ideasonboard.org/uvc/faq/
=======
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Linux-uvc-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linux-uvc-devel
--
Regards,
Oleksij
Loading...