Zend certified PHP/Magento developer

FFmpeg stream failover and recovery

I’m looking for some ideas on how to handle a stream failover and recovery with ffmpeg.

Currently we are using ffmpeg to transcode a stream which can be a bit unstable and even cutout for a time. Currently we have to manually restart the stream. I believe ffmpeg can detect stream issues or if the stream is down and automatically switch to a backup stream, say a static image. But ideally I’d like for it to detect that the original stream has recovered and then switch from the failover stream back to the original stream.

Any ideas on how to accomplish this?