guysoft / OctoPi

Scripts to build OctoPi, a Raspberry PI distro for controlling 3D printers over the web
GNU General Public License v3.0
2.45k stars 366 forks source link

Proposal: Webcam stream overlay with print status #800

Open bo0tzz opened 1 year ago

bo0tzz commented 1 year ago

I've been poking away at building a system that takes the webcam stream and overlays some information about the print status. I was building this independently from octopi/octoprint, but I've realised that with octopi 1.0.0 it might be pretty easy to include a feature like this natively.

ffmpeg can overlay text onto a video with a single line, for example:

-vf "drawtext=textfile=/run/webcam/overlay.txt:reload=1:fontcolor=white:fontsize=40:box=1:boxcolor=black@0.5:x=w-tw:y=0

That line could be added to ffmpeg_hls.service. As far as I can tell, the overhead of having this always enabled is essentially nil.

The other side would then be a basic octoprint plugin that writes some information about the current print status to the /run/webcam/overlay.txt.

I would love to hear your thoughts on adding this. If it is wanted, I could flesh it out some more and maybe create a PR (though that might take me a while).