ayufan / camera-streamer

High-performance low-latency camera streamer for Raspberry PI's
314 stars 47 forks source link

A switch to turn the libcamera process on/off? #83

Open bb5d0 opened 1 year ago

bb5d0 commented 1 year ago

Until recently I used two raspi-lagacy-camera-stack http-server programs at the same time. One of them to stream, the other to capture/record photos/videos. I used these functions on-demand, so that only one of them at a time would access the camera resources. Now migrating to libcamera ... I really like your no-nonsense http streaming interface. But I would also like to use a different program to capture/record without having to stop/start the linux service. Would it be possible to start the http server with a switch to turn the underlying libcamera process on/off?

rippiedoos commented 1 year ago

There is only one process that is directly started by the systemd-service. Turning the libcamera-process of can only be done by stopping the service, that's the exact point of the service.

You could also start the process that is started by the service by hand, maybe in a wrapper-script. That way you can avoid using the service but still use the process.

But putting sudo in front of the service-command could also do the trick.

bb5d0 commented 1 year ago

I think you missunderstand what I meant, probably because I missphrased it. And I haven't looked into the code myself yet. What I meant is: At the moment the service starts a process comprised of multiple threads. Some thread must be responsible for the http server, others accessing the camera hardware via libcamera etc. What I'd like to have is the http server (thread) only, started by the service, seperated from optional libcamera (threads) etc. which would be controlled by a on/off switch on the http server.

ayufan commented 1 year ago

I think you can achieve the same with extra service in front, like some cgi-bin script hooked to nginx that could start or stop the service.

bb5d0 commented 1 year ago

Yes, I thought of something like this myself. I would have to look into this. Making the access to the hardware-resources optional was a very convenient feature of the raspi-lagacy-camera-stack http-server programs that I used. Not having to switch on services made it responsive quickly.