Can not view RTSP camera stream

Forum for questions and support relating to the 1.30.x releases only.
Locked
MinderOfZones
Posts: 8
Joined: Thu May 09, 2019 5:54 am

Can not view RTSP camera stream

Post by MinderOfZones »

Hey!

I installed Zoneminder on a Raspberry Pi following the Debian installation instructions on the Wiki.

I then added a camera that works over RTSP (verified address in VLC and it also works fine using Shinobi). The apache logs show a bunch of this error:

Code: Select all

ERR [socket_sendto( /var/run/zm/zms-434317s.sock ) failed: No such file or directory], referer: http://raspberrypi.local/zm/index.php?view=watch&mid=1
The following is the content of /etc/apache2/conf-enabled/zoneminder.conf:

Code: Select all

# Remember to enable cgi mod (i.e. "a2enmod cgi").
ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Require all granted
</Directory>

Alias /zm /usr/share/zoneminder/www
<Directory /usr/share/zoneminder/www>
  Options Indexes FollowSymLinks
  <IfModule mod_dir.c>
    DirectoryIndex index.php
  </IfModule>
</Directory>

<Directory /usr/share/zoneminder/www/api>
    AllowOverride All
</Directory>
And the web UI options have

Code: Select all

 PATH_ZMS	==>     /zm/cgi-bin/nph-zms
And the Zoneminder logs on the web interface show this error:

Code: Select all

2019-05-08 22:57:53.388780	zmdc		9301	INF	'zmc -m 1' crashed, signal 6	zmdc.pl	
2019-05-08 22:57:52.499410	zmdc		11475	INF	'zmc -m 1' started at 19/05/08 22:57:52	zmdc.pl	
2019-05-08 22:57:52.499410	zmdc		9301	INF	'zmc -m 1' starting at 19/05/08 22:57:52, pid = 11475	zmdc.pl	
2019-05-08 22:57:51.848950	zmwatch		9409	INF	Restarting capture daemon for Bullet, shared data not valid	zmwatch.pl	
2019-05-08 22:57:42.768230	zmdc		9301	INF	'zmc -m 1' crashed, signal 6	zmdc.pl	
2019-05-08 22:57:41.814950	zmdc		11425	INF	'zmc -m 1' started at 19/05/08 22:57:41	zmdc.pl	
2019-05-08 22:57:41.808520	zmdc		9301	INF	'zmc -m 1' starting at 19/05/08 22:57:41, pid = 11425	zmdc.pl	
2019-05-08 22:57:40.994200	zmwatch		9409	INF	Restarting capture daemon for Bullet, shared data not valid	zmwatch.pl
I enabled enhanced debugging for _zmc_m1, which creates a bunch of empty log files and only this one that has content:

Code: Select all

05/08/19 22:50:09.824037 zmc_m1[9345].DB1-zm_logger.cpp/234 [LogOpts: level=DB9/DB9, screen=OFF, database=INF, logfile=DB9->/var/log/zm/zm_debug.log.09345, syslog=INF]
05/08/19 22:50:09.824231 zmc_m1[9345].DB1-zm_utils.cpp/279 [Detected a non x86\x86-64 processor]
05/08/19 22:50:09.836801 zmc_m1[9345].DB4-zm_db.cpp/89 [Success running query: select Id, Name, ServerId, Type, Function+0, Enabled, LinkedMonitors, Device, Channel, Format, V4LMultiBuffer, V4LCapturesPerFrame, Protocol, Method, Host, Port, Path, Options, User, Pass, Width, Height, Colours, Palette, Orientation+0, Deinterlacing, RTSPDescribe, Brightness, Contrast, Hue, Colour, EventPrefix, LabelFormat, LabelX, LabelY, LabelSize, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, StreamReplayBuffer, AlarmFrameCount, SectionLength, FrameSkip, MotionFrameSkip, AnalysisFPS, AnalysisUpdateDelay, MaxFPS, AlarmMaxFPS, FPSReportInterval, RefBlendPerc, AlarmRefBlendPerc, TrackMotion, SignalCheckColour, Exif from Monitors where Id = 1]
05/08/19 22:50:09.836938 zmc_m1[9345].DB1-zm_monitor.cpp/2726 [Got 1 for v4l_captures_per_frame]
05/08/19 22:50:09.837076 zmc_m1[9345].DB2-zm_camera.cpp/39 [New camera id: 1 width: 3840 height: 2160 colours: 3 subpixelorder: 6 capture: 1]
05/08/19 22:50:09.838052 zmc_m1[9345].DB2-zm_image.cpp/179 [Blend: Using fast blend function]
05/08/19 22:50:09.838158 zmc_m1[9345].DB2-zm_image.cpp/237 [Delta: Using standard delta functions]
05/08/19 22:50:09.838180 zmc_m1[9345].DB2-zm_image.cpp/263 [Deinterlace: Using standard delta functions]
05/08/19 22:50:09.838199 zmc_m1[9345].DB2-zm_image.cpp/272 [Image buffer copy: Using standard memcpy]
05/08/19 22:50:09.838219 zmc_m1[9345].DB3-zm_image.cpp/276 [Setting up static colour tables]
05/08/19 22:50:09.838330 zmc_m1[9345].DB1-zm_monitor.cpp/390 [monitor purpose=1]
05/08/19 22:50:09.838357 zmc_m1[9345].DB1-zm_monitor.cpp/398 [mem.size=1244161360]
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Can not view RTSP camera stream

