Octoprint webcam stream over an API

Hi, I'm working on my first octoprint plugin. The idea is to integrate octoprint with my DIY IOT smart home. In curent set up I'm using a getAnywhere plugin to monitor my printer remotely and my own IOT remote control to shut down power for the raspberry pi octoprint server and the printer after the print job is finished. That however requires two tabs in my browser wich is a bit annoying and I'd like to have one integrated solutions. I've been able to send data between the octoprint and a website on a remote webhosting server without a problem using an API. The only problem i have is that i can't figure out how to get the live stream from the webcam to that webpage.

Without some form of tunneling between the external site and your pi this won't be possible. You could potentially upload snapshots when they are generated during timelapse creation if that is enabled using the event CaptureDone. You may want to look into how the Spaghetti Detective does it as that plugin uploads images to an external endpoint for analysis.

I take that back, after thinking about it more, my RTMPStreamer and YouTubeLive plugins do exactly that, but you would have to have some server side endpoint to stream to. I would recommend using the webcamstreamer plugin instead though as it has lots more options available in it and is a little easier to set-up than mine because you don't have to compile the docker images yourself. Then you just have to figure out a rtmp server to accept the stream.

Actually both Spaghetti Detective and Octoprint Anywhere are made by the same guy. There are a lot of issues with regard to webcam streaming and the way octopi handles 'streaming.'

I know. My first idea was to use ffmpeg running on the pi to stream video the from the webcam to a remote ftp server instead of the HDD (I'm useing a VM at the moment) thereby avoiding the octoprint setup for streaming but when i coudn't get that to work (it starts to stream the first .ts file but then it just gets stuck before it even sends the .m3u8 file) I've started to look for alternatives.

"stream" and FTP don't go together much. It's all just MJPEG, so you can batch and send them.

1 Like