Video stills capture


#1

Hi. I'm looking for help on composite video capture, capturing stills. I am thinking of using the USB Webcam node node-red-contrib-usbcamera with a USB capture stick ?? Will this work ??


#2

If you've got the USB capture device then just try it out and see what happens

If not - what model device are you looking at - what computers/OS do you plan on using it on?


#3

Hi.
Havent bought anything yet. I have a Raspberry Pi 3 running the standard Raspian. I am confident in the Windows world but USB hardware & Pi is new to me.
Thanks.


#4

Using USB capture on Pi can be problematic - I tried to use a cheap one a few years ago with no success - things might have changed but I'd suspect not as composite video capture is old tech nowadays


#5

OK. I havent tried yet, but I might buy a cheap one and test. I need composite capture as the Pi lives in the roof and the camera will be out the front :slight_smile:


#6

Plan B is to use a pi-zero outside with onboard camera, but I have other plans for it so would rather not.


#7

Use a Pi and a software named Motion. Then order a camera like this from Ali and you get a nice video capturing solution
https://www.aliexpress.com/item/2Megapixel-1920-1080-CMOS-OV2710-usb-Video-Surveillance-camera-24pcs-IR-LED-night-vision-bullet-Outdoor/32771791898.html?spm=a2g0s.9042311.0.0.77d64c4dONZsPB10


#8

I think the OP already has a camera with composite video output


#9

Yes, but the step up in image quality will be well worth it.

I used some of those USB composite video capture devices with Zoneminder software years ago. They worked well initially and appeared to be a good solution, but they had a very high failure rate as their inputs didn't seem able to handle the transients that occur on long wire runs during thunderstorms, etc. The same cameras plugged into a PCI capture card lasted many years until I retired them for a new HD system.

This got me thinking, so I dusted off my last remaining working USB capture dongle and plugged it into my Pi3 B+ running the latest Raspbian and /dev/video1 appeared, I have a USB webcam plugged in as well whcih is /dev/video0. Mine is Kworld brand. Unfortunately I do not have a SD camera convenient to hook up to see if it really captures.

My suggestion, if you already have the dongle, try it and see, if it works be happy, maybe yours will survive better than mine have. But if you need to buy one, forget about it and get the USB camera krambriw has linked.


#10

If you want a remote camera consider using an IP camera. If you use POE to supply power then you only need to take an ethernet cable to the camera, and this can be 100 metres long if necessary.


#11

Normally an ip camera with the same data (we are talking outdoor, night vision etc right) is more expensive than an usb variant. Since you need some intelligent video analytic sw, it makes sense to use Motion or similar. With a RPi3 you have built in wifi that easily manages video stream if you want. Storing snapshots could also be done locally on an external usb stick or a mapped network drive.
If you need more than two usb cameras connected to the same RPi, ip cameras may be a better choice due to bandwidth limitations in the usb controller. But for cost reasons it still might be better to buy more RPi's and distribute cameras to them


#14

I would like to do over IP, but I cannot find a IP camera Node in NodeRed, only the USB or local camera nodes. Are you aware of an IP camera node, with an input for trigger.


#15

Hi Chris,

Don't think you need some IP camera node. You can control any IP camera with the httprequest node, by sending normal http requests to it. Or if you want to decode the camera's MJPEG video stream, you can use my node-red-contrib-multipart-stream-decoder node. Or if you buy an Onvif-compatible camera, you might use in the future my new node-red-contrib-onvif node. But the latter node is not finished or published yet!!!!

Kind regards,
Bart Butenaers


#16

You can grab a still from any Onvif camera or any one that has a "snapshot" URL with like three lines of python code:
`
import requests
from PIL import Image
from io import BytesIO

r = requests.get(camera_url)
i = Image.open(BytesIO(r.content))
i.save(jpegFilename")

`

IP cameras are no longer significantly more expensive that USB cameras, especially if you need outdoor usage ~$25:

I look forward to your onvif nodes. I've been playing with node-onvif in nodejs but once I discovered that two of the three onvif cameras I have access to had snapshot URLs, the python route integrates better with my AI which is in python.

Basically you open the snapshot URL in a brower and get a jpeg snapshot, refresh the window and get a new snapshot. Perfect for round-robin sampling of a set of IP camera to feed images to my AI.


#17

Bart, that ONVIF node will be neat to use ! Possible out of my comfort zone there, but I like the direction. When do you hope to have that ready !


#18

Hi Chris,
the Onvif nodes can only be used for cameras with the "onvif" label! Lots of IP cameras have that label, but not all of them. And not all onvif ip cameras offer 'all' the onvif functionality, so it might be wise to do some research before ordering an IP camera.

After I have finished my node-red-contrib-blockly, I will continue again with onvif. But cannot say when my first version will be ready for use. Depends on many factors like 'wife', 'children', 'other hobbies', and so on ... That is one of the disadvantages of using open source software :slight_smile: But my version at home aleady supports lots more stuff as the version on github! And don't think you need to be Einstein to use it, since I did meanwhile some changes to make it easier to use.