Post by bbunge »

If I remember from my testing the Pi ffmpeg does not work. Try remote.
MinderOfZones
Posts: 8
Joined: Thu May 09, 2019 5:54 am

Re: Can not view RTSP camera stream

Post by MinderOfZones »

That also doesn't seem to work, I get similar error messages when doing that:

Code: Select all

2019-05-11 23:01:12.638250	zmdc		12822	INF	'zmc -m 1' crashed, signal 6	zmdc.pl	
2019-05-11 23:01:11.665982	web_js		13017	ERR	getStreamCmdResponse stream error: socket_sendto( /var/run/zm/zms-927073s.sock ) failed: No such file or directory - checkStreamForErrors()	?view=watch	
2019-05-11 23:01:11.411880	web_php		13021	ERR	socket_sendto( /var/run/zm/zms-927073s.sock ) failed: No such file or directory	/usr/share/zoneminder/www/includes/functions.php	1993
2019-05-11 23:01:10.493380	zmdc		12822	INF	'zmc -m 1' starting at 19/05/11 23:01:10, pid = 13074	zmdc.pl	
2019-05-11 23:01:10.493380	zmdc		13074	INF	'zmc -m 1' started at 19/05/11 23:01:10	zmdc.pl	
2019-05-11 23:01:09.153610	zmwatch		12947	INF	Restarting capture daemon for Bullet, shared data not valid	zmwatch.pl	
2019-05-11 23:00:56.732618	web_js		13017	ERR	getStreamCmdResponse stream error: socket_sendto( /var/run/zm/zms-927073s.sock ) failed: No such file or directory - checkStreamForErrors()	?view=watch	
2019-05-11 23:00:56.474595	web_php		12202	ERR	socket_sendto( /var/run/zm/zms-927073s.sock ) failed: No such file or directory	/usr/share/zoneminder/www/includes/functions.php	1993
2019-05-11 23:00:53.673788	zms		13018	INF	Got signal 15 (Terminated), exiting	zm_signal.cpp	40
2019-05-11 23:00:53.566999	web_php		11842	ERR	socket_sendto( /var/run/zm/zms-986832s.sock ) failed: No such file or directory	/usr/share/zoneminder/www/includes/functions.php	1993
2019-05-11 23:00:53.308490	zmdc		12822	INF	'zmc -m 1' exited, signal 14	zmdc.pl	
2019-05-11 23:00:53.262490	zmdc		12822	INF	'zmc -m 1' sending stop to pid 13006 at 19/05/11 23:00:53	zmdc.pl	
2019-05-11 23:00:51.907728	web_php		12687	ERR	socket_bind( /var/run/zm/zms-986832w.sock ) failed: Address already in use	/usr/share/zoneminder/www/includes/functions.php	1993
2019-05-11 23:00:42.401930	zmdc		13006	INF	'zmc -m 1' started at 19/05/11 23:00:36	zmdc.pl	
2019-05-11 23:00:42.401910	zmwatch		12947	INF	Restarting capture daemon for Bullet, shared data not valid	zmwatch.pl	
2019-05-11 23:00:42.401910	zmdc		12822	INF	'zmc -m 1' starting at 19/05/11 23:00:36, pid = 13006	zmdc.pl	
2019-05-11 23:00:04.034030	zmdc		12822	INF	Starting pending process, zmc -m 1	zmdc.pl	
2019-05-11 22:59:54.970300	zmdc		12822	INF	'zmc -m 1' crashed, signal 6	zmdc.pl	
2019-05-11 22:59:54.281430	zmc_m1		12958	WAR	Discarding frame 0	zm_rtp_source.cpp	349
2019-05-11 22:59:54.264803	zmc_m1		12958	WAR	Sequence in probation 2, out of sequence	zm_rtp_source.cpp	112
2019-05-11 22:59:53.354480	zmdc		12961	INF	'zmtelemetry.pl' started at 19/05/11 22:59:53	zmdc.pl	
2019-05-11 22:59:53.353260	zmdc		12822	INF	'zmtelemetry.pl' starting at 19/05/11 22:59:53, pid = 12961	zmdc.pl	
2019-05-11 22:59:52.982750	zmwatch		12947	INF	Watchdog pausing for 30 seconds	zmwatch.pl	
2019-05-11 22:59:52.953040	zmwatch		12947	INF	Watchdog starting	zmwatch.pl	
2019-05-11 22:59:52.205190	zmdc		12947	INF	'zmwatch.pl' started at 19/05/11 22:59:52	zmdc.pl	
2019-05-11 22:59:52.205140	zmdc		12822	INF	'zmwatch.pl' starting at 19/05/11 22:59:52, pid = 12947	zmdc.pl	
2019-05-11 22:59:51.333490	zmdc		12942	INF	'zmc -m 1' started at 19/05/11 22:59:51	zmdc.pl	
2019-05-11 22:59:51.333450	zmdc		12822	INF	'zmc -m 1' starting at 19/05/11 22:59:51, pid = 12942	zmdc.pl	
2019-05-11 22:59:51.076900	zmdc		12822	INF	Starting pending process, zmc -m 1	zmdc.pl	
2019-05-11 22:59:44.405250	zmdc		12822	INF	'zmc -m 1' crashed, signal 6	zmdc.pl	
2019-05-11 22:59:42.827600	zmfilter		12894	INF	Scanning for events	zmfilter.pl	
2019-05-11 22:59:39.228180	zmdc		12907	INF	'zmaudit.pl -c' started at 19/05/11 22:59:39	zmdc.pl	
2019-05-11 22:59:39.001030	zmdc		12822	INF	'zmaudit.pl -c' starting at 19/05/11 22:59:39, pid = 12907	zmdc.pl	
2019-05-11 22:59:28.150320	zmdc		12894	INF	'zmfilter.pl' started at 19/05/11 22:59:28	zmdc.pl	
2019-05-11 22:59:28.143970	zmdc		12822	INF	'zmfilter.pl' starting at 19/05/11 22:59:28, pid = 12894	zmdc.pl	
2019-05-11 22:59:27.741100	zmdc		12822	INF	'zmc -m 1' starting at 19/05/11 22:59:27, pid = 12892	zmdc.pl	
2019-05-11 22:59:27.738020	zmdc		12892	INF	'zmc -m 1' started at 19/05/11 22:59:27	zmdc.pl	
2019-05-11 22:59:27.718420	zmdc		12822	INF	Starting pending process, zmc -m 1	zmdc.pl	
2019-05-11 22:59:27.707660	zmdc		12822	ERR	'zmc -m 1' exited abnormally, exit status 255	zmdc.pl	
2019-05-11 22:59:26.997800	zmdc		12822	INF	'zmc -m 1' starting at 19/05/11 22:59:26, pid = 12880	zmdc.pl	
2019-05-11 22:59:26.981730	zmdc		12880	INF	'zmc -m 1' started at 19/05/11 22:59:26	zmdc.pl	
2019-05-11 22:59:26.201360	zmpkg		12778	INF	Single server configuration detected. Starting up services.	zmpkg.pl	
2019-05-11 22:59:23.138310	zmdc		12822	INF	Server starting at 19/05/11 22:59:23	zmdc.pl	
2019-05-11 22:59:21.556040	zmpkg		12778	INF	Command: start	zmpkg.pl	
2019-05-11 22:59:21.545830	zmpkg		12778	INF	Sanity checking States table...	zmpkg.pl	
2019-05-11 22:59:20.910200	zmsystemctl		12771	INF	Redirecting command through systemctl	zmsystemctl.pl	
2019-05-11 22:59:20.020420	zmpkg		12764	INF	Command: start	zmpkg.pl	
2019-05-11 22:59:19.993580	zmpkg		12764	INF	Sanity checking States table...	zmpkg.pl
MinderOfZones
Posts: 8
Joined: Thu May 09, 2019 5:54 am

