See a clip of the monitor in action here!

The Octoprint Problem

I don’t know exactly how long I’ve been using Octoprint to manage my 3d printers, but I can’t remember a time I had a printer and didn’t use Octoprint.

It’s a fantastic piece of software for everything 3dprint related with one glaring exception – Live camera monitoring.

Octoprint’s live monitoring only supports cameras like Picam, that serve a URL you can poll and get an Mjpeg. While I have half a dozen cameras laying around the house, none of them support this.

Disclaimer: I have not yet moved to Klipper but it is on the list and I’m aware will probably solve some of these problems (and/or make new ones)

Something went wrong
Success!

Subscribe for post alerts!

Sign-up for the latest Reticulated.net posts below

Cheap Wyze/Kasa Cameras

Those cheap $20 cameras you can get on Amazon are pretty great. Of course, they’re all locked down to only work with their associated mobile apps out of the box, but most are able to be exposed over RTMP if you do some command line with FFMPEG.

These cameras can’t really work wtih Octoprint without you doing something crazy like converting RTMP to an mjpeg stream, which feels like going backwards. I have done this in the past and don’t recommend it.

I’ll cover setting up RTMP on the 2 cameras I’m using, the Xiamoi Yi 4k+ and a Kasa EC60, in the setup steps below.

The Pi Problem

The real issue with using Octoprint to stream your 3d printer videos is the hardware most people are running it on. A Raspberry pi that’s working with the printer to figure our GCODE to stepper-motor translation isn’t the place to also pipe in one or more HD live stream feeds, unless you want skipped steps and layer shifts.

Enter Youtube Live

Now that we don’t have to worry about Octoprint’s restrictions, we’ll have to figure out where our stream will live. Youtube Live will let us easily stream dozens of hours of our printer feed with no hassle and make sure it’s available anywhere with an internet connection. We also can make clips, seek back 2 hours to see why a print failed, etc.

Why deal with your own stream when YT makes this so nice and easy (and free!)

The Full List of Tools

Here’s everything we’ll be using to make our stream.

Setting up RTMP

Setting up Monaserver is simple. We don’t need to do any configuration, just download and run it and make sure you see Protocols.h[82] RTMP server started on 0.0.0.0:1935 in the console when it launches.

Camera Setup

If you happen to have a Yi 4k+, it comes with a live stream mode out of the box. You can use this qr code generator to connecto to Monaserver. You’ll need to enter the local IP Address of the computer running Monaserver for the RTMP URL: x.x.x.x:1935 and enter your wifi details as well. It’s handy to print this out on paper so you can easily connect the camera when you need to.

For the Kasa EC60 or similar, I followed this article to get RTMP working. I did not find all the info in the article to be correct. You should just be able to update and save the code below in a .bat file on Windows and run the file after your start Mona and connect to the Kasa camera.

Be sure to replace KASA_EMAIL_ADDRESS, MY_PASSWORD and [KASA_IP_ADDRESS] before use.

@echo off
F:\download\curl-8.7.1_6-win64-mingw\curl-8.7.1_6-win64-mingw\bin\curl.exe -vv -k -u KASA_EMAIL_ADDRESS:MY_PASSWORD --ignore-content-length "https://[KASA_IP_ADDRESS]:19443/https/stream/mixed?video=h264&audio=g711" --output  - |ffmpeg -re -i - -f flv rtmp://127.0.0.1:1935/live/2 

Setting up OBS

Now that we have our cameras both streaming out to Monaserver, we can start setting up OBS with the inputs we’ll need.

I’ve exported my OBS Scene with all features here. You should just need to change the camera setups if different than I’m using and replace the Auth token for the Octoprint API.

Cameras

Importing our feeds into OBS is easy. Just select New Source –> Media Source and enter rtmp://127.0.0.1:1935/live

if you setup a 2nd camera, setup a 2nd Media Source and enter rtmp://127.0.0.1:1935/live/2

Data

Getting all our data in will be a bit more challenging. The URL/API Source Plugin can help us set this up in a nice way.

You’ll need an API key from Octoprint to set this up. I won’t go into each source I’ve setup, but I’ll briefly cover how to use the plugin.

  • After you install the plugin, setup a new source and select URL/API, then click Setup Data Source.

  • Enter http://[MY_OCTOPRINT_IP]:5000/api/printer in the URL field and setup a new header `Authorization: BEARER [MY_OCTOPRINT_KEY].

  • In the JSON Pointer field, enter /temperature/tool0/actual to grab the Extruder Temperature from the API. Other fields can be pulled in in a similar way.

  • Exit the Data Source screen and scroll down to the output template. Enter Extruder Temp: {{output}}°

The last thing we’ll walk through setting up is the print image. This requires the Slicer Thumbnails plugin for Octoprint and that you setup your slicer to output the preview images.

Caution: I tried dynamically pulling in the jpg file through the URL/API source based on the active job file name, but the string manipulation tools in the plugin/OBS didn’t let me find a way that could work. I know setting up things this way is pretty nonstandard – If you can get the image URL pulled into OBS dynamically, please leave a comment!

  • Create a Browser Source and enter your Octoprint Dashboard URL.
  • Open the filters pane on the Browser Source and select “Crop/Pad” and adjust the cropping to only show the printer image
  • Create a new filter “Color Key”, pick custom color and select white (#ffffff)
  • Adjust the settings to make the background transparent
  • Optionally add a “Color Correction” filter to change the color of the image.

Final Thoughts

And that’s it! Now you can multi-camera monitor your 3d prints from anywhere. With this and the telegram notification plugin in Octoprint to tell me when prints are done, I’m having a much better 3d print experience than in the past.

I’ve also recently spent a ton of time fine-tuning my Kingroon trying to get as close to perfect settings and dimensions and may do a quick write up on that in the near future since there were some things even as a long time 3d printer that were new to me.

Thanks for reading!