Multiple webcams on ZoneMinder
Monitoring a 3D Printer
One of the ideas I've been thinking about for some time is remote monitoring of the printing process. Many prints can take several hours to complete and I don't have enough confidence to leave it alone for that long. Jumping up and down to check it every few
minutes would quickly get annoying, so I wanted a way to control and monitor it from a web interface.
My plan is to use a few webcams to provide pictures of the bed, print, and overall mechanics, and an emergency stop button. Looking around, the best solution for webcam streaming on Linux (Ubuntu) is ZoneMinder -
it can cope with streaming multiple webcams. I used apt-get to install it and there are some extra configuration required in the documentation.
I can also point a couple of cameras out the window as a home-made CCTV/security solution.
After a bit of fiddling, I was able to get streaming webcam from my PS3 eye webcam: but the other three webcams refused to stream. This was a little odd, since I could happily get pictures using cheese, kamino, xawtv, and they all seemed to connect properly
as /dev/video devices and appeared as v4l2 (VideoForLinux) devices. All drivers seemed OK and installed.
xawtv -c /dev/video0 -v 1 can provide useful information, such as the supported colour palettes.
Checking the zoneminder logs ( appearing in /tmp):
tail -f /tmp/zmdc.log 24/06/11 22:14:03.046389 zmdc[2171].INF [Starting pending process, zmc -d /dev/video3]
24/06/11 22:14:03.047635 zmdc[2171].INF ['zmc -d /dev/video0' starting at 11/06/24 22:14:03, pid = 2869]
24/06/11 22:14:06.224901 zmdc[2171].ERR ['zmc -d /dev/video0' exited abnormally, exit status 11]
And I was also getting messages in
dmesg
[ 1929.678445] gspca: bandwidth not wide enough - trying again
[ 2529.745525] ohci_hcd 0000:00:0b.0: leak ed ffff880036a43730 (#85) state 2
Checking the USB devices looked OK:
davidr@hgwells:~$ lsusb
Bus 002 Device 008: ID 046d:c049 Logitech, Inc. G5 Laser Mouse
Bus 002 Device 007: ID 056a:0013 Wacom Co., Ltd Graphire 3 4x5
Bus 002 Device 006: ID 05f3:0007 PI Engineering, Inc. Kinesis Advantage PRO MPC/USB Keyboard
Bus 002 Device 005: ID 0ac8:307b Z-Star Microelectronics Corp. USB 1.1 Webcam
Bus 002 Device 004: ID 05f3:0081 PI Engineering, Inc. Kinesis Integrated Hub
Bus 002 Device 003: ID 093a:2600 Pixart Imaging, Inc. Typhoon Easycam USB 330K (newer)/Typhoon Easycam USB 2.0 VGA 1.3M/Sansun SN-508
Bus 002 Device 002: ID 041e:4053 Creative Technology, Ltd Live! Cam Video IM
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 006: ID 05ac:1293 Apple, Inc. iPod Touch 2.Gen
Bus 001 Device 002: ID 1415:2000 Nam Tai E&E Products Ltd. or OmniVision Technologies, Inc. Sony Playstation Eye
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
davidr@hgwells:~$
but checking the USB tree shows that the 3 problem devices are only connecting in USB 1.1 (12M), and the one working device at USB 2.0 (480M).
davidr@hgwells:~$ lsusb -t
1-5:3.0: No such file or directory
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci_hcd/8p, 12M
|__ Port 2: Dev 2, If 0, Class=vend., Driver=zc3xx, 12M
|__ Port 4: Dev 4, If 0, Class=hub, Driver=hub/4p, 12M
|__ Port 2: Dev 6, If 0, Class=HID, Driver=usbhid, 12M
|__ Port 2: Dev 6, If 1, Class=HID, Driver=usbhid, 12M
|__ Port 3: Dev 7, If 0, Class=HID, Driver=wacom, 1.5M
|__ Port 4: Dev 8, If 0, Class=HID, Driver=usbhid, 12M
|__ Port 4: Dev 8, If 1, Class=HID, Driver=usbhid, 12M
|__ Port 6: Dev 5, If 0, Class=vend., Driver=zc3xx, 12M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/8p, 480M
|__ Port 1: Dev 2, If 0, Class=vend., Driver=ov534, 480M
|__ Port 1: Dev 2, If 1, Class=audio, Driver=snd-usb-audio, 480M
|__ Port 1: Dev 2, If 2, Class=audio, Driver=snd-usb-audio, 480M
|__ Port 5: Dev 6, If 0, Class=still, Driver=, 480M
|__ Port 5: Dev 6, If 1, Class=vend., Driver=usbfs, 480M
Damn. It looks like I forgot the rule about mixing usb 1 and 2 devices -Plugging usb 1 and 2 forces everything
on that hub to run as USB 1 (UPDATE : false).
Mixing around the ports, I still had problems. As a better solution, I've ordered a PCI-E USB 3.0 card and usb3 hub. Each port should happily accept a 2.0 webcam, and should have plenty of bandwidth.
I usually use ebuyer.com, but in this case amazon.co.uk were a lot cheaper! (Usb3.0 card for £10 - hub for £20)
UPDATE:
It seems that the other cameras I had were, in fact, usb1.1 - (even though a couple were labelled as USB 2). A later experiment with four identical USB 2.0 cameras had similar results.
The main problem does seem to be the USB bandwidth. Apparently cameras 'reserve' USB bandwidth (sometimes more than they use) and the usb 2.0 480Mb limit quickly gets used up. I'll post again after testing with USB3.0 (5Gb)
I was incorrect in my earlier post. Modern motherboards usually have two usb controllers: a USB 2.0 controller and a 'legacy' USB 1.1 controller. Devices
on each port are automatically switched to the right controller, so the problem of one usb 1 device slowing down the whole usb system does not occur.
I suspect something similar is implemented on most usb hubs - my USB 2.0 hub seems to cope fine with a mix of 1.1 and 2.0 devices.
Due to the wording of the USB 2.0 spec, some USB 1.1 webcams are labelled as USB 2.0 - despite the fact that they only connect at 12Mb (usb1.1). This
is the case for two of my older webcams - a Targus and a Creative Live! cam both only connect at 1.1 speeds.
USB 3.0
Although Linux does have support for usb3 cards there is a bug in the current Ubuntu 'Natty Narwhal' kernel that means that USB 3.0 hubs may only be
recognised as USB 2.0 hubs - you can see them using
lusub -t
connecting at 480M (usb 2.0).
This post suggested
that a later version of the kernel would recognise the usb 3.0 hub properly.
I re-installed with the latest alpha version 11.10 (Oneiric Ocelot) which includes a later kernel. It now recognises the hub as 5000M.
Webcam USB Bandwidth
Some research on webcam USB bandwidth turned up a useful trick. Webcams request a whole load of bandwidth, usually more than they need.
Symptoms were fairly easy to spot: Opening one camera with
xawtv -v 1 -c /dev/video0
and at the same time opening /dev/video1 in another terminal led to
libv4l2: error turning on stream: No space left on device
VIDIOC_STREAMON - Unable to start capture: No space left on device
fps is set to 1/30
libv4l2: error turning on stream: Device or resource busy
VIDIOC_STREAMON - Unable to start capture: Device or resource busy
This post and this
post gave me some useful pointers. The uvcvideo kernel module can be set to ignore the requested bandwidth, and to calculate the right bandwidth.
Try:
sudo rmmod uvcvideo
sudo modprobe uvcvideo quirks=128
This will be reset every reboot. If this works, create the following file:
sudo vi /etc/modprobe.d/uvcvideo.conf
containing the line:
options uvcvideo quirks=128
My Hardware setup
My new hardware - in case anyone wants to follow in my footsteps:
Transcend PCI Express Interface
USB 3.0 Dual Expansion Card
Tsunami SSU34 100mm USB
3.0 4 Ports Hub
Webcam with Microphone for
XP Vista PC Laptop MSN Skype
Output from lsusb :
davidr@hgwells:~$ lsusb -t
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
|__ Port 2: Dev 2, If 0, Class=hub, Driver=hub/4p, 5000M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
|__ Port 2: Dev 2, If 0, Class=hub, Driver=hub/4p, 480M
|__ Port 1: Dev 3, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M
|__ Port 1: Dev 3, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M
|__ Port 2: Dev 4, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M
|__ Port 2: Dev 4, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M
|__ Port 3: Dev 5, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M
|__ Port 3: Dev 5, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M
|__ Port 4: Dev 6, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M
|__ Port 4: Dev 6, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci_hcd/8p, 12M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/8p, 480M
|__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/4p, 480M
|__ Port 4: Dev 3, If 0, Class=hub, Driver=hub/4p, 12M
|__ Port 1: Dev 4, If 0, Class=HID, Driver=usbhid, 12M
|__ Port 1: Dev 4, If 1, Class=HID, Driver=usbhid, 12M
|__ Port 4: Dev 5, If 0, Class=hub, Driver=hub/4p, 12M
|__ Port 2: Dev 6, If 0, Class=HID, Driver=usbhid, 12M
|__ Port 2: Dev 6, If 1, Class=HID, Driver=usbhid, 12M
|__ Port 3: Dev 7, If 0, Class=HID, Driver=wacom, 1.5M
davidr@hgwells:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 003 Device 002: ID 2109:3431
Bus 004 Device 002: ID 2109:0810
Bus 001 Device 003: ID 05e3:0604 Genesys Logic, Inc. USB 1.1 Hub
Bus 003 Device 003: ID 090c:937b Feiya Technology Corp. Silicon Motion Camera
Bus 003 Device 004: ID 090c:937b Feiya Technology Corp. Silicon Motion Camera
Bus 003 Device 005: ID 090c:937b Feiya Technology Corp. Silicon Motion Camera
Bus 003 Device 006: ID 090c:937b Feiya Technology Corp. Silicon Motion Camera
Bus 001 Device 004: ID 046d:c049 Logitech, Inc. G5 Laser Mouse
Bus 001 Device 005: ID 05f3:0081 PI Engineering, Inc. Kinesis Integrated Hub
Bus 001 Device 006: ID 05f3:0007 PI Engineering, Inc. Kinesis Advantage PRO MPC/USB Keyboard
Bus 001 Device 007: ID 056a:0013 Wacom Co., Ltd Graphire 3 4x5
Multiple webcams on ZoneMinder的更多相关文章
- yolov3源码darknet在vscode下调试
1. 安装配置: https://pjreddie.com/darknet/yolo/ darknet文件夹下make命令搞定: 2. 配置vscode 打开安装好的vscode并安装扩展C/C++( ...
- GPU端到端目标检测YOLOV3全过程(下)
GPU端到端目标检测YOLOV3全过程(下) Ubuntu18.04系统下最新版GPU环境配置 安装显卡驱动 安装Cuda 10.0 安装cuDNN 1.安装显卡驱动 (1)这里采用的是PPA源的安装 ...
- Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ...
Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ... 这个错误是因为有两个相 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- [LeetCode] Read N Characters Given Read4 II - Call multiple times 用Read4来读取N个字符之二 - 多次调用
The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actu ...
- SharePoint "System.Data.SqlClient.SqlException (0x80131904): Parameter '@someColumn' was supplied multiple times.“
最近在处理SharePoint Office365的相关开发的时候发现了这样一个奇怪的现象: 无法通过API更新Editor field,只要已更新就会throw Exception,由于是Offic ...
- 2012Chhengdu K - Yet Another Multiple Problem
K - Yet Another Multiple Problem Time Limit:20000MS Memory Limit:65536KB 64bit IO Format:%I6 ...
- JAVA实现AES 解密报错Input length must be multiple of 16 when decrypting with padded cipher
加密代码 /**解密 * @param content 待解密内容 * @param password 解密密钥 * @return */ public static byte[] decrypt(b ...
- scala - multiple overloaded alternatives of method bar define default arguments
同名同位置默认参数不能overload def bar(i:Int,s:String="a"){} def bar(i:String,s:String="b") ...
随机推荐
- (十)jQuery对表单、表格的操作
一.表单应用 1.HTML中的表单大致由三部分组成 (1).表单标签:包含处理表单数据所用的服务端程序URL,以及数据提交到服务器的方法. (2).表单域:包含文本框.密码框.隐藏域.多行文本框.复选 ...
- [原创] 浅谈开源项目Android-Universal-Image-Loader(Part 3.1)
最近,总算有时间去做些平时喜欢而没空去做的事情.一直觉得项目中使用的Image Loader适用性不强,昨晚在github随便逛逛,发现一个开源项目Android-Universal-Image-Lo ...
- vim 模式查找
1. / 正向查找, ?反向查找 2. \v 激活very magic搜索模式,撰写正则表达式更接近于perl的正则表达式,大多数字符不需要进行转义 3. \V 激活noVeryMagic模式,按字符 ...
- 微服务之旅:从Netflix OSS到 Istio Service Mesh
在这篇文章中,我们从Netflix开始,通过Envoy和Istio的崛起,快速浏览微服务的历史. 微服务是具有边界上下文的松散耦合服务,使您能够独立开发,部署和扩展服务.它还可以定义为构建独立开发和部 ...
- iOS开发人员程序许可协议
请细致阅读以下的许可协议条款和条件之前下载或使用苹果软件. 这些条款和条件构成你和苹果之间的法律协议. iOS开发人员程序许可协议 目的 你想使用苹果软件(例如以下定义)来开发一个或多个应 ...
- 导入MySQL测试数据库employee报错
导入MySQL测试数据库employee 报错 下载地址:https://launchpad.net/test-db/ 上传解压: [root@001 ~]# tar xf employees_db- ...
- Github的基本功能:
作者:Fadeoc Khaos链接:http://www.zhihu.com/question/20070065/answer/30521531来源:知乎著作权归作者所有,转载请联系作者获得授权. G ...
- TOML简介 (转)
TOML的由来 配置文件的使用由来已久,从.ini.XML.JSON.YAML再到TOML,语言的表达能力越来越强,同时书写便捷性也在不断提升. TOML是前GitHub CEO, Tom Prest ...
- 转载 ---资深HR告诉你:我如何筛选简历与选择人员的
资深HR告诉你:我如何筛选简历与选择人员的 有个公司HR看简历 先直接丢掉一半 理由是不要运气不好的应聘者. 当然这可能只是某些HR面对太多的简历产生了偷懒的情绪,但是不论是Manager,亦或是 ...
- 【题解】数字组合(NTT+组合 滑稽)
[题解]数字组合(NTT+组合 滑稽) 今天实践一下谢总讲的宰牛刀233,滑稽. \((1+x)(1+x)(1+x)\)的\(x^2\)系数就代表了有三个一快钱硬币构成的两块钱的方案数量. 很好理解, ...