I'm using a simple Chinese USB webcam (works with uvccamera Linux kernel module) on a home server, having a Braswell-based CPU (ultra low TDP) with mjpg-streamer and Octoprint. OS is the current LTS Ubuntu Server (18.04).
Everything works fine, but I found, that the webcam seems to be running all the time instead of just when someone is visiting the web interface or actually "using" the stream. The cam gets relatively hot (even in low resolution mode) and has basically doubled the energy consumption of the whole system running also other services. The CPU load is very low (around 1-3% for the mjpg-streamer running service), though.
As soon as I stop the mjpg-streamer service, the cam seems to be disabled (no more heat). It seems to be wasteful to let the cam run 24/7 for only looking at the stream maybe once or twice a day for a few seconds.
Maybe this is a really crappy webcam, but I was under the impression, that the cam software (in this case mjpg-streamer) only accesses the cam hardware and "doing its thing", when there is actually one or more clients watching the stream.
Since I've designed the whole system to be very energy-saving, I won't use the cam like this.
I don't need or want time lapse recordings, I only want the cam for checking in on the printer from time to time.
Any ideas how to do this? I was thinking of some kind of script that starts the service when a connection on the web server port is made and disabling it automatically after a certain time - maybe this is possible using systemd. As far as I could find out, mjpg-streamer doesn't support any "power saving" options.
Or maybe there is another software option?
Thank you for any input on this topic!