Only 2 out of 3 cameras at once

Forum for questions and support relating to the 1.34.x releases only.
Post Reply
Chimaera
Posts: 21
Joined: Mon Apr 15, 2019 8:13 pm

Only 2 out of 3 cameras at once

Post by Chimaera » Tue Feb 18, 2020 3:00 pm

I just upgraded to ZM 1.34.0 on Buster/Pi4. I did a fresh install because I felt like starting over. I have 3 identical cameras (Amcrest PTZ 2k) but I'm only monitoring the 640x480 streams and I've got them all set up in ZM using RTSP.

The problem is that at any time, only 2 of the 3 cameras will work. It doesn't matter *which* 2 are enabled, the 3rd will not come up. Below are the zmc and zma logs for the "broken" camera. I remember having this issue with 1.33.x but I cannot for the life of me remember how I solved it. /dev/shm is only 9% used, there's 2.8gb of ram free out of the 4gb and no swap is used. I'm sure this is a resource issue somewhere but I have no idea where.

Code: Select all

pi@astropi:/var/log/zm $ tail -f zmc_m3.log
02/18/20 09:53:27.324813 zmc_m3[4071].DB1-zm_ffmpeg_camera.cpp/364 [Calling avformat_open_input for rtsp://user:password@192.168.1.23:5541/cam/realmonitor?channel=1&subtype=1]
02/18/20 09:53:30.467474 zmc_m3[4071].DB1-zm_ffmpeg_camera.cpp/459 [Success finding decoder (h264_mmal)]
02/18/20 09:53:30.467605 zmc_m3[4071].DB1-zm_ffmpeg.cpp/335 [Dumping stream index i(0) index(0)]
02/18/20 09:53:30.467667 zmc_m3[4071].DB1-zm_ffmpeg.cpp/345 [    Stream #0:0]
02/18/20 09:53:30.467724 zmc_m3[4071].DB1-zm_ffmpeg.cpp/356 [frames:28, frame_size:0 stream timebase: 1/90000]
02/18/20 09:53:30.467865 zmc_m3[4071].DB1-zm_ffmpeg.cpp/359 [codec: h264]
02/18/20 09:53:30.467926 zmc_m3[4071].DB1-zm_ffmpeg.cpp/286 [10 fps]
02/18/20 09:53:30.467988 zmc_m3[4071].DB1-zm_ffmpeg.cpp/288 [90k stream tb numerator]
02/18/20 09:53:30.488719 zmc_m3[4071].ERR-zm_ffmpeg_camera.cpp/553 [Unable to open codec for video stream from rtsp://user:password@192.168.1.23:5541/cam/realmonitor?channel=1&subtype=1]
02/18/20 09:53:30.554953 zmc_m3[4071].ERR-zmc.cpp/257 [Failed to prime capture of initial monitor]
02/18/20 09:53:40.588199 zmc_m3[4071].INF-zm_ffmpeg_camera.cpp/201 [Priming capture from rtsp://user:password@192.168.1.23:5541/cam/realmonitor?channel=1&subtype=1]

Code: Select all

pi@astropi:/var/log/zm $ more zma_m3.log
02/18/20 09:50:46.182997 zma_m3[4082].DB1-zm_logger.cpp/255 [LogOpts: level=DB1 effective=DB1, screen=OFF, database=INF, logfile=DB9->/var/
log/zm/zma_m3.log, syslog=INF]
02/18/20 09:50:46.183215 zma_m3[4082].DB1-zm_utils.cpp/313 [Detected ARM (AArch32) processor with Neon]
02/18/20 09:50:46.187322 zma_m3[4082].DB1-zm_monitor.cpp/2096 [Capture Delay!? 0.000]
02/18/20 09:50:46.187404 zma_m3[4082].DB1-zm_monitor.cpp/2118 [Got 1 for v4l_captures_per_frame]
02/18/20 09:50:46.187653 zma_m3[4082].DB1-zm_monitor.cpp/423 [monitor purpose=2]
02/18/20 09:50:46.187704 zma_m3[4082].DB1-zm_monitor.cpp/437 [mem.size(4) SharedData=600 TriggerData=560 VideoStoreData=4120 timestamps=640
 images=80x1228800 = 98304000 total=98309984]
02/18/20 09:50:46.191811 zma_m3[4082].DB1-zm_storage.cpp/84 [Loaded Storage area 2 'Security']
02/18/20 09:50:46.191888 zma_m3[4082].DB1-zm_monitor.cpp/441 [Storage path: /Security]
02/18/20 09:50:46.191941 zma_m3[4082].DB1-zm_monitor.cpp/591 [Unable to map file /dev/shm/zm.mmap.3 (98309984 bytes) to locked memory, tryi
ng unlocked]
02/18/20 09:50:46.191977 zma_m3[4082].DB1-zm_monitor.cpp/594 [Mapped file /dev/shm/zm.mmap.3 (98309984 bytes) to unlocked memory]
02/18/20 09:50:46.192235 zma_m3[4082].DB1-zm_monitor.cpp/514 [Monitor Back Porch Low has function 3,
label format = '%N - %d/%m/%y %H:%M:%S', label X = 0, label Y = 0, label size = 1,
image buffer count = 80, warmup count = 5, pre-event count = 20, post-event count = 20, alarm frame count = 1,
fps report interval = 100, ref blend percentage = 6, alarm ref blend percentage = 6, track motion = 0]
02/18/20 09:50:46.192290 zma_m3[4082].DB1-zm_monitor.cpp/531 [Waiting for capture daemon last_write_index(80), last_write_time(0)]
02/18/20 09:50:47.192400 zma_m3[4082].DB1-zm_monitor.cpp/531 [Waiting for capture daemon last_write_index(80), last_write_time(0)]
02/18/20 09:50:48.192569 zma_m3[4082].DB1-zm_monitor.cpp/531 [Waiting for capture daemon last_write_index(80), last_write_time(0)]
02/18/20 09:50:49.192756 zma_m3[4082].DB1-zm_monitor.cpp/531 [Waiting for capture daemon last_write_index(80), last_write_time(0)]
02/18/20 09:50:50.192923 zma_m3[4082].DB1-zm_monitor.cpp/531 [Waiting for capture daemon last_write_index(80), last_write_time(0)]
02/18/20 09:50:51.193121 zma_m3[4082].DB1-zm_monitor.cpp/531 [Waiting for capture daemon last_write_index(80), last_write_time(0)]

User avatar
iconnor
Posts: 1325
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Only 2 out of 3 cameras at once

Post by iconnor » Tue Feb 18, 2020 9:59 pm

You are out of space in /dev/shm.

Adjust your buffers or increase it's size. (It defaults to half ram).

Beetleboy
Posts: 5
Joined: Tue Feb 18, 2020 10:24 pm

Re: Only 2 out of 3 cameras at once

Post by Beetleboy » Tue Feb 18, 2020 10:27 pm

Try increasing the video memory split in Rasbian using raspi-config. It defaults to 64 meg, and you will likely need at least 128 meg to run three cameras.

Chimaera
Posts: 21
Joined: Mon Apr 15, 2019 8:13 pm

Re: Only 2 out of 3 cameras at once

Post by Chimaera » Wed Feb 19, 2020 2:13 am

iconnor wrote:
Tue Feb 18, 2020 9:59 pm
You are out of space in /dev/shm.

Adjust your buffers or increase it's size. (It defaults to half ram).
/dev/shm is only 9% used as I said in the original post - even so I tried increasing it to 3g (75% of ram on the Pi4) and had the same thing. I restored my backup images of 1.33.14 and performed an upgrade and it works fine, so there's something different in a config that I can't find and it's going to drive me nuts!

Beetleboy
Posts: 5
Joined: Tue Feb 18, 2020 10:24 pm

Re: Only 2 out of 3 cameras at once

Post by Beetleboy » Wed Feb 19, 2020 2:43 am

The memory split I was referring to is not /dev/shm, the pi 4 with 4 gig has more than sufficient /dev/shm space as you have noted in your post. What does require adjusting on the raspberry pi, is the amount of memory allocated to the video system. I’m not sure why exactly, perhaps the hardware acceleration for video uses that memory. This setting is available through the raspi-config application, under advanced options/memory split. Increase the default of 64 meg to something like 128 or even 256 meg on the pi4. I have this running fine on a pi3 with 128 meg allocated for two Amcrest cameras running at 720p 6 frames a second. Without the increase I could only run one camera at a time. This is not specifically a ZM issue, it’s an issue with the raspberries running Raspian. Not sure if this is a problem if you run Ubuntu

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests