I've setup 3 cameras using the new camera stack. Raspi Cam and 2 Logitech via USB 3.0.
Both are working - but not at the same time. What do I mean? After a restart of the system or reloading the camera stack (systemctl restart) one of them is working and the other only shows "server error" on the web. The camera-streamer endpoint is available.
What did you already try to solve it?
Removed the configs, added cameras again. Rebooted, tried different usb ports.
When accessing the web on url: http://192.168.1.129:8082 the endpoint from camera streamer can be open. When then accessing the /steam I only get "Server Error".
The installation is new, running on the current Octoprint (1.9.3) and OctoPi (1.0). The Hardware is a Raspberry Pi 4 with 2GB.
Conf Logitech B525HD
florian@octoprint:~ $ cat /boot/camera-streamer/usb-B525.conf
### Options for USB based cameras
# The port on which the webcam server for the camera should listen on.
PORT=8082
# The path to the camera device.
DEVICE=/dev/v4l/by-id/usb-046d_B525_HD_Webcam_61432820-video-index0
# The image format of the camera.
FORMAT=YUYV
# The resolution to set on the camera. Defaults to 1280x720.
WIDTH=1280
HEIGHT=720
# The framerate to set on the camera. Defaults to 15fps.
FRAMERATE=15
# Additional options.
OPTIONS="--http-listen=0.0.0.0"
Conf Logitech HD920
florian@octoprint:~ $ cat /boot/camera-streamer/usb-HD920.conf
### Options for USB based cameras
# The port on which the webcam server for the camera should listen on.
PORT=8081
# The path to the camera device.
DEVICE=/dev/v4l/by-id/usb-046d_HD_Pro_Webcam_C920_8D15191F-video-index0
# The image format of the camera.
FORMAT=YUYV
# The resolution to set on the camera. Defaults to 1280x720.
WIDTH=1920
HEIGHT=1080
# The framerate to set on the camera. Defaults to 15fps.
FRAMERATE=30
# Additional options.
OPTIONS="--http-listen=0.0.0.0"
general camera stuff
florian@octoprint:~ $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 2c99:0002 Prusa Original Prusa i3 MK3
Bus 001 Device 004: ID 046d:0836 Logitech, Inc. B525 HD Webcam
Bus 001 Device 003: ID 046d:0892 Logitech, Inc. OrbiCam
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
florian@octoprint:~ $ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
/dev/video10
/dev/video11
/dev/video12
/dev/video18
/dev/video31
/dev/media3
bcm2835-isp (platform:bcm2835-isp):
/dev/video13
/dev/video14
/dev/video15
/dev/video16
/dev/video20
/dev/video21
/dev/video22
/dev/video23
/dev/media1
/dev/media2
unicam (platform:fe801000.csi):
/dev/video4
/dev/video5
/dev/media4
rpivid (platform:rpivid):
/dev/video19
/dev/media0
HD Pro Webcam C920 (usb-0000:01:00.0-1.1):
/dev/video0
/dev/video1
/dev/media5
B525 HD Webcam (usb-0000:01:00.0-1.2):
/dev/video2
/dev/video3
/dev/media6
That will result in a list. Look for the entries which end in ".service".
Those are the service threads the main camera-streamer launcher service spawns off.
For instance if you named your second camera "hd920" you will have a service called "camera-streamer-usb@h920.service"
Once you know the name of the child service type this...
systemctl status camera-streamer-usb@h920.service
It should report back if the streaming service is actually running and the port it is using.
florian@octoprint:~ $ systemctl status camera-streamer-usb@HD920.service
â—Ź camera-streamer-usb@HD920.service - camera-streamer HD920
Loaded: loaded (/etc/systemd/system/camera-streamer-usb@.service; disabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/camera-streamer-usb@.service.d
└─override.conf
Active: active (running) since Wed 2024-02-14 11:00:41 CET; 22h ago
TriggeredBy: â—Ź camera-streamer-usb-HD920.path
Process: 2708 ExecCondition=/bin/sh -c [ -e $DEVICE ] (code=exited, status=0/SUCCESS)
Process: 2714 ExecCondition=/bin/sh -c ! ss -ltn src :$PORT | grep -q LISTEN (code=exited, status=0/SUCCESS)
Main PID: 2721 (camera-streamer)
Tasks: 11 (limit: 3135)
CPU: 2min 34.450s
CGroup: /system.slice/system-camera\x2dstreamer\x2dusb.slice/camera-streamer-usb@HD920.service
└─2721 /usr/bin/camera-streamer --http-port=8081 --camera-type=v4l2 --camera-path=/dev/v4l/by-id/usb-046d_HD_Pro_Webcam_C920_8D15191F-video-index0 --camera-format=YUYV --camera-width=1920 --camera-height=1080 --camera-fps=30 --camera-nb>
Feb 15 08:32:25 octoprint sh[2721]: device/buffer_queue.c: SNAPSHOT:output:mplane: The dma_buf (CAMERA:capture:buf1) is too long: 4147200 vs space=4055040
Feb 15 08:32:25 octoprint sh[2721]: device/buffer_queue.c: SNAPSHOT:output:mplane: The dma_buf (CAMERA:capture:buf0) is too long: 4147200 vs space=4055040
Feb 15 08:32:25 octoprint sh[2721]: device/buffer_queue.c: SNAPSHOT:output:mplane: The dma_buf (CAMERA:capture:buf1) is too long: 4147200 vs space=4055040
Feb 15 08:32:26 octoprint sh[2721]: device/buffer_queue.c: SNAPSHOT:output:mplane: The dma_buf (CAMERA:capture:buf0) is too long: 4147200 vs space=4055040
Feb 15 08:32:26 octoprint sh[2721]: device/buffer_queue.c: SNAPSHOT:output:mplane: The dma_buf (CAMERA:capture:buf1) is too long: 4147200 vs space=4055040
Feb 15 08:32:26 octoprint sh[2721]: device/buffer_queue.c: SNAPSHOT:output:mplane: The dma_buf (CAMERA:capture:buf0) is too long: 4147200 vs space=4055040
Feb 15 08:32:26 octoprint sh[2721]: device/buffer_queue.c: SNAPSHOT:output:mplane: The dma_buf (CAMERA:capture:buf1) is too long: 4147200 vs space=4055040
Feb 15 08:32:26 octoprint sh[2721]: device/buffer_queue.c: SNAPSHOT:output:mplane: The dma_buf (CAMERA:capture:buf0) is too long: 4147200 vs space=4055040
Feb 15 08:32:27 octoprint sh[2721]: device/buffer_queue.c: SNAPSHOT:output:mplane: The dma_buf (CAMERA:capture:buf1) is too long: 4147200 vs space=4055040
Feb 15 08:32:27 octoprint sh[2721]: util/http/http.c: HTTP8081/4: Client disconnected 192.168.1.128.
Update:
I just found out, that after trying to switch cameras in Octoprint and reloading the urls on the web, the other 920HD stopped working and the B825 is working know. Without any restart or systemctl command.
Thanks for the answer. I've made the changes and tried to restart the systemctl.
This does not solve the issue right away.
However, as I'm printing currently a 28h print, I cannot restart the pi
I will come back tomorrow the mark the answer as solved or to keep you updated.
The "server error" is an issue inside camera-streamer. It's definitely running, and you're able to access it fine. It's returning this response as an internal server error.
We're not completely sure but it seems camera-streamer can't recover properly if it has an issue with the stream going stable - there's an open bug report somewhere on the repo. It's the reason the new stack is not the default because this issue exists.
Regarding what Charlie_Powell says. I recall fighting with this where the stream would seem to disappear and ended up reducing the resolution of the streams until this stopped, then working backwards.
You may want to set the stream resolution very low, say 640x480 at 10 FPS, make sure you can see the streams and then change the resolution back up in steps until it appears to be stable.
Try FORMAT=MJPG for all cameras. The usb hub inside the pi could be flooded.
Perhaps also try different combinations of the usb 2 and 3 ports. Just an idea to try if it helps.
Nope. As soon as I switch the B525 to MJPG I'll get a server error. Running it on 480p in YUYV its fine.
I also tried all possible combinations of ports, without any effect.