More than 2 usb webcams in motion?
Question
Hi There and thanks for motion - I love it:)
I'm desperately trying to get more than two usb cameras to work in motion at 640x480 resolution. I've tried several different configurations, using add-on pci usb 2.0 expansion cards and using the built-in usb controllers.
Below is the error message i get when I connect 4 logitech webcam pro 9000 cameras; I will get that same error message regardless if I'm running the cameras on one, two or three usb busses (one built-in , two pci addon cards). I've seen previous posts about the same scenario occurring when there's not enough usb bandwidth available, but I don't think that's the case here since all four cams will work flawlessly using one usb bus in guvcview, running at 30 frames per second simultaneously. The cams will work if I lower the resolution; eg. given:
2 cams using a resolution of 640x480 and
V4L2 _PIX_FMT_YUYV: - WORKS.
4 cams using a resolution of 352x288 and
V4L2 _PIX_FMT_YUYV: - WORKS.
3 or 4 cams using a resolution of 640x480 and
V4L2 _PIX_FMT_YUYV: - DOES NOT WORK.
3 or 4 cams using a resolution of 640x480 and
V4L2 _PIX_FMT_YUV420 :
-WORKS, but gives error message about corrupted jpegs upon startup. Output jpegs show partially corrupted images.
Does anyobody have a clue why these cams do not work int 640x480 in motion when they all work without a problem in guvcview?
Thanks!
-Christian.
[2] Using V4L2
[2] Resizing pre_capture buffer to 1 items
[3] cap.driver: "uvcvideo"
[3] cap.card: "UVC Camera (046d:0809)"
[3] cap.bus_info: "usb-0000:03:06.2-1.1"
[3] cap.capabilities=0x04000001
[3] - VIDEO_CAPTURE
[3] - STREAMING
[3] Supported palettes:
[3] 0: YUYV (YUV 4:2:2 (YUYV))
[3] Selected palette YUYV
[3] index_format 6 Test palette YUYV (640x480)
[3] Using palette YUYV (640x480) bytesperlines 1280 sizeimage 614400 colorspace 00000008
[3] found control 0x00980900, "Brightness", range 0,255
[3] "Brightness", default 128, current 128
[3] found control 0x00980901, "Contrast", range 0,255
[3] "Contrast", default 32, current 32
[3] found control 0x00980902, "Saturation", range 0,255
[3] "Saturation", default 28, current 28
[3] found control 0x00980913, "Gain", range 0,255
[3] "Gain", default 0, current 0
[3] mmap information:
[3] frames=4
[3] 0 length=614400
[3] 1 length=614400
[3] 2 length=614400
[3] 3 length=614400
[3] Error starting stream VIDIOC_STREAMON: No space left on device
[3] ioctl(VIDIOCGMBUF) - Error device does not support memory map
[3] V4L capturing using read is deprecated!
[3] Motion only supports mmap.
[3] Could not fetch initial image from camera
[3] Motion continues using width and height from config file(s)
[3] Resizing pre_capture buffer to 1 items
[4] Failed to open video device /dev/video3: No such file or directory
[4] Could not fetch initial image from camera
[4] Motion continues using width and height from config file(s)
[4] Resizing pre_capture buffer to 1 items
[3] Started stream webcam server in port 8083
[4] Started stream webcam server in port 8084
[1] Started stream webcam server in port 8081
[2] Started stream webcam server in port 8082
[3] Retrying until successful connection with camera
[3] cap.driver: "uvcvideo"
[3] cap.card: "UVC Camera (046d:0809)"
[3] cap.bus_info: "usb-0000:03:06.2-1.1"
[3] cap.capabilities=0x04000001
[3] - VIDEO_CAPTURE
[3] - STREAMING
[3] Error selecting input 0 VIDIOC_S_INPUT: Device or resource busy
[3] ioctl(VIDIOCGMBUF) - Error device does not support memory map
[3] V4L capturing using read is deprecated!
[3] Motion only supports mmap.
[4] Retrying until successful connection with camera
Environment
Motion version: |
3.2.11.1 |
ffmpeg version: |
0.5_p20373 |
Libraries: |
ffmpeg, mysql, postgresql |
Server OS: |
Gentoo |
--
ChristianKuzmanic - 19 Dec 2009
Follow Up
Does guvcview keep all 4 webcams open at same time or it's only open/closing to capture still images !?
If the issue is USB bandwitdh you can try to reduce frames to be mmaped , change in video2.c :
#define MMAP_BUFFERS 4
by
#define MMAP_BUFFERS 2
--
AngelCarpintero - 21 Dec 2009
Answer
It keeps all 4 of them open at the same time, and each instance shows a video stream of 640x480 @30fps. I really don't think usb bandwidth is an issue, but I will try that fix you suggested anyway.
Thanks for taking the time to look into this problem, I really appreciate it.