jneilliii / OctoPrint-RTMPStreamer

22 stars 13 forks source link

Add Overlay/Watermarking and option to use local FFMPEG #33

Closed TheSin- closed 2 years ago

TheSin- commented 2 years ago

This PR does lots, still a WIP but wanted it documented so others can see progress

TODOS

Known Issues

jneilliii commented 2 years ago

Instead of /tmp/ I think we should use /var/run as I've recently learned is stored in memory on raspberry pi OS instead of on sd card. That will reduce writes and prolong the life of the sd card.

jneilliii commented 2 years ago

Replace self._basefolder + "/static/img/" with self.get_plugin_data_folder(). This will allow uploaded files to be backed up with octoprint.

TheSin- commented 2 years ago

both great suggestions, I'll work on changing that up right away

TheSin- commented 2 years ago

Maybe I'll make the tmp dir an option as /var/run will likely yield perm issues, specially on other platforms?

TheSin- commented 2 years ago

just as I suspected for /var/run

$ touch /var/run/test
touch: cannot touch '/var/run/test': Permission denied

it's not good form for linux to do that either. But I do understand due to the SD card, I run my entire /home/pi on USB drive instead to save my SD. We could maybe setup a ramfs and mount it, or use overlayfs which is held in mem if we are super worried about it. We could also put a warning on it for pi users ? Thoughts?

/run/user is an option as it'll have user perms, we'd have to use the env var for it though

XDG_RUNTIME_DIR=/run/user/1000

and that still isn't a guarantee as it's XDG specific and wouldn't work on MacOS or other linux installs for sure.

/dev/shm is an other tmpfs on pi. it's user writable, but it's not in good linux fashion to use it as a tmp, but it would achieve what you are looking for.

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        32G  5.9G   25G  20% /
devtmpfs        423M     0  423M   0% /dev
tmpfs           458M     0  458M   0% /dev/shm
tmpfs           183M  619k  183M   1% /run
tmpfs           5.3M  4.1k  5.3M   1% /run/lock
/dev/mmcblk0p1  265M   52M  213M  20% /boot
tmpfs            92M     0   92M   0% /run/user/1000

and I take /run/user back as that will only be available while pi user is logged into a console so that won't work even if we could figure it out. So the only option is /dev/shm but it's really not a great idea to put files in to the shm dir

jneilliii commented 2 years ago

I'm not super familiar with any of this linux based stuff, just know that it can be a problem writing a bunch and if we're saving an image every 2 seconds that seems like it could be a lot. I'm going to ask over on the dev-plugin channel in Discord and see what the consensus is.