So, I have a self hosted Owncast instance. I want to run a 24/7 live stream. However, if the streaming source changes or cuts for a few seconds, Owncast immediately terminates the stream. So I’m trying to find a way to have a “fallback/offline” stream running where it’s just a testcard graphic and the time on it for now. And then when it detects an incoming RTMP stream, it switches to the stream. When the stream ends- back to the testcard. My aim is to make a seamless stream that is always live and doesn’t cut.
I thought such a thing would be simple - it isn’t. FFMPEG needs to reconnect to switch sources. I tried using a FIFO pipe, but the thing that reads the pipe doesn’t seem to like it when the RTMP stream connects, choosing to break. I’ve tried forwarding an RTMP stream from Nginx and using the switchers, but the forwarder likes to break as well (it seems to dislike mismatched timestamps or something)
I apologise for not leaving any specific logs. I have been working on this for days and have errors galore. I am posting here to see if there’s a difference/best approach. (If one of these here is a best option and I was on the right track, I can try and dig up my old code and errors).
I could be very wrong but i think i just listened the linux matters guys talking about the exact thing and using this to resolve it:
https://github.com/wimpysworld/stream-sprout GitHub - wimpysworld/stream-sprout: Restream a video source to multiple destinations such as Twitch, YouTube, Owncast and Peertube 📡
Second topic if you’re interested: https://m.youtube.com/watch?v=9LfC3D8jbyY
I’ve been trying to figure out a related sort of video streaming setup for work (without Owncast, but with a similar sort of 24/7 goal plus other considerations) and have been looking into using ffmpeg’s capabilities to output either HLS or DASH segments + manifests. (FFMPEG can do both but I don’t know which would be better for my needs yet.) The sources I’m working with are RTSP/RTP instead of RTMP and I only need streaming to browser clients currently – although it working with VLC naturally by pointing it to the manifest is nice.
HLS and DASH work by having videos split into small chunks that can be downloaded over HTTP, so just replacing the manifest allows for continuous streaming (the client pulls it repeatedly) without the server needing to maintain a continuous connection to the client.(Fan out to CDNs works naturally since the video chunks are just files that can be served by any web server.)
It should be possible to do some creative things by either creating / modifying the manifests myself with scripting or by piping chunks into another instance of ffmpeg from a script. (I’ve done something similar using
-f image2pipe
in the past, but that was for cases where I need to do things like create a video from an image gallery dynamically.) That’s as far as I’ve gotten with it myself though.I don’t know what the right answer is either, but I’m also interested in finding out and hopeful you get additional responses.
Have you tried liquidsoap ?