Regarding the comment about Spaghetti Detective, where it says "any changes you make using this guide will not take effect." ... I'm not sure what you're trying to say. Changes made here won't work because Spaghetti Detective is installed? Or maybe changes made here won't show in Spaghetti Detective? Or maybe something else?
Nice guide. Easy to follow and clear (except for the noted point about Spaghetti Detective - but I think I'm OK here). I am trying to set up an Insta360 One R, which will act as a webcam and is recognized nicely in Windoze and the like. But I cannot seem to get it to work in this environment. It does show up under /dev/v4l/by-id as usb-Amba_Insta360_One_R-video-index* but does not show up under lsusb (well, maybe it does, but not in any recognizable way). When I try to test the stream, I get no image. I also don't seem to have a webcamd log file in /var/log. Is there some guide that might help me work through the process of adding some as-yet-little-known camera, and what the issue(s) might be?
It's also possible, I suppose, that that comment about Spaghetti Detective does apply to me - in which case I'd like to hear suggestions about what to do. Is it just a matter of installing some plugin?
The Spaghetti Detective Premium streaming takes over the webcam streaming, so it can provide a compressed h264 (I think) stream to use WebRTC in their apps/website, which is more data-efficient for streaming to the cloud. This means that any changes you make to the OctoPi webcam streaming config do not have any effect on the camera stream, since it's provided by TSD instead. Disabling premium streaming in TSD (& rebooting) should get the OctoPi-provided camera stream back up & running.
I am brand new to 3d printing and Octoprint. I ran into to some minor things that I had to figure out and streamline. Part of it is my lack of knowledge with linux. I wrote a guide to supplement this one as i ran into some minor issues and just wanted to highlight a couple of things.
Octopi Multi Camera Setup
Login to the Raspberry Pi
Creating the configuration files
Change Directory
cd /boot
Make New Directory
sudo mkdir octopi.conf.d
Locating device long id
Run ls /dev/v4l/by-id
v4l is an lower case L
Should have an output that appears like this for each device
usb-046d_1080P_Pro_Stream_6E3591AF-video-index0 usb-046d_HD_Pro_Webcam_C920_829EB2AF-video-index1
usb-046d_1080P_Pro_Stream_6E3591AF-video-index1 usb-046d_HD_Pro_Webcam_C920_BA7DB2AF-video-index0
usb-046d_HD_Pro_Webcam_C920_829EB2AF-video-index0 usb-046d_HD_Pro_Webcam_C920_BA7DB2AF-video-index1
We will use the the ones that end in index0. Devices ending in index0 are preffered, as that is usually
the device with video streaming.
Editing camera configuration file for multiple cameras
Camera 1
Change directory
cd /boot
Open file to edit
sudo nano -l /boot/octopi.text
the -l will privide line numbers in the document
Locate line 16 remove the #(hashtag)
Change camera="auto" to camera="usb"
Locate line 24 remove the #(hashtag)
Modify camera_usb_options
original is camera_usb_options="-r 640x480 -f 10"
new line is original is camera_usb_options="-r 640x480 -f 10 -d /dev/v4l/by-id/"
Example: camera_usb_options="-r 640x480 -f 10 -d /dev/v4l/by-id/usb-046d_1080P_Pro_Stream_6E3591AF-video-index0"
Camera 2
Copy original configuration file to new directory
sudo cp octopi.txt octopi.conf.d/webcam2.txt
Change directory
cd /boot/octopi.conf.d/
Open file to edit
sudo nano -l /boot/octopi.conf.d/webcam2.txt
Locate line 16 confirm #(hashtag) has been removed if not remove the #(hashtag)
Change camera="auto" to camera="usb"
Locate line 24 confirm #(hashtag) has been removed if not remove the #(hashtag)
Modify camera_usb_options using the device long name of the second device
original is camera_usb_options="-r 640x480 -f 10"
new line is original is camera_usb_options="-r 640x480 -f 10 -d /dev/v4l/by-id/"
Example: camera_usb_options="-r 640x480 -f 10 -d /dev/v4l/by-id/usb-046d_1080P_Pro_Stream_6E3591AF-video-index0"
5 Modify the port the second camera uses
Locate line 76 remove the #(hashtag)
Locate line 77
Modify camera_http_options"-n" to camera_http_options="-n -p 8081"
**If adding additonal camers follow steps for Camera 2
Testing Cameras
Restart webcamd service
sudo service webcamd restart
Open webbrowser and test camera by using the below
http://:8081/?action=stream
If successful you can use the stream and snapshot URLs in OctoPrint
Stream: http://:8081/?action=stream
Snapshot: http://:8081/?action=snapshot
From inside of OctoPrint
Click the wrench icon
Left tab click "Plugin Manager"
Click "+Get More"
Inside seawrch type MultiCam
Select MultiCam plugin click Install
After installation Octoprint will require a reboot
Navigate back to OctoPrint settings page
From left column scroll down select the option that says "MultiCam"
From Multicam Profiles page there will be the default camera
Click the blue plus sign
This will populate the second line, under the URL column provide this link http://:8081/?action=stream
substiting your IP of the octoprint
Thanks, I appreciate your attempt to try and add some more details to the guide, if there were parts that you found difficult.
However, I'm not a fan of copying out and rewriting the guide in a comment. If I change anything with the original guide, it makes this comment out of date which might confuse some people. They don't know what's extra details and what has changed in the guide.
I'm having issues getting both webcams to work. The webcam on port 8080 works but not the one on 8081. I have tried every type of URL for the second webcam but nothing seems to be working. I even completely re-imaged octoprint on my SD card and repeated the steps with no luck. Here's the log messages I get on startup:
Dec 27 03:08:30 octopi root: Starting USB webcam
Dec 27 03:08:30 octopi MJPG-streamer [504]: starting application
Dec 27 03:08:30 octopi MJPG-streamer [504]: MJPG Streamer Version: git rev: 5554f42c352ecfa7edaec6fc51e507afce605a34
Dec 27 03:08:30 octopi MJPG-streamer [504]: Using V4L2 device.: /dev/video0
Dec 27 03:08:30 octopi MJPG-streamer [504]: Desired Resolution: 640 x 480
Dec 27 03:08:30 octopi MJPG-streamer [504]: Frames Per Second.: -1
Dec 27 03:08:30 octopi MJPG-streamer [504]: Format............: JPEG
Dec 27 03:08:30 octopi MJPG-streamer [504]: TV-Norm...........: DEFAULT
Dec 27 03:08:30 octopi MJPG-streamer [504]: www-folder-path......: ./www-octopi/
Dec 27 03:08:30 octopi MJPG-streamer [504]: HTTP TCP port........: 8080
Dec 27 03:08:30 octopi MJPG-streamer [504]: HTTP Listen Address..: 127.0.0.1
Dec 27 03:08:30 octopi MJPG-streamer [504]: username:password....: disabled
Dec 27 03:08:30 octopi MJPG-streamer [504]: commands.............: disabled
Dec 27 03:08:30 octopi MJPG-streamer [504]: starting input plugin input_uvc.so
Dec 27 03:08:30 octopi MJPG-streamer [504]: starting output plugin: output_http.so (ID: 00)
Dec 27 03:08:30 octopi kernel: [ 10.776023] 8021q: adding VLAN 0 to HW filter on device eth0
Dec 27 03:08:31 octopi root: Starting USB webcam
Dec 27 03:08:31 octopi MJPG-streamer [545]: starting application
Dec 27 03:08:31 octopi MJPG-streamer [545]: MJPG Streamer Version: git rev: 5554f42c352ecfa7edaec6fc51e507afce605a34
Dec 27 03:08:31 octopi MJPG-streamer [545]: Using V4L2 device.: /dev/video1
Dec 27 03:08:31 octopi MJPG-streamer [545]: Desired Resolution: 640 x 480
Dec 27 03:08:31 octopi MJPG-streamer [545]: Frames Per Second.: -1
Dec 27 03:08:31 octopi MJPG-streamer [545]: Format............: JPEG
Dec 27 03:08:31 octopi MJPG-streamer [545]: TV-Norm...........: DEFAULT
Dec 27 03:08:31 octopi MJPG-streamer [545]: init_VideoIn failed
It is failing to get video from the camera - the error is there at the bottom init_VideoIn failed
The guide suggests using the /dev/v4l/by-id paths for the camera so you can make sure that you aren't using the same physical device each time. Maybe that part is worth following to make sure it's not trying to open the same camera twice?
The other thing to do would be to run v4l2-ctl --list-formats-ext to check the camera is actually a supported video device.
I followed all the steps including using /dev/v4l/by-id and taking each ID of the cameras from index0. Both cameras are Logitech c270's which are known to be supported for Octoprint.
Something in your configuration is not passing through to the streaming service then. You see in your log file, it is saying it's using /dev/video0 and /dev/video1. It might be easier for you to open your own thread so we can look at what you have specifically configured, as there are a lot of posts on this thread already.
Using a Pi NoIR v2 camera and this tip caused me problems. The Pi v2 cameras are ignoring settings while using auto and get detected as the usb device, this can be observed using a single camera on a fresh install with no plugins. Setting it to raspi got things working correctly while I was using one camera, everything except for the fps setting.
However after using this guide (Thanks btw) and having one set to raspi and the other set to auto OR usb, the usb camera fails to load and the pi camera loads ignoring the raspi settings in both files, meaning it is getting detected as a usb device again. After various troubleshooting the only solution I could get working was to set the device long id for the usb webcam, that fixed all issues and both cameras worked as expected.
This seems to be more of an issue with Octoprints automatic detection of the v2 camera boards, not sure if it is going to be resolved in the future. I recommend either removing this hint or adding a note about v2 camera boards. Cheers
The Pi cams can also be treated in the same way that a USB camera is, the drivers can make them look the same. I guess this causes an issue if the Pi camera is detected first...
Ok I do see the problem with this approach. It should work to find both the cameras with the /dev/v4l/by-id path to stop that problem from happening.
Currently, I have two USB webcams connected from following this guide. A cheap endoscope cam and a C922, they both work fine. However my C922 webcam is constantly adjusting its autofocus. How could I disable the autofocus of this webcam while having two webcams active? When trying the following command:
You can also try the 'Camera Settings' plugin, although (afaik) it will only show one camera in its UI, you can control any cameras connected to the Pi. Uses the same method of v4l2-ctl, but with a nice UI.
I have added some basic support for multiple cameras in the Camera Settings plugin. If you also install the MultiCam plugin and configure it, you should be able to enable the integration and 'link' the camera profiles at the bottom of the Camera Settings page, and doing that will allow it to show the appropriate preview for the selected camera.
Hi Charlie,
I have gotten the C920 working as the only camera but when I follow that guide to install a C270 I cannot get it to show in the:
"ls /dev/v4l/by-id" as shown below:
However if I "cd" to "octopi.conf.d " it shows "webcam2.txt Is this the correct location for that file??
When I edit the file " /boot/octopi.conf.d $ sudo nano /boot/octopi.conf.d/webcam2.txt" I have the following enabled:
camera="usb"
camera_usb_options="-r 640x480 -f 10 -d /del/v4l/by-id/"
camera_http_options="-n -p 8081"
I did not see any reference to the long id of the 270?? Where can I get this??