Problem with Source Type: File

Support and queries relating to all previous versions of ZoneMinder
Locked
pdown85
Posts: 23
Joined: Sun Jan 07, 2007 11:29 am
Location: UK
Contact:

Problem with Source Type: File

Post by pdown85 »

System config details: I have three monitors configured.
  • Mon_ID 2 is a Labtec USB web-cam feed. Working fine.
    Mon_ID 3 is a file-structure located jpg file-read feed. Working fine. (BTW: I have noted that if I use a soft link to a file results in no display in ZM, the file pathname has to be an actual file and not a link. I do not know why this is: perhaps it is a documented feature?). However Mon_ID 3 is not the problem.
    My problem is that Mon_ID 4 displays a blank screen (by blank I mean black). Mon_ID 4 is a second file-structure located jpg file-read feed. Different jpg file. But Not working.
For Mon_ID 4:
# zmu -m 4 -q -v -Uuser -Ppwd
Monitor 4(WVC54GF1)
Id : 4
Name : WVC54GF1
Type : File
Path : /home/www/MyTestWebSite/webcam/wcv54g_monitor.jpg
Width : 320
Height : 240
Palette : 1
Colours : 1
Event Prefix : Event-
Label Format : %%s - %d/%m/%y %H:%M:%S
Label Coord : 0,0
Image Buffer Count : 40
Warmup Count : 25
Pre Event Count : 10
Post Event Count : 10
Alarm Frame Count : 1
Section Length : 600
Maximum FPS : 1.00
Alarm Maximum FPS : 2.00
Reference Blend %ge : 7
Track Motion : 0
Function: 2 - Monitor Only
Zones : 1
Id : 4
Label : All
Type: 1 - Active
Shape : 4 points
0: 0,0
1: 319,0
2: 319,239
3: 0,239
Alarm RGB : ff0000
Check Method: 3 - Blobs
Min Pixel Threshold : 25
Max Pixel Threshold : 0
Min Alarm Pixels : 2304
Max Alarm Pixels : 57600
Filter Box : 3,3
Min Filter Pixels : 2304
Max Filter Pixels : 57600
Min Blob Pixels : 1536
Max Blob Pixels : 0
Min Blobs : 1
Max Blobs : 0
Those details all look fine (at least to me!), and the file pathname is correct.
The jpg is a 640X480 capture (from a Linksys WVC54G).
When I try to access that I get the following in the logs:
For 640 x 480 configuration:
# tail /var/log/messages
Mar 8 23:35:11 99dpr-004 zmu[26887]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Mar 8 23:35:13 99dpr-004 zms[26893]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Mar 8 23:35:15 99dpr-004 zmu[26895]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Mar 8 23:35:18 99dpr-004 zms[26901]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Mar 8 23:35:19 99dpr-004 zmu[26903]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Mar 8 23:35:23 99dpr-004 zms[26910]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Mar 8 23:35:24 99dpr-004 zmu[26912]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Mar 8 23:35:28 99dpr-004 zmu[26921]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Mar 8 23:35:29 99dpr-004 zms[26931]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
Mar 8 23:35:32 99dpr-004 zmu[26942]: ERR [Can't shmget, probably not enough shared memory space free: Invalid argument]
If I change to 320 x 240 (as indeed my zmu -m 4 -q above shows) I get the following errors in the logs:
# tail /var/log/messages
Mar 8 23:36:07 99dpr-004 zmdc[26644]: ERR ['zmc -m 4' exited abnormally, exit status 255]
Mar 8 23:36:07 99dpr-004 zmdc[26644]: WAR [Can't find process with command of 'zma -m 4']
Mar 8 23:36:12 99dpr-004 zmdc[26644]: INF [Starting pending process, zmc -m 4]
Mar 8 23:36:12 99dpr-004 zmdc[26644]: INF ['zmc -m 4' starting at 07/03/08 23:36:12, pid = 26999]
Mar 8 23:36:12 99dpr-004 zmdc[26999]: INF ['zmc -m 4' started at 07/03/08 23:36:12]
Mar 8 23:36:12 99dpr-004 zmc_m4[26999]: INF [Debug Level = 0, Debug Log = <none>]
Mar 8 23:36:12 99dpr-004 zmc_m4[26999]: INF [Starting Capture]
Mar 8 23:36:12 99dpr-004 zmc_m4[26999]: ERR [Captured image does not match expected size, check width, height and colour depth]
Mar 8 23:36:12 99dpr-004 zmdc[26644]: ERR ['zmc -m 4' exited abnormally, exit status 255]
Mar 8 23:36:19 99dpr-004 zmu[27009]: ERR [Shared memory not initialised by capture daemon]
#

==> zmwatch.log <==
03/08/2007 23:37:37.529201 zmwatch[26696].INF [Restarting capture daemon for WVC54GF1, shared memory not valid]
03/08/2007 23:37:38.186470 zmwatch[26696].INF ['zmc -m 4' starting at 07/03/08 23:37:38, pid = 27188]
03/08/2007 23:37:48.199034 zmwatch[26696].INF [Restarting capture daemon for WVC54GF1, shared memory not valid]
03/08/2007 23:37:48.841988 zmwatch[26696].INF ['zmc -m 4' starting at 07/03/08 23:37:48, pid = 27208]
03/08/2007 23:37:58.848717 zmwatch[26696].INF [Restarting capture daemon for WVC54GF1, shared memory not valid]
03/08/2007 23:37:59.508231 zmwatch[26696].INF ['zmc -m 4' starting at 07/03/08 23:37:59, pid = 27234]
03/08/2007 23:38:09.514583 zmwatch[26696].INF [Restarting capture daemon for WVC54GF1, shared memory not valid]
03/08/2007 23:38:10.159987 zmwatch[26696].INF ['zmc -m 4' starting at 07/03/08 23:38:10, pid = 27257]
03/08/2007 23:38:20.167315 zmwatch[26696].INF [Restarting capture daemon for WVC54GF1, shared memory not valid]
03/08/2007 23:38:20.796681 zmwatch[26696].INF ['zmc -m 4' starting at 07/03/08 23:38:20, pid = 27283]
I've seen the shared memory notes in the FAQ and other forum threads. This I have addressed, as above, with the shared memory modification and the shared memory is as follows:
# ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 22249472 gdm 600 393216 2 dest
0x7a6d2004 27426817 apache 700 3073188 0
0x7a6d2002 26476546 apache 700 9217188 2
0x7a6d2003 26509315 apache 700 9217188 1
#
I have debug set to level 4 but cannot get the /var/log/zm/zm_debug.log+ files to appear. I restarted zm (servicec zm restart) after setting this, but still no detailed log (as you can see above, Debug Level is 0 and I cannot move it off that). So something is not right there either.

Any suggestion as to how I can get Mon_ID 4 to display the jpg? It is extremely frustrating to have one file monitor jpg working and the other not. The second jpg is a good, valid image - I can see it in a normal web-broswer page.

TIA.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

You have to read the entry in the wiki as just adjusting your shared memory to the example for you is obviously not going to work.
This error is discussed in the README in the following excerpt:- ...this is caused by an attempt to allocate an amount of shared memory greater than your system can handle. The size it requests is based on the following formula, ring buffer size x image width x image height x 3 (for 24 bit images) + a bit of overhead.
So if for instance you were using 24bit 640x480 then this would come to about 92Mb if you are using the default buffer size of 100. If this is too large then you can either reduce the image or buffer sizes or increase the maximum amount of shared memory available.
The example only gives you 134MB of shared memory space.
You have to calculate the needs of each cam for your shared memory total needed.

Changing the image size in ZM will not work unless you change the size of the image as well and they have to match. So you can't set ZM for 320x240 if the image is 640X480.
pdown85
Posts: 23
Joined: Sun Jan 07, 2007 11:29 am
Location: UK
Contact:

Post by pdown85 »

cordel wrote: Changing the image size in ZM will not work unless you change the size of the image as well and they have to match. So you can't set ZM for 320x240 if the image is 640X480.
Excellent stuff! Many thanks. In fact I was unsure of the size of the image I was capturing from the Linksys - it was 640x480 but only because default (mplayer) parameters were capturing it as such and I found a way to reduce it. Having reduced the size of the image capture to 320x240 ZM successfully displays it now!
cordel wrote:You have to read the entry in the wiki as just adjusting your shared memory to the example for you is obviously not going to work.
This error is discussed in the README in the following excerpt:- ...this is caused by an attempt to allocate an amount of shared memory greater than your system can handle. The size it requests is based on the following formula, ring buffer size x image width x image height x 3 (for 24 bit images) + a bit of overhead.
So if for instance you were using 24bit 640x480 then this would come to about 92Mb if you are using the default buffer size of 100. If this is too large then you can either reduce the image or buffer sizes or increase the maximum amount of shared memory available.
The example only gives you 134MB of shared memory space.
You have to calculate the needs of each cam for your shared memory total needed.
Fair enough I understood that. The problem with this is I don't know what the "ring buffer" is. Thus I configured to the example in the absence of anything better to do! If I do have the "default buffer size of 100"and 132MBytes is sufficient for that then I am unclear as to why the 640x480 format was not working. I can only assume either my "default buffer size" is not 100. or the sum total size of my images exceeds 132MB.

So a couple of questions:
1) How do I find out the "ring buffer size".
2) having worked out the shared memory based on my ring buffer size: is that per monitor or the total for all monitors? Your note above does say it is the total; thus if required shared memory was 1M and I had 5 monitors, then I would need 5M total shared memory. If this really is the case and 132 Mbytes was required per monitor then I'll not be able to support many monitors on a 512Mb (max) configuration?

Personally I am just happy to be able to be capturing images off a Linksys WVC54G into ZM as it is a pretty un-cooperative IP web-cam! :D

Thanks again.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

pdown85 wrote: So a couple of questions:
1) How do I find out the "ring buffer size".
It's in your monitor config under the Buffers tab "Image Buffer Size"
pdown85 wrote: 2) having worked out the shared memory based on my ring buffer size: is that per monitor or the total for all monitors? Your note above does say it is the total; thus if required shared memory was 1M and I had 5 monitors, then I would need 5M total shared memory. If this really is the case and 132 Mbytes was required per monitor then I'll not be able to support many monitors on a 512Mb (max) configuration?
If you setting for all you monitors are the same then yes that would work, otherwise you have to calculate each monitor and sum it up.
pdown85
Posts: 23
Joined: Sun Jan 07, 2007 11:29 am
Location: UK
Contact:

Post by pdown85 »

Thanks.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

BTW, Thank you for a very well put togeter post :D
Locked