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
3.89k stars 318 forks source link

Can magic producer support temporary overwrite of existing stream #869

Open kirianguiller opened 6 months ago

kirianguiller commented 6 months ago

In the release 1.8.4, was implemented an http POST stream feature (linked to #745) called the "magic producer" iirc.

I wanted to know if it's possible in someway to have an existing stream (for instance my_stream: exec:ffmpeg -re -i /media/BuckBunny.mp4 -c copy -rtsp_transport tcp -f rtsp {output}) that would temporarily get overwritten by a stream thanks to the magic producer mentionnend above (#745).

This way, it would be possible to

  1. create a stream from a static image (in go2rtc)
  2. consume through webrtc (for instance) the stream
  3. have a thirdparty service (nodejs server for instance) that would post the relevant stream to http://PATH_GO2RTC_HOST:1984/api/stream?dst=my_stream

This way, no reload or webrtc recall would be needed on the frontend. The video component would seamlessly switch from being a stream of a static image to being the mirror of the relevant stream.

Sorry in advance if this logic is already possible. I start to be familiar with go2rtc, but I haven't yet found how to do to this !

Thank you for your help and this amazing repo :)

AlexxIT commented 2 months ago

Replacing existing source of stream is not supported for now. New source will be added to existing stream as second source. But clients will prefer first source (if both codecs same).