AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
4.87k stars 394 forks source link

Allow to disable stream from API (maybe also from UI/YAML config as well) #183

Open felipecrs opened 1 year ago

felipecrs commented 1 year ago

I believe this would be a graceful solution for an issue in Frigate:

The use case is explained in details there, but basically, I want to be able to automate the availability of the stream using some (Home Assistant) automation for a battery based camera/doorbell.

If I just pass its RTSP stream to Frigate, Frigate will maintain a connection to it forever. With go2rtc in the middle, I could enable the go2rtc stream programmatically through some HA automation (like an external motion sensor, or a doorbell button press sensor, or anything else), then disable it automatically after some minutes.

AlexxIT commented 1 year ago

I think this is the wrong way to solve the problem. It is up to the end app (Frigate) to request or not to request the stream.

NickM-27 commented 1 year ago

agreed, frigate would still be requesting the stream which is still a problem. Frigate should know to not request the stream in the first place

AlexxIT commented 1 year ago

I can drop all current connections when someone calls delete API for stream. It could resolve your problem. You will need to add and remove stream via API.

felipecrs commented 1 year ago

But take Frigate out of the loop, and I still believe this would be useful.

Any client can be consuming your stream, like VLC, a different NVR, or anything. This allows the stream to be blocked from the administrator side for whatever reason, including the battery powered cameras use case that I mentioned but not limited to that. If it's an internal camera for example, I could use this feature to disable the stream when I'm home.

felipecrs commented 1 year ago

I can drop all current connections when someone calls delete API for stream. It could resolve your problem. You will need to add and remove stream via API.

That's true, I'm aware of this possibility. But I don't like the fact that I'd have to provide the connection details every time I want to enable the stream back. I'm not sure if I can set the connection details just like I could from the YAML config. For example, can I add both a echo: source and another ffmpeg: source?

felipecrs commented 1 year ago

I can drop all current connections when someone calls delete API for stream. It could resolve your problem. You will need to add and remove stream via API.

Oh wait, I thought this would be happening already. If not, then yes, I think it would make sense as well, regardless of this feature suggestion.

AlexxIT commented 1 year ago

I can extend the stream creation API, and take json as input. If you delete stream - it won't drop current connections. Just remove stream from list.

felipecrs commented 1 year ago

Alright... so, with these two changes, I'd understand if you close this issue. But I still think it would be nice to have a disabling/enabling abstraction for users. :)