Re: Can not view RTSP camera stream

Post by MinderOfZones »

The most interesting part to me is this one:

Code: Select all

Restarting capture daemon for Bullet, shared data not valid
But not sure what to do with it.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Can not view RTSP camera stream

Post by bbunge »

I was wrong. Ffmpeg does work on a Pi.

I used these instructions: https://wiki.zoneminder.com/Debian_9_64 ... der_1.30.4

Actually ended up with ZM 1.30.0.

Make sure you are using the right resolution in Zoneminder. Some cameras do not output the same resolution they claim. Camera resolution in Zoneminder does not match camera output. Use VLC (Tools, Media Information, Codec) to check camera Display Resolution.
User avatar
snake
Posts: 337
Joined: Sat May 21, 2016 2:20 am

Re: Can not view RTSP camera stream

Post by snake »

It's possible to get 1.30.4 in ZM RPI if you use the official Debian (arm) apt repository. Raspbian only has 1.30.0 in their repos. If you have to ask how this is done, you probably shouldn't bother (there are potential issues with mixing repos). Just use 1.30.0

Try LibVLC? Although I'm not sure if LibVLC is usable on ARM. It may or may not be. Search the forums for instructions to install LibVLC if it isn't an option.
MinderOfZones
Posts: 8
Joined: Thu May 09, 2019 5:54 am

Re: Can not view RTSP camera stream

Post by MinderOfZones »

I am using v1.30.0, is there any particular fix in 1.30.4 that could help?

@bbunge, I took a look at VLC and it is in-line with the size information I am using (obviously using correct username and password, just replaced with ?? for screenshot):

Image
Image
Image

Will give LibVLC a try.
MinderOfZones
Posts: 8
Joined: Thu May 09, 2019 5:54 am

Re: Can not view RTSP camera stream

Post by MinderOfZones »

Also tried libvlc, got similar errors:

Code: Select all

2019-05-12 12:57:43.362500	zmdc		2688	INF	'zmc -m 1' crashed, signal 6	zmdc.pl	
2019-05-12 12:57:41.791512	web_js		1241	ERR	getStreamCmdResponse stream error: socket_sendto( /var/run/zm/zms-539516s.sock ) failed: No such file or directory - checkStreamForErrors()	?view=watch	
2019-05-12 12:57:41.679189	web_php		914	ERR	socket_sendto( /var/run/zm/zms-539516s.sock ) failed: No such file or directory	/usr/share/zoneminder/www/includes/functions.php	1993
2019-05-12 12:57:39.221130	zmdc		2833	INF	'zmc -m 1' started at 19/05/12 12:57:39	zmdc.pl	
2019-05-12 12:57:39.221120	zmdc		2688	INF	'zmc -m 1' starting at 19/05/12 12:57:39, pid = 2833	zmdc.pl	
2019-05-12 12:57:37.920480	zmdc		2688	INF	Starting pending process, zmc -m 1	zmdc.pl	
2019-05-12 12:57:23.992690	zmdc		2688	INF	'zmc -m 1' crashed, signal 6	zmdc.pl
Image
Image
MinderOfZones
Posts: 8
Joined: Thu May 09, 2019 5:54 am

Re: Can not view RTSP camera stream

Post by MinderOfZones »

It looks like /dev/shm gets filled up to 100% within just a minute, maybe that's the reason? Any way to reduce usage?

Code: Select all

tmpfs           464M  464M     0 100% /dev/shm
User avatar
snake
Posts: 337
Joined: Sat May 21, 2016 2:20 am

Re: Can not view RTSP camera stream

Post by snake »

4K on a raspberry pi 3, I don't think is ever going to be possible. Unless you slow down the frame rate dramatically (probably <1FPS).

I've done some benchmarking (link: viewtopic.php?f=6&t=27938)

You will need to lower the resolution at the camera or use a lower resolution sub stream.

There just isn't enough processing grunt and or RAM.
MinderOfZones
Posts: 8
Joined: Thu May 09, 2019 5:54 am

Re: Can not view RTSP camera stream

Post by MinderOfZones »

Works fine with Shinobi, is there something that makes zoneminder more resource intensive? I'm not even recording yet, just monitor mode.
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Can not view RTSP camera stream

Post by bbunge »

MinderOfZones wrote: Sun May 12, 2019 8:04 pm It looks like /dev/shm gets filled up to 100% within just a minute, maybe that's the reason? Any way to reduce usage?

Code: Select all

tmpfs           464M  464M     0 100% /dev/shm
halve the resolution till it works. try 1740x1080 then 870x540
MinderOfZones
Posts: 8
Joined: Thu May 09, 2019 5:54 am

Re: Can not view RTSP camera stream

Post by MinderOfZones »

I don't want to reduce the resolution as that makes it hard to read license plates.

1) Do I have to use /dev/shm or is it fine to use a regular folder?
2) Is there a way to crop an area of the original stream instead of lowering the resolution of the full stream? There is a fairly small area in the original stream I want to capture license plates from, so cropping would be a great solution.
Locked