Page 1 of 2

libvlc rtsp stream quits working after 24+ hours

Posted: Wed Jun 10, 2015 12:43 pm
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.

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Wed Jun 10, 2015 7:26 pm
by bbunge
Seems to be a problem with libvlc. Try FFMPEG source type with the same source path settings.

Bill

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Thu Jun 11, 2015 11:51 am
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.

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Thu Jun 11, 2015 6:35 pm
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.

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Sat Jun 13, 2015 6:37 am
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.

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Sun Jun 14, 2015 11:37 am
by bbunge
Also force TCP with the entry ?tcp at the end of your source line.

bb

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Mon Jun 15, 2015 12:27 pm
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.

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Tue Jun 16, 2015 9:40 am
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.

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Tue Jun 16, 2015 11:17 am
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?

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Tue Jun 16, 2015 4:34 pm
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.

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Tue Jun 16, 2015 10:20 pm
by ofca
Yes, this bug report pretty much covers it, so fixing that one should also help us :)

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Fri Jun 19, 2015 5:53 am
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.

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Mon Jun 22, 2015 12:28 pm
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.

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Thu Jun 25, 2015 3:30 pm
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.

Re: libvlc rtsp stream quits working after 24+ hours

Posted: Wed Jul 01, 2015 5:43 am
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