Jump to content

USB cameras with Nanopi m4 using motion package


username123

Recommended Posts

I am using 3 low light HD USB cameras (details on the link below) for my application. https://bluerobotics.com/store/sensors-sonars-cameras/cameras/cam-usb-low-light-r1/
The application requires me to have all 3 cameras live streaming simultaneously on 3 different local host ports of a PC. For the controller, I am using a Nanopi M4 (it is connected to my laptop by a 20m long, CAT-6 ethernet cable)
I am using the motion package to work the cameras

I have been facing the following issues-

1. When all 3 cameras are connected to controller and stream is checked, at any given time I am able to see the livestream of only 2 of the streams. On restarting motion, any one of the hosts shows a grey screen while the other two give me the proper stream. I have tested this multiple times and would appreciate if help on how to go about this issue

We also tried connecting the cameras to my laptop directly using threads in my motion package and all the 3 streams were visible to me simultaneously

2. A few of the times the port number (seen on dev in the form - video0) have changed while the cameras have been plugged in and left as it is. If anyone has come across this problem, please tell me how you went about this

3. Attached below is a screenshot of the Tcptrack app when all three cameras were connected at 100% stream quality (set in the motion.conf file)
tcptrack.JPG.c4c6cf817e4a3eecd37203f4f4c7f539.JPG
The first three rows represent each camera and the rates are unequal for all of them which is not expected. Can anyone help me with a possible explanation to this?
Also when that screenshot was taken, the camera streaming to localhost 8083, was showing up as a grey screen on my laptop, so what is the rate signifying?

Also, to make sure there were no problems with the Nanopi M4 USB ports sourcing the current drawn by the cameras, we gave an external 5V power supply to them – We could only see any 2 out of 3 streams


I have also attached a screenshot from my Nanopi M4 Top showing the CPU usage when all three cameras were connected to stream at 100% quality

top.JPG.1e45ff56d16e0a835dde6e148ac02687.JPG

4. As a last resort, if we are only able to work 2 cameras at a time, please advise if anyone has used switching between the three cameras to choose which ones stay on at any given time

Thanks for your time

 

 

Link to comment
Share on other sites

After reading this topic twice, I moved it to P2P as I suspect it will end up more likely being general software (Motion, etc.) related, rather than anything Armbian, much less hardware (RK3399) related. If I am wrong, we can move it back later...

 

@username123,

 

