I think the simplest way is to add a streaming service that captures your usb camera and then streams the video via a http server. It is rather simple
-
Assuming you run this on a raspberry pi, install mjpg-streamer software
https://github.com/jacksonliam/mjpg-streamer -
for each usb camera, start a mjpg-streamer, setting it with different ports and devices
As example, using this command
pi@Motion5:~/mjpg-streamer/mjpg-streamer-experimental $ sudo ./mjpg_streamer -o "output_http.so -w ./www -p 8888" -i "input_uvc.so -d /dev/video0"
For camera on device /dev/video0 will stream the camera video on port 8888
MJPG Streamer Version: git rev: 501f6362c5afddcfb41055f97ae484252c85c912
i: Using V4L2 device.: /dev/video0
i: Desired Resolution: 640 x 480
i: Frames Per Second.: -1
i: Format............: JPEG
i: TV-Norm...........: DEFAULT
The url for this is in my case: http://192.168.0.234:8888/?action=stream
If I insert this url into the example above, I get the video nicely presented in the dashboard. So changing a line into this
document.getElementById('c54').src = "http://192.168.0.234:8888/?action=stream";
Remember to start one instance of mjpg-streamer for each camera and use different ports and devices
Finally, it is very convenient to let node-red start the mjpg-streamers, just using one exec node for each instance