Script to reset a frozen media source (live stream)

BarrySDCA

New Member
I have an issue when using a live stream as a media source. It seems if a packet is lost along the way, the video freezes or if it's an audio stream it just goes silent. You need to open the media source and either edit the source URL or what I do is tick/untick "use hardware decoding when available". This makes the source stream reconnect and all is fine again.

And so I'm looking for someone to write a script that will monitor the live sources (video or audio) and if no new data is received after 2-3 seconds, simply reconnect it.

I have no experience coding for OBS but I'm sure this is relatively easy for the right person and I'm also sure I can't be the only person with this issue. Much appreciated.

Thank you
 

ethaniel

Member
I solved it using the gstreamer plugin.
The pipeline for my Hikvision security camera which broadcasts via rtsp is:
Code:
rtspsrc location=rtsp://admin:password@domain.ath.cx:5540/Streaming/Channels/101 !  rtph264depay ! avdec_h264  ! video.
(don't remove the dot after video)

And these are the settings that I use to keep the stream always running.
1596780460189.png


My camera sends only video. But if your stream also has audio, you might need to tweak the pipeline a bit (looks for examples on the web).
 
Top