Adding multiple monitors breaks zma/zmc

Forum for questions and support relating to the 1.24.x releases only.
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Adding multiple monitors breaks zma/zmc

Post by kevin_robson » Tue Jan 19, 2010 8:06 pm

I have a single BT848 card. In 1.23 versions of ZM I have a setup whereby I set up two monitors both using the same camera input. One is set up for best sensitivity so I get minimal events, the other has less sensitivity to I get lots of events but only bother to look at them if something shows on the other one.
Hope this makes sense. As I said this works fine with 1.23.

On 1.24.2 (fedora 12) I can install one monitor and all is working fine. If I add another monitor for the same source, it breaks. ZM shows a black screen, and I get errors in my logs. The errors below occur as I enable the second monitor. Input settings are the same as the first one.

It does this whether I use v4l1 or v4l2. The only video I have in /dev is /dev/video.
This is a real showstopper for me - I need to be able to have two monitors running off the same input, as per the earlier versions of zm.

Shared memory has been set to :
# Kernel modifications for ZM
kernel.shmall = 256000000
kernel.shmmax = 256000000


Let me know what other info you need.
Thanks in advance

Code: Select all

[root@fedorasrv tmp]# tail -f zm*.log                                   
==> zmaudit.log <==                                                  

==> zmdc.log <==

==> zmfilter.log <==

==> zmpkg.log <==

==> zmupdate.log <==

==> zmvideo.log <==

==> zmwatch.log <==

==> zmpkg.log <==
01/19/10 19:52:44.958343 zmpkg[7019].INF [Command: start]

==> zmdc.log <==
01/19/10 19:52:45.351905 zmdc[7031].INF [Server starting at 10/01/19 19:52:45]
01/19/10 19:52:48.549552 zmdc[7031].INF ['zmc -d /dev/video0' starting at 10/01/19 19:52:48, pid = 7054]
01/19/10 19:52:48.786328 zmdc[7031].INF ['zma -m 1' starting at 10/01/19 19:52:48, pid = 7058]          
01/19/10 19:52:49.021279 zmdc[7031].INF ['zmfilter.pl' starting at 10/01/19 19:52:49, pid = 7062]       
01/19/10 19:52:49.252104 zmdc[7031].INF ['zmaudit.pl -c' starting at 10/01/19 19:52:49, pid = 7066]     

==> zmfilter.log <==
01/19/10 19:52:49.470259 zmfilter[7062].INF [Scanning for events]

==> zmdc.log <==
01/19/10 19:52:49.648924 zmdc[7031].INF ['zmwatch.pl' starting at 10/01/19 19:52:49, pid = 7072]
01/19/10 19:52:49.850400 zmdc[7031].INF ['zmupdate.pl -c' starting at 10/01/19 19:52:49, pid = 7076]

==> zmwatch.log <==
01/19/10 19:52:49.880983 zmwatch[7072].INF [Watchdog starting]
01/19/10 19:52:49.888016 zmwatch[7072].INF [Watchdog pausing for 30 seconds]

==> zmdc.log <==
01/19/10 19:53:16.642630 zmdc[7031].INF ['zmc -d /dev/video0' stopping at 10/01/19 19:53:16]
01/19/10 19:53:16.682354 zmdc[7031].INF ['zmc -d /dev/video0' exited normally]              
01/19/10 19:53:16.883782 zmdc[7031].INF ['zmc -d /dev/video0' starting at 10/01/19 19:53:16, pid = 7101]
01/19/10 19:53:17.096586 zmdc[7031].INF ['zma -m 2' starting at 10/01/19 19:53:17, pid = 7106]          
01/19/10 19:53:17.140997 zmdc[7031].ERR ['zmc -d /dev/video0' exited abnormally, exit status 255]       
01/19/10 19:53:17.141348 zmdc[7031].ERR ['zma -m 2' exited abnormally, exit status 255]                 
01/19/10 19:53:17.141603 zmdc[7031].INF [Starting pending process, zmc -d /dev/video0]                  
01/19/10 19:53:17.151072 zmdc[7031].INF ['zmc -d /dev/video0' starting at 10/01/19 19:53:17, pid = 7110]
01/19/10 19:53:17.151511 zmdc[7031].INF [Starting pending process, zma -m 2]                            
01/19/10 19:53:17.160202 zmdc[7031].INF ['zma -m 2' starting at 10/01/19 19:53:17, pid = 7112]          
01/19/10 19:53:17.185645 zmdc[7031].ERR ['zma -m 2' exited abnormally, exit status 255]                 
01/19/10 19:53:17.431186 zmdc[7031].ERR ['zmc -d /dev/video0' exited abnormally, exit status 255]       

==> zmwatch.log <==
01/19/10 19:53:19.891335 zmwatch[7072].ERR [Can't get shared memory id '7a6d0002', 2: No such file or directory]
01/19/10 19:53:19.892512 zmwatch[7072].ERR [Can't get shared memory id '7a6d0002', 2: No such file or directory]

==> zmdc.log <==
01/19/10 19:53:22.042061 zmdc[7031].INF [Starting pending process, zmc -d /dev/video0]
01/19/10 19:53:22.049960 zmdc[7031].INF ['zmc -d /dev/video0' starting at 10/01/19 19:53:22, pid = 7126]
01/19/10 19:53:22.050698 zmdc[7031].INF [Starting pending process, zma -m 2]
01/19/10 19:53:22.060696 zmdc[7031].INF ['zma -m 2' starting at 10/01/19 19:53:22, pid = 7127]
01/19/10 19:53:22.090947 zmdc[7031].ERR ['zma -m 2' exited abnormally, exit status 255]
01/19/10 19:53:22.290456 zmdc[7031].ERR ['zmc -d /dev/video0' exited abnormally, exit status 255]

==> zmwatch.log <==
01/19/10 19:53:29.894627 zmwatch[7072].ERR [Can't get shared memory id '7a6d0002', 2: No such file or directory]
01/19/10 19:53:29.901028 zmwatch[7072].ERR [Can't get shared memory id '7a6d0002', 2: No such file or directory]

==> zmdc.log <==
01/19/10 19:53:32.005290 zmdc[7031].INF [Starting pending process, zmc -d /dev/video0]
01/19/10 19:53:32.012895 zmdc[7031].INF ['zmc -d /dev/video0' starting at 10/01/19 19:53:32, pid = 7130]
01/19/10 19:53:32.013561 zmdc[7031].INF [Starting pending process, zma -m 2]
01/19/10 19:53:32.020162 zmdc[7031].INF ['zma -m 2' starting at 10/01/19 19:53:32, pid = 7131]
01/19/10 19:53:32.034862 zmdc[7031].ERR ['zma -m 2' exited abnormally, exit status 255]
01/19/10 19:53:32.253538 zmdc[7031].ERR ['zmc -d /dev/video0' exited abnormally, exit status 255]
Output of /usr/local/bin/zmu -d /dev/video0 -q -v

Code: Select all

/usr/local/bin/zmu -d /dev/video0  -q -v 
Video Device: /dev/video0                                 
General Capabilities                                      
  Driver: bttv                                            
  Card: BT878 video (GrandTec Multi Cap                   
  Bus: PCI:0000:04:02.0                                   
  Version: 0.9.18                                         
  Type: 0x5000015                                         
    Supports video capture (X)                            
    Does not support video output                         
    Supports frame buffer overlay                         
    Supports VBI capture                                  
    Does not support VBI output                           
    Does not support sliced VBI capture                   
    Does not support sliced VBI output                    
    Does not support video output overlay                 
    Does not have tuner                                   
    Does not have audio in and/or out                     
    Does not have radio                                   
    Supports read/write i/o (X)                           
    Does not support async i/o                            
    Supports streaming i/o (X)                            
    Standards:                                            
      NTSC                                                
      NTSC-M                                              
      NTSC-M-JP                                           
      NTSC-M-KR                                           
      PAL                                                 
      PAL-BG                                              
      PAL-H                                               
      PAL-I                                               
      PAL-DK                                              
      PAL-M                                               
      PAL-N                                               
      PAL-Nc                                              
      PAL-60                                              
      SECAM                                               
      SECAM-B                                             
      SECAM-G                                             
      SECAM-H                                             
      SECAM-DK                                            
      SECAM-L                                             
      SECAM-Lc                                            
  Formats:                                                
    8 bpp, gray (GREY)                                    
    8 bpp, dithered color (HI24)                          
    15 bpp RGB, le (RGBO)                                 
    15 bpp RGB, be (RGBQ)                                 
    16 bpp RGB, le (RGBP)                                 
    16 bpp RGB, be (RGBR)                                 
    24 bpp RGB, le (BGR3)                                 
    32 bpp RGB, le (BGR4)                                 
    32 bpp RGB, be (RGB4)                                 
    4:2:2, packed, YUYV (YUYV)                            
    4:2:2, packed, YUYV (YUYV)                            
    4:2:2, packed, UYVY (UYVY)                            
    4:2:2, planar, Y-Cb-Cr (422P)                         
    4:2:0, planar, Y-Cb-Cr (YU12)                         
    4:2:0, planar, Y-Cr-Cb (YV12)                         
    4:1:1, planar, Y-Cb-Cr (411P)                         
    4:1:0, planar, Y-Cb-Cr (YUV9)                         
    4:1:0, planar, Y-Cr-Cb (YVU9)                         
Crop Capabilities                                         
  Bounds: 1063 x 608                                      
  Default: 924 x 576                                      
  Current: 924 x 576                                      
Inputs: 4                                                 
  Input 0                                                 
    Name: Composite0                                      
    Type: Camera                                          
    Audioset: 00000001                                    
    Standards: 0xffbfff                                   
    Power on  (X)                                         
    Signal detected  (X)                                  
    Colour Signal detected                                
    Horizontal Lock detected                              
  Input 1                                                 
    Name: Composite1                                      
    Type: Camera                                          
    Audioset: 00000001                                    
    Standards: 0xffbfff                                   
    Power on  (X)                                         
    Signal detected  (X)                                  
    Colour Signal detected                                
    Horizontal Lock detected                              
  Input 2
    Name: Composite2
    Type: Camera
    Audioset: 00000001
    Standards: 0xffbfff
    Power on  (X)
    Signal detected  (X)
    Colour Signal detected
    Horizontal Lock detected
  Input 3
    Name: Composite3
    Type: Camera
    Audioset: 00000001
    Standards: 0xffbfff
    Power on  (X)
    Signal detected  (X)
    Colour Signal detected
    Horizontal Lock detected


kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson » Tue Jan 19, 2010 8:29 pm

I have also run with debug level 5, but it generates pretty large files. If anyone wants these I can email them. I've tried to extract what error messages I can - note I started the second monitor at exactly 20:20

Code: Select all

01/19/10 20:20:00.614189 zmc_dvideo0[7667].DB3-zm_local_camera.cpp/1879 [Assigning image]
01/19/10 20:20:00.614725 zmc_dvideo0[7667].DB2-zm_local_camera.cpp/1887 [Post-capturing]
01/19/10 20:20:00.614753 zmc_dvideo0[7667].DB3-zm_local_camera.cpp/1911 [Requeueing buffer 0]
01/19/10 20:20:00.614817 zmc_dvideo0[7667].ERR-zm_local_camera.cpp/1914 [Unable to requeue buffer 0: Invalid argument]
01/19/10 20:20:00.614883 zmc_dvideo0[7667].ERR-zmc.cpp/268 [Failed to post-capture monitor 2 (1/2)]
01/19/10 20:20:00.614927 zmc_dvideo0[7667].DB3-zm_local_camera.cpp/699 [Terminating video stream]
01/19/10 20:20:00.653495 zmc_dvideo0[7667].DB3-zm_local_camera.cpp/705 [Unmapping video buffers]


01/19/10 20:20:09.209812 zms[7692].DB3-zm_stream.cpp/144 [Send image width = 384, height = 288]
01/19/10 20:20:09.209821 zms[7692].DB3-zm_stream.cpp/147 [Last send image width = 384, height = 288]
01/19/10 20:20:09.209830 zms[7692].DB3-zm_stream.cpp/165 [Real image width = 384, height = 288]
01/19/10 20:20:09.214351 zms[7692].WAR-zm_monitor.cpp/3565 [Unable to store frame as shared memory invalid]
01/19/10 20:20:19.717892 zms[7692].ERR-zm_monitor.cpp/3580 [Terminating, last frame sent time 10.008121 secs more than maximum of 10.000000]
01/19/10 20:20:19.717992 zms[7692].DB1-zm_monitor.cpp/3589 [Cleaning swap files from /tmp/zmswap-m1/zmswap-q573369]
01/19/10 20:20:19.718126 zms[7692].DB1-zm_monitor.cpp/3617 [Can't glob '/tmp/zmswap-m1/zmswap-q573369/*.*': 3]

01/19/10 20:20:00.839326 zma_m2[7672].DB1-zm_zone.cpp/51 [Initialised zone 5/All - 1 - 384x288 - Rgb:ff0000, CM:3, MnAT:25, MxAT:0, MnAP:3317, MxAP:82944, FB:3x3, MnFP:3317, MxFP:82944, MnBS:2211, MxBS:0, MnB:1, MxB:0, OF: 0]
01/19/10 20:20:00.876372 zma_m2[7672].DB4-zm_monitor.cpp/1056 [RI:40, WI: 0, PF = 0, RM = 40, Step = 1]
01/19/10 20:20:05.262260 zma_m2[7672].DB4-zm_monitor.cpp/1056 [RI:40, WI: 0, PF = 0, RM = 40, Step = 1]
01/19/10 20:20:17.617146 zma_m2[7672].INF-zm_signal.cpp/44 [Got signal 15 (Terminated), exiting]




kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson » Wed Jan 20, 2010 12:15 pm

Some further info. It was so long ago I first did this I forgot that you had to produce a patch for me to get it to work, which was then merged into the main release (thats why I forgot, as its been such a long time since I had to apply the patch - 2006)

So maybe whatever was done for the patch needs to be replicated on the 1.24+ releases? Looks like each monitor blocks access to any others in its current state?

Full info at:
http://www.zoneminder.com/forums/viewto ... sc&start=0

Does this shed any light on it?

kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson » Mon Jan 25, 2010 8:41 am

Sorry to bump, but this is really holding me up.

I also guess it needs someone who understands the inner workings of the c code which limits who can help, but if anyone could spare a few minutes to look at this it would be greatly appreciated.

Thanks

kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson » Mon Oct 18, 2010 11:43 am

OK. Sorry, but it is rapidly approaching distro rebuild time for me.
So a shameless bump to see if there is a fix for this. I'd like to install 1.24 instead of 1.23, but can't until this is resolved.
Thanks

User avatar
kingofkya
Posts: 1112
Joined: Mon Mar 26, 2007 6:07 am
Location: Las Vegas, Nevada

Post by kingofkya » Mon Oct 18, 2010 6:40 pm

Might be a stupid question but did you bump up your shared memory ?

bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Post by bb99 » Mon Oct 18, 2010 11:16 pm

Did you disable V4L_MULTI_BUFFER and or set captures per frame to a value of 2?

Edit: Had a good look at the 1.22.2 patch and I'm not going to be able to help.

kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson » Tue Oct 19, 2010 11:05 am

Thanks both.
Yes, this really is one for the guys that coded it in the first place, though I know they are pretty busy.
I've looked at the c code myself (a good while back) and despite changing a few things it never worked. Not that I really knew what I was doing.
I'll take a look at those parameters, but I dont think it is that as it all works fine on 1.23. I think it got broken when the capture mechanism was changed to accept vfl2.

btrotter
Posts: 57
Joined: Tue Jan 15, 2008 3:31 pm

Post by btrotter » Tue Nov 02, 2010 4:54 am

I am having this same problem for the same reasons. Multiple monitors with different settings. I am curious as to whether you resolved this?

This is only happening on one specific video port (/dev/video0).
I have 3 other monitors set up this same way and they work fine.

kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson » Tue Nov 02, 2010 11:45 am

I had an email from Phil saying he has been very busy but was going to look at it yesterday.
But he hasn't got back to me to say if he had a chance to look or not.

Other than that I haven't got anywhere. I've looked at the source code and there is no way I can fix myself.

I'm curious as to what you mean my the different /dev/video inputs? I want to read the same input more than once, for 2 different monitors. Is that what you are trying to do?

If you are seeing the exact same thing on different video inputs, perhaps the bug is not quite how I think it is.

btrotter
Posts: 57
Joined: Tue Jan 15, 2008 3:31 pm

Post by btrotter » Tue Nov 02, 2010 1:34 pm

Sorry for the confusion.
My DVR capture card is an 8 channel card.
So I have a /dev/video0, /dev/video1, /dev/video2 and /dev/video3
Each device can handle 2 cameras (ex: /dev/video0:0 and /dev/video0:1)

On /dev/video0 I only have a single camera attached to it, whereas I have two cameras each on /dev/video1 and /dev/video2, and a single camera on /dev/video3. (6 cameras total)

For the one camera I have attached to /dev/video0, I try setting up two ZM monitors, and I get the exact same problem you have.

For the other cameras on /dev/video1 and /dev/video2, I also have two ZM monitors on each of those cameras, and they work.

On /dev/video3, I only have a single camera, and also only have a single ZM monitor set up for that camera.

I have tried recreating the ZM monitors from scratch so that ZM assigns a new monitor ID to it, and the problem still persists.
The one thing I havent tried doing is swapping the cameras from /dev/video0 and /dev/video3 with each other to see if the problem just follows /dev/video0.

Let me know if this is still confusing. I could draw a diagram if I had to.

kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson » Tue Nov 02, 2010 2:38 pm

In that case what I am doing is slightly different.
I have a 4 port card, so each one can only handle one camera.

However, I take that single feed and use it twice on 2 monitors.
So for the same single camera, I have one monitor which checks for motion on cautious settings, and another one that is less restrictive and grabs everything.

This sharing of a single feed works on 1.23 but not 1.24. Although it seems like a strange thing to do, it works for me. I can check my main monitor to see what happened. If something did happen, I can look at the other monitor for longer events and for any events that the motion detection didn't quite kick in on the main monitor.

If yours is the same error at the same place, then it sounds related. And your situation would be a more 'normal' thing to want to do.

Perhaps you can PM zoneminder and draw his attention to this, perhaps it will make it easier for him to work out?

btrotter
Posts: 57
Joined: Tue Jan 15, 2008 3:31 pm

Post by btrotter » Tue Nov 02, 2010 5:08 pm

Hi Kevin,
I dont think I am describing my problem well, nor did I describe how I got to having the problem.

A month ago, I was running on Ubuntu 8 desktop and ZM 1.24.2. In that server, I had two 4-port cards. On each card, I was running 3 cameras for a total of 6 cameras. In that configuration, I had 3 of the cameras set up with two monitors a piece. One monitor to capture everything (Mocord), and another monitor to only capture specific events (Modect).

I then decided to upgrade my hardware. So I went and bought a new computer and a new 8-port DVR card. On the new computer, I loaded Ubuntu 10.04 server and ZM 1.24.2.

I still have the old Ubuntu 8 server with the two 4-port DVR cards sitting to the side powered off.

On this new server, I basically replicate the settings I had on the old server.

With the new Ubuntu 10 and the new DVR card, and I am sure some config setting which changed somewhere, I am having the problem.
I know it works because it was working on my old Ubuntu 8 desktop with the two 4-port cards. Now with the Ubuntu 10 server and the single 8-port card, I am having problems.

mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: Adding multiple monitors breaks zma/zmc

Post by mastertheknife » Sun May 08, 2011 8:15 am

Hi,

I looked into the issue. The code for multiple monitors sharing same device and channel is still there. I couldn't get it to work either (same error as yours) but after some debugging i got it to work.

In file zm_local_camera.cpp, find this line:

Code: Select all

if ( channel_count == 1 || channel_prime )
Change it to:

Code: Select all

if ( channel_count > 1 || channel_prime )
Re-compile and install ZM and see if it works for you.
mastertheknife
Kfir Itzhak.

kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Re: Adding multiple monitors breaks zma/zmc

Post by kevin_robson » Sun May 08, 2011 10:55 am

That's brilliant news, it would be great to get on latest version.
I don't have a 1.24 install to test with, but will endeavour to get one setup in the next few days and report back.

Thanks very much for this - much appreciated.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests