libvlc rtsp stream quits working after 24+ hours

Forum for questions and support relating to the 1.28.x releases only.
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

libvlc rtsp stream quits working after 24+ hours

Post by theforce »

Running zoneminder 1.28 on ubuntu 14.04.

I got a new cheap camera that only supports rtsp streams. No mjpeg >:(. I got it working with libvlc with no image smearing but after 24-30 hours I get no image in zoneminder and when I pull a jpg image from the zomeninder stream its black. If I click on the IP to get the setting and just hit save button the image reappears.

Restarting the camera does not fix the issue. The camera seems to work fine and I get an image from VLC during this blackout.

Camera settings in zoneminder.
Source type - Libvlc
source path - rtsp://IP:554/user=admin&password=&channel=1&stream=0.sdp?
Remote Method - RTS/RTSP
No options

I've looked at the logs during this blackout and there is nothing there for this camera during this time. Its like everything is working except its just not getting an image and not complaining.

Is there some kind of setting that I can change to get this more stable? Is this and issue with libvlc?

Worst case I guess I could make a script run a midnight to disable and enable the camera.

This is not a big issue as I'm only using this to see what my cockatiel does during the day and see how well she sleeps at night but its kind of annoying finding out that it did not capture anything during the night.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: libvlc rtsp stream quits working after 24+ hours

Post by bbunge »

Seems to be a problem with libvlc. Try FFMPEG source type with the same source path settings.

Bill
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

Re: libvlc rtsp stream quits working after 24+ hours

Post by theforce »

I get major smearing with ffmpeg. When using just Remote as a source I get lots of rtsp errors and the connection is unstable.
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

Re: libvlc rtsp stream quits working after 24+ hours

Post by theforce »

I'm sure its happening at the 30 hour mark give or take a few as I predected it would happen again today at around 14:00 and it did.

I'm going to run a script ever night a midnight that changes the run state of the camera to monitor then to modect. Manually doing this corrected the camera so I'm thinking a cron job ran once ever 24 hours will "fix" the issue.
User avatar
gnocera
Posts: 34
Joined: Thu Jun 04, 2015 6:31 pm

Re: libvlc rtsp stream quits working after 24+ hours

Post by gnocera »

Hello,

Try ffmpeg again and if your camera is HD resolution (720x1280), check please that you have zoneminder running on high bandwidth.

Also try to reduce the frame rate to maybe 8-10fps, I do not know how is your network topology but you have to be sure you do not have bottle necks on you network.

Regards.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: libvlc rtsp stream quits working after 24+ hours

Post by bbunge »

Also force TCP with the entry ?tcp at the end of your source line.

bb
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

Re: libvlc rtsp stream quits working after 24+ hours

Post by theforce »

I'm at about 50% bandwidth on a gigabit connection.

Forcing TCP did not help with smearing with ffmpeg or slower frame rate from the camera. Going to see what it does with libvlc if anything.

After trying to reinitialize the connection with a script at midnight the connection still goes blank but today it was after about 7-8 hours. So I don't know what to do besides junk this camera and buy something that supports mjpeg.

I might see if I can use VLC to restream the camera and see what that does. Never streamed from VLC to Zoneminder so I'll have to figure that URL path out.
ofca
Posts: 7
Joined: Sat Apr 16, 2011 10:20 pm

Re: libvlc rtsp stream quits working after 24+ hours

Post by ofca »

The same thing happens to me. Stream just dies and doesn't come back until going to settings and hitting save. I won't even start on 'use ffmpeg' answers. Hopefully one of the devs will look into this. I'm happy to help with some debuging, since it happens pretty consistently.
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

Re: libvlc rtsp stream quits working after 24+ hours

Post by theforce »

Well at least I'm not the only one. :) Does yours always quit after about 30 hours or a set number of hours?
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: libvlc rtsp stream quits working after 24+ hours

Post by SteveGilvarry »

https://github.com/ZoneMinder/ZoneMinder/issues/383 Sounds similar to this, like zm is losing connection to the camera and doesn't come back, editing or stopping and starting monitor brings it back. Could test it by severing link between camera and zm, if camera is POE try and leave it powered to simulate a temporary break in link only for ZM. Not saying your networks have issues, but something causes zm to lose the stream and never comes back.
Some cameras from China have an auto reboot option often set to midnight, so that might be when the stream is lost.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
ofca
Posts: 7
Joined: Sat Apr 16, 2011 10:20 pm

Re: libvlc rtsp stream quits working after 24+ hours

Post by ofca »

Yes, this bug report pretty much covers it, so fixing that one should also help us :)
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: libvlc rtsp stream quits working after 24+ hours

Post by SteveGilvarry »

Any chance you can test if network loss causes the behaviour? I am not sure if my camera works with libvlc and I gave up on playing with libvlc in code as it wouldn't do what I wanted.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

Re: libvlc rtsp stream quits working after 24+ hours

Post by theforce »

Network loss does not cause this issue. I removed it from the network and put it back on and zoneminder picked it back up just fine. Power loss does cause this issue. Zoneminder will not reestablish the connection after the camera looses power.

I fired up a windows VM and used IE to see what the settings were. It did have an option enabled to reboot the camera ever Tuesday at 1AM. This does not explain why I get this problem every 30 hours unless there is a bug in camera. I disabled this option Sunday so I should find out in the next 48 hours if this resolved the issue.

Since it could be a power related issue I also put the camera on a UPS. I should know by the end of the week if its the camera or libvlc as the source of the issue.
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

Re: libvlc rtsp stream quits working after 24+ hours

Post by theforce »

OK so after a few days and no issues I'm going to take my camera off of my ups and hook it back up the way it was. This should tell me if the camera might be getting a brown out and doing a power cycle. Still does not explain the 30 hours though unless it was a bug in the camera firmware.

The issue SteveGilvarry posted seems to be the issue with power cycling of the camera. Hope that gets fixed soon.
river100
Posts: 145
Joined: Sun Oct 07, 2007 5:52 pm
Location: Louisiana

Re: libvlc rtsp stream quits working after 24+ hours

Post by river100 »

I put one Dahua on libvlc and it did the same thing. stopped streaming. 5 other cams on same network, same server with ffmpeg did not
stop. I use libvlc on some grand stream encoders since ffmpeg wouldn't work with them and they have been going strong for a month.
14.04 / 32bit. ZM vers 1.28.1
Locked