jneilliii / OctoPrint-RTMPStreamer

22 stars 13 forks source link

Feature Request #27

Closed Karybdus closed 2 years ago

Karybdus commented 3 years ago

Hi, could you please add the Feature that the name of the currently printed object blablabala.gcode is displayed in the stream ? i think it should work with any kind of the drawtext parameter.

Thank You Karybdus

Karybdus commented 3 years ago

hello jneiliii, i've tested with a little bash-script instead of your docker-container. Maybe this will help you. I have attached the bash-script as a txt file. I'am using the preinstalled ffmpeg which cames with the current ocotprint image, so i also don't need to use the docker container for testing with my Script. Perhaps it will be posible to fire that script on print start instead of the docker container ? and kill the script at end of the print ?

Thanks

send_ffmpeg_to_twitch.txt

jneilliii commented 3 years ago

Thanks for that, will make implementation a bit easier.

TheSin- commented 2 years ago

what about adding a way to build an overlay template like I suggested here

https://github.com/adilinden-oss/octoprint-webcamstreamer/issues/22

I just haven't had time to get it all setup it but it shouldn't be too hard using ffmpeg

jneilliii commented 2 years ago

If you can do it with standard ffmpeg commands you could achieve this yourself using the built-in Event Manager in OctoPrint's settings I would suspect for PrintStarted event, and then kill ffmpeg on PrintDone event.

TheSin- commented 2 years ago

Sorry maybe I wasn't clear it would have to be produced via the stream on every frames with placeholders for info that comes from octoprint so it updates things like eta, and current layer, current heat etc etc.

I'm just finally getting around to updating my octoprint to python3 then I might give it a shot. I might use your current plugin as a base if that's okay.

jneilliii commented 2 years ago

yeah, that's a little trickier because the stream source is coming from the built-in mjpgstreamer and the plugin is just transcoding it to the correct format. the plugin is using a dockerized version of ffmpeg to do this so it is conceivable with it's ability to do overlays, but the only way I can think to have that be interactive during the process is writing out the overlay contents to a file and specifying the reload option to a text_file source? I'm just not super familiar with ffmpeg to know exactly what is possible and how it all works.

I have at many times considered switching the plugin to not use the docker container since ffmpeg is bundled with octopi image, I just haven't had much dev time to work on it much.

TheSin- commented 2 years ago

that is what I was thinking, having a second process that runs every few seconds to update the image, so it would just take a temple and build and overlay, that overlay would get written to a file that is shared into the docker image and gets overplayed during the transcoding, that last part being the easiest part IMHO

I think in my other ticket I have the command for the ffmpeg part, if not I could easily figure that out. It's creating the template engine to make the overlay. But man would it make for a nice stream, could add a logo and some info that updates.

but I do agree I don't see why docker is required, nor do I see the benefit to it, though in this case I don't think it's a big deal. Anyhow I'm hoping to give it all a shot in the next week if all goes well.

jneilliii commented 2 years ago

Do you happen to know if ffmpeg can use a URL as an overlay? If that's possible it would be fairly trivial to create that page within the plugin to load in.

TheSin- commented 2 years ago

I'll run some tests on the pi see what I can figure out with a static overlay, I'll try it locally and url and report back. Won't be tonight though, server updates and reboots tonight ;)

TheSin- commented 2 years ago

Okay I have overlay working with a static image, and I also have local ffmpeg working without docker image.

Sadly I used the webcamstreamer plugin as my base as I had already started with that one. I'm going to work on converting everything to your plugin so I can make a PR. Right now it's using a static image that is stored at /tmp/overlay.png. Both the docker and none docker expect it there. I figured that would be a good place so we can start a second process that updates it, that part I still haven't figured out yet though.

I do believe a url will work for it as well. I'll test that next now that I have it working.

I think having live updates will be a little more complex, I haven't tested yet but I believe the static image is loaded at the start and not reloaded so that means actually making a second stream to use as an overlay. But I'll work on testing that next.

if you want to see the results you can see it at https://www.twitch.tv/thessienthetank just look at some of the clips from today

EDIT: url for the overlay is confirmed it does work.

EDIT2: confirmed that just changing the image doesn't not update it live, so it will need to be a stream we can update making it a bit harder to start with. I'll work on trying to figure that part out. But it does allow for statics like the filename, logos, etc etc to start to work right away.

EDIT3: I have dynamic overlays working without a stream. Now to figure out how to make a template and convert that into a png that updates on a loop.

https://github.com/TheSin-/octoprint-webcamstreamer

Screen Shot 2021-12-29 at 10 20 23 PM

jneilliii commented 2 years ago

New version 1.0.0 released with dynamic text options enabled as overlays.