Setting up multiple webcams in OctoPi the right way

this.........

edited my post to be clearer, but like @Charlie_Powell said, you need to remove that part.

(For @jneilliii and @Charlie_Powell):

Okay, got that out of there. I guess it was late night with tired eyes, since I had read that line over a few times and did see I had the right path for it, but never saw I still had that in it!

On the Multicam setup page, when I look at the setup for the 1st webcam, it looks like it's using a relative URL, since it's just /webcam/?action=stream (well, I can't see it all, but I can see enough that's what I figure that is the value). For the 2nd webcam, I had to put the full URL in as http://erebor:8081/?action=stream to get it to work. Should it work with just ":8081/?action=stream" in that text field?

(From just looking at it, it seems that first field should be the URL relative to http://<your-ip>, which, in my case, is http://erebor. Then the 2nd should be the URL using local http://127.0.0.1 as the address, with the port and option after that.)

Am I missing something or should the value for the 2nd cam be the full URL?

Also, totally extra question - how many cams can Multicam support?

No, you can't use a port number as a relative URL. If you need to use port 8081, then it must be the full URL, including the IP address.

If you would like the 2nd webcam to also have a relative URL, then you just have to read the guide - it's right there, in the 'Haproxy configuration' setup.

I think in theory the 'Multicam' plugin supports as many cameras as you would like, as does the server-side streaming that this guide deals with. However, in practice, you will have limits on the available processing power & bandwidth to handle many webcams, but I can't say at what point those are hit as it depends on many things like resolution and frame rate.

Okay. It's not a problem. I just wanted to make sure I wasn't making some mistake that would cause issues later on.

I didn't see anything on the Multicam home page, so I was wondering, since there's the '+' button to add more and there doesn't seem to be a limit, but yes, I can see the limits on resources as being a problem. I have seen posts in some places indicating that some power supplies even had problems providing power for as few as 2 cameras.

At this point I have two printers. I didn't expect to, but it happened. My printers are in the workshop in the barn, a 500' walk from my house. I do most of my design work in the study - much easier to work at the computer there than in the workshop. So being able to use OctoPrint to send files down to the printers and start printing (and to monitor them) without having to make an extra trip down is a big help!

Thanks for the help!

Read the OPTIONAL: Haproxy configuration section in the guide.

Went through it. That's now on my list. (After getting Home Assistant working again and adding control of my 2nd printer to OctoPrint.)

Is everyone that is getting this / the multiple webcam setup just plugging directly into your Pi, or using a powered hub? Just tried setting this up with c920 and USB endoscope directly to pi 3b+ and doesn't se to work. Sometimes the c920 blacks out the bottom half of the image. I'm assuming too much power draw.

Did you ever figure this out? Having similar issues

Yes, I did. What was here helped me get things up and working.

Sorry for not returning to provide an update later. I made the change that I overlooked (removing <device long id> ) and it worked. Then I used the haproxy info and that helped me with making an easier to use URL for each one.

My plan, originally, was to add a 2nd camera and 2nd printer, since I've heard about people doing it, but now I see they're doing it with methods like using containers and putting 2 Octoprint instances on one system. I don't know if a Pi4 can handle controlling 2 printers at once, so I'm going to do more research on that before I do it. (I had seen concerns about if a Pi power supply could handle 2 cameras, but I don't seem to be having any trouble with it.)

I'm using the Pi cam and a USB cam, with no hub, and it's working. That's on a Pi 4. I don't know if there are enough differences between the 3 and 4, in the power supply and usage areas, to make it possible on the 4 and make the 3 not powerful enough.

I stumbled across some random thread in my troubleshoot/searching and all it took was me dropping the resolution from 1920x1080 on my main webcam (octopi.txt) to 1280x720 and restarting webcamd and it worked. I guess there's too much bandwidth/resources needed to drive a 1080 + 720 camera without using a powered hub.

The formatting is very broken in your post as it is rendered by Discourse. If you would like to post code, then you should use 3 backticks to create code blocks.

```
Like this
```

Which will render

Like this

Anyway, from what I can gather part of your post is about duplicating the webcamd files and suggesting editing the lines where right above it says:

DO NOT EDIT, USE /boot/octopi.conf.d/*.txt INSTEAD!

Which is what this guide is explaining how to do. There is no need to manually duplicate and edit the service files to get multiple webcams up and running.

@g.j.b_kosterink

As @Charlie_Powell already mentioned in his post:

Please format your code snippets with

grafik

Else it's quite a mess and also letters get lost...

So you are suggesting to edit the bits that say DO NOT EDIT on them? For what reason?

I have tried everything and can't seem to get this working. I have a raspi and a USB Camera connected.

webcamd.service - the OctoPi webcam daemon with the user specified config
Loaded: loaded (/etc/systemd/system/webcamd.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-11-18 13:42:29 EST; 7min ago
Process: 498 ExecStart=/root/bin/webcamd (code=exited, status=0/SUCCESS)
Tasks: 15 (limit: 3596)
CGroup: /system.slice/webcamd.service
β”œβ”€539 ./mjpg_streamer -o output_http.so -w ./www-octopi -n -p 8081 -i input_uvc.so -r 1280x720 -f 30 -d /dev/video0
└─561 ./mjpg_streamer -o output_http.so -w ./www-octopi -n --listen 127.0.0.1 -i input_raspicam.so -fps 10

Nov 18 13:41:44 octopi mjpg_streamer[561]: MJPG-streamer [561]: camera parameters..............:
Nov 18 13:41:44 octopi mjpg_streamer[561]: MJPG-streamer [561]: www-folder-path......: ./www-octopi/
Nov 18 13:41:44 octopi mjpg_streamer[561]: MJPG-streamer [561]: HTTP TCP port........: 8080
Nov 18 13:41:44 octopi mjpg_streamer[561]: MJPG-streamer [561]: HTTP Listen Address..: 127.0.0.1
Nov 18 13:41:44 octopi mjpg_streamer[561]: MJPG-streamer [561]: username:password....: disabled
Nov 18 13:41:44 octopi mjpg_streamer[561]: MJPG-streamer [561]: commands.............: disabled
Nov 18 13:41:44 octopi mjpg_streamer[561]: MJPG-streamer [561]: starting input plugin input_raspicam.so
Nov 18 13:41:44 octopi mjpg_streamer[561]: MJPG-streamer [561]: starting output plugin: output_http.so (ID: 00)
Nov 18 13:41:44 octopi mjpg_streamer[561]: MJPG-streamer [561]: Starting Camera
Nov 18 13:42:29 octopi systemd[1]: Started the OctoPi webcam daemon with the user specified config.

When I make the Haproxy configuration changes I can see the USB Camera as webcam1 with "/webcam2/?action=stream" in the Multicam Profiles screen but not in Octoprint when I select it.

can you please tell me where I am going wrong?

I'm pretty stumped. I'm stuck at finding the ID of my USB camera, it tells me that there is no such directory as v41, despite being listed when I use the ls command from within the /dev directory. I'm new to linux and powershell, but v41 is a different color than most of the other items in the /dev folder, do I need to create the directory myself? Has an update moved it elsewhere?

Thanks in advance for any help someone can offer

It's a lowercase L in the command, l not a one 1. Stands for Video4Linux. In the monospace font they are easily mixed up

Yeah I realized that 30 seconds after posting. I wasted an hour on that L goddamnit haha

Guide works great for two C270 cameras with different IP adresses. But I got a third C270 cameras, that has the same serial number as one of the two, which creates exactly the same usb... file names. When I attach only one of those with same serial, everything works. If I attach both of them I only get one set of usb-046d_C270_HD_WEBCAM_200901010001-video-index0 index files. I can see one camera, but no set of usb files is generated for the other camera with same serial number.

It seems Octoprint can not deal with that automatically. Is there any way to get those usb-files created with something added to distinguish them?

->> Found a solution using by-path. Never mind.

I have followed this guide and watched a few videos on youtube. This is only helpful if you plan on using a Pi Camera or/and one USB camera. In my case with Pi and two usb cams not completly helpful. Had to figure out a different route which worked on my end.