Rtmp playback interruption and auto replay

OK so I have a situation where (Because of the CoVid) I need to bring in some remote feeds using rtmp (not my choice of protocol), However if the rtmp stream drops out, the RTMP ffmpeg provider freezes, and will not attempt to re-acquire the feed when it returns. Any idea how I can make it attempt to re-connect? Alternatively, i know by re-executing the PLAY command, it will re-acquire the signal, but any idea how I could detect a loss of RTMP or a Frozen ffmpeg Producer? I do have Humans in a MCR to switch on Freeze Alarm, but I would like to fix it before they even notice.

I am using Remote AMCP to control my Caspar’s, and could GPIO some alarms out my main alarming system to send a PLAY command to the relevant Caspar (I have 16 Caspar’s so that loads of GPIO cables, soldering, interface cards and all that old hardware stuff). This is something I juts feel I should be able to solve in software.

Your a brilliant bunch, and I hope somebody has a solution, or at least an Idea I could follow.

Thanks for any ideas in advance?

Keith

In my client software I have coded to detect audio silence continuous for given time( for example 10 seconds.). If this happens it can be programmed to send amcp command again

Dim aa As Integer = 1
Dim bb As Double
	
 Private Sub TmrSilenceDetect_Tick(sender As Object, e As EventArgs) Handles tmrSilenceDetect.Tick
        On Error Resume Next
        If ServerVersion > 2.1 Then
            bb = ucOSC.dgvosc.Rows(57).Cells(1).Value 'audio value
            If bb = 0 And aa < Val(txtSilenceDuration.Text) Then
                aa = aa + 1
            ElseIf bb = 0 And aa = Val(txtSilenceDuration.Text) Then
                sendotherinfo()
            Else
                aa = 1
            End If
        Else
            bb = ucOSC.dgvosc.Rows(30).Cells(1).Value
            If bb < -190 And aa < Val(txtSilenceDuration.Text) Then
                aa = aa + 1
            ElseIf bb < -190 And aa = Val(txtSilenceDuration.Text) Then
                sendotherinfo()
            Else
                aa = 1
            End If
        End If
    End Sub
	
    Sub sendotherinfo()
        CasparDevice.SendString(txtcommand.Text)
     end sub
1 Like

Using nginx-rtmp you can notify when the stream becomes available and when it disconnects.
Using a simple http server app you can receive the stream info and send a command to casparcg on status change.

2 Likes

If you are running your own RTMP server in-house many of them supported doing UDP/RTP uni/multicast output which would work well with CCG.

Simply superb, many such events can be planned to trigger from absence of audio in signal, pushing CasparCG research deep into AI & Automation.

1 Like

I’ve not needed to do this recently, but in the past I’ve used a separate instance of FFmpeg to translate the flv wrapped stream into a UDP MPEG TS for CasparCG to consume.

Wrap the FFmpeg command in a script so that it restarts automatically when the flv feed drops out, and IIRC what you end up with is a frozen picture for the duration the flv stream is unavailable, followed by a splat / glitch as CasparCG reacquires the lock on the transport stream as it returns.