A new camera stack for OctoPi

For the past few months, I’ve not only worked on OctoPrint 1.9.0 and its RCs, but I’ve also been working on a new camera stack for OctoPi.


This is a companion discussion topic for the original entry at https://octoprint.org/blog/2023/05/24/a-new-camera-stack-for-octopi/
3 Likes

If you were running Octopi 1.0.0 prior to this blog post, is the new camera stack already included? Or, is this a new release (of 1.0.0?) such that prior 1.0.0 releases did not have the new camera stack?

Have you read this: ?

grafik

It gives information regarding OctoPi

Works well for me with a Raspberry Camera Module 3 on Raspberry Pi 4. But for my production system I prefer to use the Docker image. I notice these were updated yesterday, but it is not clear if any of the tag versions include the new camera stack. Do you have any information about this?

I did read it, but my question remains. I don't understand if there is versioning or iteration that's not referenced in the numbers (e.g., 1.0.0).

For additional context I had installed Octopi 1.0.0 when it was released on March 2, which contained Octoprint 1.8.7. Then, I upgraded to Octoprint 1.9.0 when it was released yesterday.

As I tried (and apparently failed) to explain in the post, this new stack is included on a recent specific build of OctoPi-UpToDate, which is an image built from OctoPi (currently the 1.0 image) with latest OctoPrint, latest kernel and firmware and such, and originally got created to be able to have a faster turnaround than the (not maintained by me) OctoPi can offer, since OctoPrint and Raspberry Pi moved faster than OctoPi could keep up with.

This faster turnaround also allowed the fast development cycle the new stack was created in, and allows to make it publicly available now vs in a year or more.

These OctoPi-UpToDate images have build numbers which currently aren't reflected in the UI (I need to change that) but are reflected in the system info bundle. Yes, I'm going to improve things here ASAP.

If you've flashed OctoPi via the RPi Imager's image selection some time during the past 1.5 years, you've actually flashed OctoPi-UpToDate. Unless you've flashed since yesterday and explicitly chose the "new camera stack" image in the imager, you don't yet have the new stack, and while a manual upgrade can be done in principle, it's really not something I want to support when a working backup/restore workflow is the way way easier and less error prone option.

I hope that clarifies things a bit. And yes, the current image situation definitely can be improved, and I'm looking into that too, but I sadly don't have any clones and the day only has 24h for me as well :wink:

3 Likes

8 hours working day...we don't expect you to work more than a full time job would.

2 Likes

So is this Camera Stack included in the 1.9.0 upgrade? Or just in the new Octopi image? Sorry if I sound like I don't get it. Because I don't. :slight_smile:

2 Likes

The new camera stack is just in the new OctoPi image. The webcam changes in OctoPrint 1.9.0 were a separate project done in parallel, although they are linked they are not dependent on each other.

I wish the build number was shown when viewing about Octopi. To save you time tl look. Here is what is shown to me: Version 1.0.0, running on Raspberry Pi 4 Model B Rev 1.5

I've noticed since trying this image that if I leave the tab open with the webcam it gets very laggy after a while, I'm using this test image installed on a pi4, with a c920 webcam and using default settings ( so I think still sending jpeg images?) refreshing the tab fixes it but it's not an issue I spotted on previous images.

Edit: I should also add that when I'm using OctoApp to monitor a print it's flawless, so it's just the web interface that has this problem for me.

Edit2 : The laggyness doesn't seem to be affected by browser or system, had same issue on firefox, edge on linux & windows with laptop & beefy gaming desktop.

That's more browser related. Some browsers (especially on slower machines) can't handle high quality mjpeg streams.

There isn't much we can do about it.

This is really incredible work! I run OctoPrint on a Pi 3B as well as an old MacBook pro, and both machines are so taxed by mjpg-streamer. Really excited about this change. Thanks so much for all the time spent on this and OctoPrint as a whole!

For OctoPrint 1.9 installations not on a Pi, though, how does one access a camera feed other than an mjpg stream? I seem to only have "Classic Webcam" available, even though my USB webcam has H264 support built in. I expected to be able to add a plugin for this, but haven't found one. Are other streams only supported on the Pi?

1 Like

This post is aimed at a new streaming software for OctoPi specifically, which does only run on a Raspberry Pi. At the same time OctoPrint itself only does viewing of streams provided by some external software, and only supports mjpg and HLS webcam viewing, so to get webrtc it will still require some more work - a plugin to add support (I'm looking at it).

To use a h264 stream through eg. webrtc, you need some software to stream this first that works on a mac, then most likely create a plugin (see the webcam changes in 1.9.0) that adds support for viewing your stream type. The (only) great thing about mjpg is that it works everywhere, whereas webrtc has no standard for the signalling protocol.

1 Like

Now that I have updated my OctoPi to OctoPrint 1.9.0, I no longer have the ability to adjust my Raspberry Pi camera's settings. Where do I go now to adjust its white balance, contrast, brightness, etc.?

1 Like

How did you do it before? With the 'Camera Settings' plugin? This should not have been affected by the OctoPrint update, but if you have then I would recommend opening your own topic to troubleshoot why the plugin is no longer loading for you (if it's the plugin you used).

1 Like

I have notice a change with the url used to access the video stream for this stack with this change. This can complicate things for plugins that may access the video feed, ie Octodash in my case. I reached out to their development team to make them aware of the change in the coming Octoprint version. I sent them the new link that I fleshed out of Octoprint. I'm sorry that I don't have it right now. My Octoprint server is down for the moment as I am going through a big reconfiguration of the hardware on my printer. I am very excited about this new software stack for Octoprint. Keep up the great work guys!

1 Like

Thank! I thought that's what you here saying but had been playing with HLS stuff in the old image and wasn't sure if it was worth re-imaging but it sounds like it is.

There wasn't a change however, /webcam/?action=stream should continue to work just fine, and in fact the OctoPrint config wasn't touched to change to a different URL at all on the image, with things continuing to work.

Are you by any chance referring to the changes in OctoPrint's webcam integration with 1.9.0, as strongly mentioned in its release notes? Because those are entirely unrelated to the new stack.

Is this Pi hardware specific or just linux? I have a le potato device that runs raspian and runs most pi software, just doesnt work with pi specific interfaces that its missing. Its running rasbpian would this work on it?