motioneye-project / motioneye

A web frontend for the motion daemon.
GNU General Public License v3.0
3.93k stars 652 forks source link

Raspberry Pi3 and 4x Logitech USB cameras #327

Open AndriusGitHub opened 7 years ago

AndriusGitHub commented 7 years ago

image Hello I have Raspberry Pi3, my settings: 1280x960 30fps, streaming also 30 fps 100% quality only working only 2 USB Logitech cameras. Connecting another two and not working any. Checked with powered USB hub. The same. :(

chrisf4lc0n commented 7 years ago
  1. The RasPi may not provide sufficient power to feed all the cameras... What charger do you use? I would recommend minimum 2A or greater.
  2. The RasPi might be running out of steam with so many cameras, what is the CPU usage?
Mo-O commented 7 years ago

Hello,

i am in the same situation. i ll use 4 Logitech b910 webcams with an Transcend 4 port USB3.0-Hub. The charger of the Hub has 12V/2A and get from the pi (5V/0,9A ?). I ll use the Raspberry Pi 3 with a charger who deliver 2,5A.

Current settings:

i have noticed the following:

Any ideas how to get 4 cams with 1280x720 on one raspberry Pi 3 working?

Btw. i would like to thank you for sharing the program motioneye with us. It is a really nice project. I appreciate it.

chrisf4lc0n commented 7 years ago

Hmm, interesting data... I take it, that you are getting 40% CPU utilisation with 1 cam at 1280x720 and the rest in 320x240? It has just struck me... What is your RAM/GPU Mem share? Try to bump it to 512MB or even 768MB and see what happens?

chrisf4lc0n commented 7 years ago

I was trying to run 640x480 times 2 on my Raspi 1 and MotioEye was crashing... One is fine even up to 800x600 with some other processes running in the background, but 2x640x480 was no go.

slokhorst commented 7 years ago

I think you're saturating the USB bus. The Raspberry Pi only has a single 480Mbit/s = 60MB/s (theoretical, in practice even less) USB 2.0 bus (with a built-in 4 port hub behind that). 4 HD cams will likely require more than that. (in YUYV mode a single 1280x960@30 cam would require 70MB/s, not sure about MJPEG, but it would likely be too much as well)

ccrisan commented 7 years ago

I never thought of it that way. Indeed, @slokhorst is probably right: PI's USB is definitely killed by those cameras.

slokhorst commented 7 years ago

By the way, this might work if the webcam is set to capture in compressed H.264 mode, but motion doesn't support that yet. (motion#86)

Mo-O commented 7 years ago

I've installed motioneyeOS on a Odroid XU4. It has two USB 3.0. If i connect one Cam on each USB 3.0 port than i get a picture on only one cam. Same situtation if i use the hub. The dmesg .log says: not enough bandwidth for new device state... Not enough bandwidth for altsetting 11

If i use one cam on USB 3.0 and the other cam on USB 2.0 than the cams are working fine in any resolution and frame settings

Mo-O commented 7 years ago

Normally USB 3.0 ports should be fast enough for two cams. With very low settings. Right?

slokhorst commented 7 years ago

@Mo-O yes, that should work just fine.

It might be that one cam is hogging all the bandwidth, even if it doesn't actually need it. You might want to try aguinet/usbtop if you are an experienced Linux user and want to further diagnose the problem. (I don't have experience with this tool, but it seems to be one of the few programs that can check what bandwith USB devices are using.)