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
7.24k stars 522 forks source link

How to Implement TV-like Screen Switching Without Interrupting Existing Clients #1292

Open DarkiT opened 4 months ago

DarkiT commented 4 months ago

I currently have a requirement to cyclically push the footage from two cameras to a streamID according to a schedule, such as automatically switching to another camera every few minutes. However, when switching the camera feed, I don't want to disconnect the existing clients. I hope the clients can switch the footage smoothly, just like how we watch TV broadcasts switch scenes. How can I achieve this?

publish:
  live:

streams:
  live: 
  video1:ffmpeg:./demo.mp4
  audio2:ffmpeg:./demo1.mp4
AlexxIT commented 4 months ago

Frigate project has feature named Birdseye https://docs.frigate.video/configuration/birdseye They manually push frames from different cameras to this stream via ffmpeg. You can't do this in general and easiest way because every stream can has different codec, resolution, encoding params, etc.

DarkiT commented 4 months ago

Please forgive my foolish actions; I realized this after posting the issue. Indeed, closing the client connection and reconnecting would be friendlier. However, is it possible to actively close the client connection after pushing a new stream or calling the API in a PATCH manner, rather than waiting for the client to disconnect on its own? This way, the client’s display can switch automatically.

DarkiT commented 4 months ago

I reviewed previous issues again, and my requirement matches this one. #869