@wb666greene The first version of my onvif nodes were also based on node-onvif, since that repository is actively maintained. However seems event streams are not supported (see my issue), and I really need that e.g. to get motion-detection or PIR-sensor events from my IP camera. So I rewrote my nodes (read: lots of work!) to use the onvif npm module instead. However I discovered some bugs (see my issue), but since two months nobody has responded to it :sob: Don't know at the moment what would be the best way to proceed with my nodes ...

If anybody has some good advise, please be my guest ...
Bart


#19

I'd be happy to alpha test your onvif nodes, I've access to several cameras with varying degrees of Onvif compatibility. I'm still learning about Onvif features and quirks.

Be real careful with straight from China Onvif cameras they claim they are Onvif when they won't even talk to the Windows Onvif Device Manager software, which itself is pretty lame, but at least gets you started. Seems if it streams with rtsp in VLC they consider it Onvif compatible :frowning:

I've been down the PIR and video motion detection road for many years, my advice is to forget about it now, and run an AI "person detector" instead (MobileNetSSD is working great for me on stills from D1 to 960P).

See my flow and Python code for it in the "share your projects" forum. This one is software only so a Pi3B only does about one frame every two seconds but it is amazingly effective because the false alarm rate is far lower that what I was ever able to achieve with video motion detection and PIR unless the cameras were located indoors where I totally controled the lighting.

An ~$80 Movidius Neural Compute Stick USB "tensor processor" lets the Pi3 do about 5 or 6 frames per second. I shared a "toy" system that is pretty easy to get started with, my real system has been running about 10 weeks scanning 9 cameras with overlapping outdoor fields of view and I can honestly say that after tweaking a few camera angles (people walking by, not on my property were sometimes being detected) I've had no false alarms.

During the development and testing I learned you do have to avoid a few things that can "look like a person" specifically, my wife left some hand washed clothes over a chair on the pool deck and with certain lighting conditions it would detect as a "person" -- did kind of look like someone sitting in a chair at first glance :slight_smile:


#20

@wb666greene: I had already my doubts about chinese onvif compliancy, so thanks for confiming it. Could it be useful to ask the Aliexpress seller which onvif profiles the cam supports?

Will certainly have a look at your AI stuff in the near future. Thanks for sharing! Wasn't aware that python was fast enough for such things. Thought you needed c++ (like opencv)?

Is your real system with 9 cameras also running on rpi 3 ?
Bart


#21

Yes it runs on a Pi3 B+ in these usages python is basically just a wrapper around the C/C++ libraries, I'm not a huge fan of python primarily for its significant white space "feature" but it is great for rapid prototyping. Its been quite some time since the python code wasn't fast enough to actually use and that I had to re-write the system in C/C++. The key is the Movidius NCS device.

The main difficulty with the stand-alone softweare only system is getting openCV 3.3 or better installed on the PI. I don't know of any binaries that are complete enough to install and use, compiling on the Pi3 B+ takes about five hours, I had to avoid the -j4 option in make and just use a single process to prevent it failing about half way through for being out of memory. I've tried cross-compiling a couple of times and either can't get the highgui to work on the Pi when installed or the build fails with errors I can't make any sense of.

The Movidius sdk "api only" install downloads and enough of the opencv libs for the python bindings to work, so its relatively painless install process.

My 9-camera system is a subset of the 15 cameras from my FLIR/Lorex DVR. I use node-red-contrib-ftp-server to get snapshots from the system. Its ugly but it works very well. The Lorex system is lame, its great for 24/7 recording and little else, its scrubbing is so bad you've little chance of finding an event unless you know the time at which it occurred, my AI snapshots give me this and a highly reliable "push" notification so its a major enhancement.

Basically my goal is to never look at the video unless something happens, which knock on wood, never has. I'm looking at Onvif cameras to replace the Lorex cameras for the AI to reduce the latency which because of the way the Lorex system works is typically 4-5 seconds. But none of this is going to happen until fall when the weather cools off.


#22

Interesting discussion for sure, just joining in

I agree that installing openCV is something you would rather avoid. Since I needed a couple of RPi3's running the same stuff, I decided to make an image with openCV and other "personal defaults" configured. Then just burn a new sd, boot it up and re-configure the ip for the network. But once an update is needed, o boy, well that will be the day

When I looked into using openCV in general for video streaming, I noticed that the cpu load was much, much higher than when doing the same simple task with Motion. When it comes to object analyze & detection, openCV with the various dnn models are great, they are pretty accurate. I think the key is not to send openCV too many pictures for analyze. I stop analyzing once the object "person" is detected and then notifies me with a picture of that detection (but I continue to record images pre-and post event allowing me to make an investigation at any time later)

I believe (and hope) that a RPi3 would be able to handle more IP-cameras than USB connected ones. I would like to have devices or similar like the ones below. But it will require more cabling, at least in my house. So maybe next house.

https://reolink.com/product/rlc-410/