I also use Motion (although haven't touched it lately, as for me it "just works"), but I vaguely remember something about the first config being in one file, and then second and subsequent configs thereafter being chained each in their own files after that... Have you set up your config in this way?

Link to comment
Share on other sites

Perhaps too slow. On the M4 you can use all 3 cameras on USB 3.0, or use a USB 3.0 Hat for the M4.  If you use USB2.0, all three cameras combined are limited to the speed of a single USB2 connection.

 

The specs for that camera do not say how fast it is on USB2 or USB3. It is pretty costly. I have been experimenting with one of the FriendlyELEC cameras (MIPI/CSI not USB) and low light/IR is pretty interesting 

 

Edited by Comedicles
mispell
Link to comment
Share on other sites

The auto-gain control is making it hard to get solid measurements and I can't control "shutter time" or exposure . I may have to write my own driver. The photos were taken in a room with no lights but with a skylight that lets in a little street light. I can make some tests if you tell me what you want. The M4 has dual CSI inputs and I have a regular MCAM400 in one and an MCAM400 with the IR blocking filter removed in the other. MCAM400 is an OV4689 4M Pixel and lens combination.

Link to comment
Share on other sites

I just did a quick test with some usb 2.0 camera collecting dust here. It always fails with the third usb camera. Maybe with usb 3 would work.

 

Reason:

[22863.516749] usb 7-1.4: Not enough bandwidth for new device state.
[22863.516807] usb 7-1.4: Not enough bandwidth for altsetting 6

 

Update:

 

Attaching two usb 2.0 cameras to USB3 receptacles and the other one to USB2 did not work.

Edited by @lex
Attaching to USB3 receptacles
Link to comment
Share on other sites

We don't have a driver yet for using two CSI cameras at once. I have to alternate. But working on it for stereo vision / CV / Virtual for headsets, etc.

We will have to ask the engineers in Guangzhou about it and see if Armbian devs can focus on it.

 

Link to comment
Share on other sites

On 2/4/2020 at 2:03 AM, TRS-80 said:

After reading this topic twice, I moved it to P2P as I suspect it will end up more likely being general software (Motion, etc.) related, rather than anything Armbian, much less hardware (RK3399) related. If I am wrong, we can move it back later...

 

@username123,

 

I also use Motion (although haven't touched it lately, as for me it "just works"), but I vaguely remember something about the first config being in one file, and then second and subsequent configs thereafter being chained each in their own files after that... Have you set up your config in this way?

My motion folder has 1 motion.conf file with all the parameters set, that have to be shared by all the cameras and 3 individual files for each camera with camera specific information (includes camera id and the stream port)
Can you elaborate or show the codes regarding what you had implemented? I haven't completely understood

Link to comment
Share on other sites

29 minutes ago, username123 said:

Can you elaborate or show the codes regarding what you had implemented? I haven't completely understood

 

I think your setup sounds correct. Don't worry too much about my idiotic ramblings, it's been a while since I set it up and probably not remembering exactly correctly. :)

 

I am inclined to agree with others in the thread saying maybe that's all the bandwidth the hardware can handle.

Link to comment
Share on other sites

22 hours ago, Comedicles said:

see if Armbian devs can focus on it

why should we? csi camera on rockchip is in general a pain.. quality 'has room for improvements':

61965675-08130280-afd1-11e9-9561-83bcdcb

(that's ov5647 on the tinker - imx 219 is even worse see https://github.com/armbian/build/pull/1482).. and always after you do the initial lifting getting this things to work.. there's nobody catching it up, or let you know that they did and have improved stuff.. Then we end in having another board with 'camera support' but nobody uses it cause the output is crap. and nobody is willing to fix it. And as far as I know.. From all the armbian devs I'm currently the only one having a camera module for a rk3399 board (opi 4) and those two are not pincompatible to each other (and for the opi there's quite some other stuff on a todo list than camera)..

 

22 hours ago, Comedicles said:

We don't have a driver yet for using two CSI cameras at once.

didn't firefly even provide a image for dual camera on their board? so why should the same approach not work most other rk3399 boards? I don't think friendlyelec didn't mess much on the CSI ports to make things difficult here..

 

 

Link to comment
Share on other sites

I tried starting from the lowest resolution and increased it gradually. I am able to see the livestream of all the 3 cameras up to the width x height of 384 x 288. Attached below is the dmesg that I get at that resolution with all 3 working at 100% stream quality

image.thumb.png.78fe29ad88e8293f89cf54f7bc592eec.png
The bandwidth error is gone now
I tried to find more information about the ‘Failed to resubmit video URB (-19)’ error, but couldn’t find anything particularly useful. I would appreciate help on this

But there are a few other issues

1. Is there a way for me to increase the resolution and still have the three cameras working? The stream window is really small right now, and my application requires to monitor details regarding the surroundings on it, which is proving to be difficult right now. I mean to ask if there is any other way we can reduce the bandwidth used or is it fixed and only dependent on the cameras (hardware), assuming that is the only issue here?
564431151_384x288.thumb.JPG.6bedf4d7f201ddf965d4a94be3cb606f.JPG

The above is the 384 x 288 stream window. As you can see, it will get difficult to make out minuter objects in the stream

2. There are times when the cameras are plugged in and the nanopi m4 reboots, that the video device of the third camera changes from video18 to video19 whereas those of camera1 and camera2 remain what they were. Can anyone point out a way to avoid this because in my application, the end user at the workstation will be unable to troubleshoot and check for video device changing every time the streams stops.

Link to comment
Share on other sites

6 hours ago, username123 said:

‘Failed to resubmit video URB (-19)’

 

ENODEV 19 No such device

If you see the previous line of your dmesg output you see the message: USB device disconnected.

 

 

In theory, if you connect 2 USB cameras to USB3 and one to USB2 it should work as someone has proven to work in a PC box. I must have done something wrong with the wiring in my quick test.

 

Quote

 that the video device of the third camera changes from video18 to video19

 

I think your camera disconnected and reconnected for some reason and the handler was not free in time, so kernel asked for a new one.

 

Link to comment
Share on other sites

I purchased ODROID-XU4 specifically for the purpose of doing software motion detection (with Motion, even) because it had so much CPU grunt (and Gigabit Ethernet, etc.). But so far I never really taxed it. We are only doing one stream (but it is a 720p stream) and it looks nice. The XU4 seems also not to break a sweat.

 

I realize that "not break a sweat" is not as useful of a qualitative metric, however, so maybe I should find some time to try and connect some other devices (I do own 3) and also get some actual hard numbers to look at. And report them back here and perhaps at Motion forums / wiki as well...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines