Camera-streamer configuration on the new camera stack for OctoPi

If I add an USB camera with add-usb-camera and I choose the right camera and I can see it set port 8082.
is the URL to the stream as it was before http://octopi.local:8082/?action=stream ?
I can't see the video.

I cannot get this to work at all. I did a fresh install of OctoPi 1.0.0 and Octoprint 1.9.2. I have one USB camera attached, and camera-streamer is running:

/usr/bin/camera-streamer --http-port=8080 --camera-type=v4l2 --camera-path=/dev/v4l/by-id/usb-046d_Logitech_Webcam_C930e_3B3BA81E-video-index0 --camera-format=YUYV --camera-width=1280 --camera-height=720 --camera-fps=15 --camera-nbufs=2

However, when I go to 192.168.1.5:8080 or 192.168.1.5:8081, I just get "Unable to connect". What am I missing? lsusb shows the camera just fine. journctl shows:

Sep 11 21:41:00 octopi systemd[1]: Starting camera-streamer...
Sep 11 21:41:00 octopi camera-streamer-control[3486]: Running start for camera-streamer-libcamera.service...
Sep 11 21:41:00 octopi camera-streamer-control[3486]: ... done.
Sep 11 21:41:00 octopi camera-streamer-control[3486]: Running start for camera-streamer-usb-default.path...
Sep 11 21:41:00 octopi camera-streamer-control[3486]: ... done.
Sep 11 21:41:00 octopi systemd[1]: Finished camera-streamer.

Setting this in usb-default.conf fixed it:

OPTIONS="--http-listen=0.0.0.0"

1 Like

Doesn't sound like you're using the new camera stack in OctoPi there.

Are systemctl service files behind the service files available outside of the build image on a github somewhere?

I imagine there are camera-streamer.service, camera-streamer-libcamera.service camera-streamer-usb.service files that show precisely how the services are implemented and how /boot/camera-streamer/libcamera.conf and perhaps maybe /boot/camera-streamer/use-.conf are used.

The standard camera-streamer docs appear to mention only the libcamera configuration within https://github.com/ayufan/camera-streamer/tree/main/service files and don't appear to use or discuss the /boot/libcamera/*.conf scheme.

====

I see those files are created here:

and the same file points to

and

You already found it. GitHub - OctoPrint/camera-streamer-stack: These are the files of the new camera-streamer based webcam stack for OctoPi-UpToDate. The image does the install for this from the other script file you linked as well here with github actions. The actual service files themselves are here.

1 Like

This is exactly what I had to do to get it working. I also had to wait until all the first startup reboots completed before plugging in my camera or the service wouldn't start.

OPTIONS="--http-listen=0.0.0.0"
Is this necessary to place in libcamera.conf? In 2024? Edit: it seems yes.

For a first startup, should the non-usb camera be installed or not? If not, when should it be installed? My pi4 is in an awkward case, so it takes a while to take it apart and put it together. The case is not camera install friendly.

Could you kindly point me to a thread for configuration of Arducam? I have the 64M pixel camera I'd love to use, but I've barely got it to work. (Did get it to work on a stand alone RPI3B, but it was a whole lot of work.). Thanks.
Edit: I see that autorange and autofocus are enabled. Not sure about anything for high pixel cameras.

Edit 2020 02 17: I found a satisfactory answer here: https://community.octoprint.org/t/usb-camera-options-new-camera-stack/54440

I have the new camera stack working well with my Logitech C920 using the default USB camera config file. I would like to customize some settings, but I can't find the syntax for the options I want to change. I have found many in this post, but not all. I tried $ camera-streamer --help and got the same thing published here. When I tried $ camera-streamer --camera-list_options, I expected to see a list of the camera's options, but I got this instead:

$ camera-streamer --camera-list_options
camera-streamer Version: v0.2.5 (41d8dfd)
device/v4l2/device.c: CAMERA: Device path=/dev/video0 fd=3 opened
device/v4l2/device_options.c: CAMERA: The 'horizontal_flip=0' was failed to find.
device/v4l2/device_options.c: CAMERA: The 'vertical_flip=0' was failed to find.
device/camera/camera_input.c: CAMERA: Disabling DMA since device uses USB (which is likely not working properly).
device/v4l2/buffer_list.c: CAMERA:capture: ioctl(ret=-1, errno=16): Can't set format

Ayufan posted "All available configs can be found here: libcamera/control_ids.yaml ..." but that yaml file talks about controls and return codes; I don't understand how to use that document when setting camera options.

I am looking specifically for the options to turn off autofocus and set manual focus to a specific value, turn off autoexposure and set exposure to a specific value, same with setting manual white balance. I can do those things from the control app at octopi.local/webcam/control, but I want to make the settings persistent.

Is there a list somewhere of all the available options?

I had a little struggle to add a second Logitech C270 camera on my Raspberry PI 4 with camera-streamer.
I could get both cameras to work but not at the same time. If I reboot the service instance of camera-streamer for CAM1 the other one (CAM2) would work and if I do the same for CAM2 then CAM1 would work again.
I could solve it by using MJPG instead of YUYV. I think it has to do with limitations in the internal USB hub in the PI 4. MJPG uses compression whereas YUYV does not.
I checked the image difference and found that MJPG gives a little bit sharper image anyway so I switched to MJPG by setting FORMAT=MJPG in the configuration files of both camera's.

Just sharing this with the community. I hope this could be helpful for anybody.

Interesting, as I have the same problem. Also with two Logitech cams (HD920 and a B525HD).

I also started with YUYV on both cams and switched to MJPG as well as JPEG. However, the B525HD was never working correctly.

After switching it back to YUYV on 480p, it is now working. Higher resolution will cause a Server-Error. The 920 is running in 1080p on MJPG without any bigger problems (sometimes it freezes).

Try listing the supported formats by the camera:
v4l2-ctl --list-formats -d /dev/v4l/by-id/whatevercameranameyougot

Thanks. YUYV and MJPG are supported (by both).
However, this discussion is not at the right place. I already have a topic open: New camera stack - one of 2 cameras not active - #14 by Wit4r7

Please don't hesitate to comment there if you have any additional ideas. I would be pleased, if it would work better.

1 Like

Hi All, I've tried editing the config file at /boot/camera-streamer/usb-cam1.conf and changing the frame rate:

FRAMERATE=2

which I'd hope would be pretty noticeable but the feed looks to be anywhere from 10-30 fps (ie smooth). Are there lower limits imposed on the framerate somewhere?

Is Multicam compatible with the new Stack? New stack is working and can see both camers with http://octopi2:8081/stream and http://octopi2:8082/stream (with OPTIONS="--http-listen=0.0.0.0"). Also an wget on octopi retries a shotshop or the stream.
But Multicam plugin shows only:

Webcamstream nicht geladen
It might not be configured correctly or require authentication. You can change the URL of the stream under "Settings" > "Classic Webcam" > "Stream URL". If you don't have a webcam you can also just disable webcam support there.
Aktuell konfigurierte Stream-URL: http://octopi2:8081/stream

I tried also localhost instead of hostname octopi2. Same problem.

This is a new installation with new camera stack. On my older installation I got multicam running with the old camera stack.

Any Ideas?

It should generally be fine. If you have an issue, open your own "Get Help" topic.

I am by no means an expert. I've just been struggling with this new stack for about a week. The command v4l2-ctl --all should tell you the actual frame rate along with resolution and a host of other info.

If you only have one camera and it is USB, the system might be using /boot/camera-streamer/usb-default.conf instead of /boot/camera-streamer/usb-cam1.conf. When I was first trying to get my camera working, I "added" a camera and it created a conf file in a subdirectory. I don't remember where it was. I found some documentation somewhere regarding multicam setup which told me where it was, and I backtracked from that experiment. I am using the usb-default.conf with my one USB camera and I can control the framerate correctly.

Also, it is not clear from posts on this page, but the video that displays in the control tab (http://octopi.local/?#control) or the home page (http://octopi.local) is still coming from MJPEG-Streamer (with its own settings) unless you replace the Classic Webcam plugin with the Camera Streamer Control plugin.

Whart is the syntax in the usb.conf file to add multiple options? I want to disable autofocus and place my absolute focus on 40.

#Additional options
OPTIONS='--camera options="camera-auto_focus[=0]" --camera options="LensPosition=40"

Is this correct? I can't find an answer to this anywhere, not on camera-streamer's documentation as well.

Thanks in advance! :slight_smile:

Not sure what the square brackets are doing there, but this configuration used to work for a Pi Cam V3 (I have referenced my own comment from 12 months ago so hoping it's not changed!)

OPTIONS='--camera-options="AfMode=0" --camera-options="LensPosition=1"

Adjust numbers as you see fit.

1 Like

A tip, in case someone runs into my trouble:

Cannot find encoder to convert from 'YUYV'

and

Cannot find encoder to convert from 'MJPG'

I had cut the amount of memory shared with the GPU down to 16MB on the Raspberry Pi (raspi-config) because "I won't need that because I'm not running a desktop".

Uh, nope. Back up to 128MB and the camera came right on (after hours of head-scratching).

I haven't determined the minimum GPU memory config for this.

While I was at it (and after I got the camera to come on), I moved the USB cable to one of the USB3 ports. Don't know if this was involved in the frame-freezing I got with prior setups, but I'm hoping I'm good on MJPG now.