RTSP stream auto-reconnect?

About encoding, codec settings, muxers and filter usage
DiegoFalcon
New Cone
New Cone
Posts: 1
Joined: 20 Apr 2016 18:03

RTSP stream auto-reconnect?

Postby DiegoFalcon » 20 Apr 2016 18:15

Hello!

I am a bird biologist and we are using VLC to stream a bird nest cam from a camera installed in the nest. (http://kestrel.peregrinefund.org/webcams) Our viewers enjoy the 24/7 look into the birds incubating eggs and raising chicks.

My question is this - the stream is an RTSP stream that then is fed into OBS and streamed to Youtube. While our internet network is good most of the time, it does occasionally blip. This is unavoidable, due to internet options in our remote area. When the network blips even the slightest bit, VLC stops the stream and loses its window size. Which means I have to manually either go back, click play and resize, or remote in to do so if I am not in the office. As you can imagine, trying to keep a constant eye on the stream is somewhat of a pain, and it seems VLC stops even with the tiniest internet blip.

Is there any way to get VLC to auto-retry the stream instead of just stopping? It would save me a lot of hassle. Any suggestions or alternatives welcome. It would be nice even if VLC could just keep whatever window size locked even, so I don't have to re-size every time.

Forgive me if I'm missing something obvious :) I'm a bird biologist, not a software developer. Thank you for your time and input!
-Diego

sdelpozuelo
New Cone
New Cone
Posts: 5
Joined: 07 Feb 2019 22:52

Re: RTSP stream auto-reconnect?

Postby sdelpozuelo » 07 Feb 2019 23:06

Hi,
I'm exactly in the same situation:

- a birdcam in a nest, streaming to YouTube 24x7.
- with the same tools, VLC + OBS.
- with the same protocol, rtsp.

- ...and with the same issue, so VLC doesn't reconnect the media when it faults.

Diego, did you fixed it?

If not, can anyone help us, please? The new nesting season will start soon!

Thank you for your support.
All the best,
Santiago

sdelpozuelo
New Cone
New Cone
Posts: 5
Joined: 07 Feb 2019 22:52

Re: RTSP stream auto-reconnect?

Postby sdelpozuelo » 17 Apr 2019 09:17

Hi again,

The issue continues. Can somebody kindly help us, please?
I tried a lot of things without success. And now is a mater of uirgency, because the birds are starting the nest!

If not possible in VLC to auto-reconnect to a RTSP media?

Many thanks for your support,
All the best,
Santiago

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: RTSP stream auto-reconnect?

Postby Jean-Baptiste Kempf » 19 Apr 2019 07:04

Can you just activate the loop in VLC, so it retries?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

sdelpozuelo
New Cone
New Cone
Posts: 5
Joined: 07 Feb 2019 22:52

Re: RTSP stream auto-reconnect?

Postby sdelpozuelo » 22 Apr 2019 08:22

Can you just activate the loop in VLC, so it retries?
Hi Jean-Baptiste,
Many thanks for your quick response.
Notice that I'm not using the VLC program (Windows interface), but I'm opening a kind of source in OBS, called "VLC Video Source".
In this OBS source, you can add a rtsp chain like "rtsp://user:pwd@192.168.1.100/axis-media/media.amp". And it works, for one hour or so...
I activated the "Loop Playlist" in OBS, you wrote the loop in VLC.
How can I add a parameter in my rtsp expression, just to activate the loop in VLC?
Even more, looking at this feature in VLC program, it seems that you need to define a starting point A to end point B. How use these A and B point in a continous streaming like a live nest cam?
Kind regards,
Santiago

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: RTSP stream auto-reconnect?

Postby Jean-Baptiste Kempf » 22 Apr 2019 15:11

:loop as a VLC option? No idea, tbh.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

User avatar
InTheWings
Developer
Developer
Posts: 1275
Joined: 07 Aug 2013 13:15
VLC version: crashing
Operating System: Linux
Contact:

Re: RTSP stream auto-reconnect?

Postby InTheWings » 22 Apr 2019 15:31

If protocol disconnects, no possible reconnect.
Restart with --loop option.
:!: If you want your problem to be solved :
* First read troubleshooting guide VSG:Main
* Always provide verbose LOGS ! (command line or from gui)
* Always check your issue against a developer build from Nightly Build of VLC
* Tell us when your problem is solved !

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: RTSP stream auto-reconnect?

Postby Rémi Denis-Courmont » 22 Apr 2019 17:46

To detect disconnections in RTSP, we'd have to (replace live555 with own code and) track RTCP packets. Unfortunately, that would break compatibility with so many servers that it's not even worth trying.

Either use a more robust protocol than RTSP, or make your network more robust.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

sdelpozuelo
New Cone
New Cone
Posts: 5
Joined: 07 Feb 2019 22:52

Re: RTSP stream auto-reconnect?

Postby sdelpozuelo » 23 Apr 2019 20:28

Hi,
Thank you all for your quick answers.
Mi camera is an Axis M1065-LW.
So, instead with RTSP, how can I reach the camera using VLC source in OBS Studio?
All the best,
Santiago

sdelpozuelo
New Cone
New Cone
Posts: 5
Joined: 07 Feb 2019 22:52

Re: RTSP stream auto-reconnect?

Postby sdelpozuelo » 30 Apr 2019 18:50

Hi again,
Do someone an answer, please?
Thank you,
Santiago

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: RTSP stream auto-reconnect?

Postby Rémi Denis-Courmont » 30 Apr 2019 21:44

This is not an Axis support venue, TBH.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

videolangeek
New Cone
New Cone
Posts: 2
Joined: 21 May 2020 14:30

Re: RTSP stream auto-reconnect?

Postby videolangeek » 21 May 2020 14:33

Hello All...Just seeing if this is still an active thread. I also stream my bird camera to obs and have found a work around to have it log in. Reply back if interested.

Ceono
New Cone
New Cone
Posts: 1
Joined: 02 Jul 2020 21:33

Re: RTSP stream auto-reconnect?

Postby Ceono » 02 Jul 2020 21:35

Hello All...Just seeing if this is still an active thread. I also stream my bird camera to obs and have found a work around to have it log in. Reply back if interested.
I am very much interested! Please please share your work around.

mike29991
New Cone
New Cone
Posts: 1
Joined: 28 Jul 2020 02:45

Re: RTSP stream auto-reconnect?

Postby mike29991 » 28 Jul 2020 02:58

Hey guys,

I'm not a bird enthusiast but I'm bouncing and streaming a webcam source over/to multiple hosts, with auto reconnect enabled. Perhaps my workflow could inspire some ideas.

At my main server (a raspberry Pi), I use a tool called "raspivid" to get webcam data. I then pipe it through a tool called "n cat" so it can be served over my network. The command looks like:

Code: Select all

raspivid --verbose -t 0 -w 1280 -h 720 -b 3000000 -fps 30 -ih -o - | nc -l 8000

Then, from a second server, I pull that data and use VLC to convert it to an http stream. The second server is more powerful and has more bandwidth, so I use it as the relay for all other computers in my home to view the Pi's webcam. The command looks like this:

Code: Select all

nc [pi hostname] 8000 --idle-timeout 10 | cvlc stream:///dev/stdin -vvv :demux=h264 --no-audio --play-and-exit --sout '#transcode{vcodec=mjpg}:standard{access=http{mime=multipart/x-mixed-replace;boundary=7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:9935/}'
The key here is the option "--play-and-exit" for cvlc, which causes it to exit whenever the relay stream goes down. With that in mind, all I had to do is place the command inside a while loop (bash), and it will always automatically reconnect.

It sounds like you're all using the front end for this, so maybe this isn't too much help. But I highly recommend using the command line interface whenever possible, because it makes custom behavior and workarounds so much easier to implement.

videolangeek
New Cone
New Cone
Posts: 2
Joined: 21 May 2020 14:30

Re: RTSP stream auto-reconnect?

Postby videolangeek » 28 Jul 2020 15:10

Since my last post this is what I have settled with a couple of methods when live streaming to youtube. Some things I want to point out. I have found a program called FFMPEG and this program is awesome. A VERY low cpu program so much that I am able to run a live streaming cam using a laptop from 2006! CPU utilization around 3 to 10 percent. Thus cutting out the usage of VideoLan and OBS with no frills...However if you are going to use OBS etc then I have found these programs add more "stuff" like overlays etc but scream the cpu where a I3,5 and up processor is needed.

Method one: If you are using a Windows machine you can enable Task Scheduler and have Windows manage the program and reconnect when it disconnects. I have a buddy that has this working great although I am still working on it to get it to work.

Method two: This is the method I use and is a bit more crude but does and is doing the job great! I use a Mouse Macro program to restart the ffmpeg program stream every hour regardless if it is working or not. Thereby if the cam goes down for whatever reason it will restart again within that hour on that timed hour. I record what I want the mouse to do and then it plays back every hour. Kinda fun seeing my mouse race around the screen and restart the program and then go to sleep until the next hour.

Ideally it would have been nice to have created my own code software program but I am not a programmer nor don't ever want to be so I hope these work arounds are helpful to those who just want this stuff to work and get on with life! ;-)

BloodBlight
New Cone
New Cone
Posts: 2
Joined: 24 Apr 2022 17:21

Re: RTSP stream auto-reconnect?

Postby BloodBlight » 24 Apr 2022 17:24

Was looking for a fix to this and I found one!

Open your stream, then save it as a play list. When you open the playlist, just be sure to select loop. Works perfectly! ^__^


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 9 guests