Can't capture at 640*480

Forum for questions and support relating to the 1.24.x releases only.
Locked
trashisfree
Posts: 4
Joined: Sat Jul 31, 2010 10:19 pm

Can't capture at 640*480

Post by trashisfree »

PV143 capture card bluecherry should do 640*480
ccd camera support 420tlv 480tlv 500tlv
http://cgi.ebay.com/ws/eBayISAPI.dll?Vi ... 0556313951

kernel.shmall = 134217728
kernel.shmmax = 134217728

Best I can run them at so far is 384*244
Any help dearly appreciated.
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Post by bb99 »

Shared memory issue, from the wiki (http://www.zoneminder.com/wiki/index.ph ... esolutions.):
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, for example:

384x288 capture resolution, that makes: 110 592 pixels
in 24 bit color that's x24 = 2 654 208 bits per frame
by 80 frames ring buffer x80 = 212 336 640 bits per camera
by 4 cameras x4 = 849 346 560 bits.
Plus 10% overhead = 934 281 216 bits
That's 116 785 152 bytes, and
= 114 048 kB, respectively 111.38 MB.
If my shared memory is set to 134 217 728, which is exactly 128MB,
that means I shouldn't have any problem.
(Note that 1 byte = 8 bits and 1kbyte = 1024bytes, 1MB = 1024 kB)

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. If you are using RedHat then you can get details on how to change these settings at http://www.redhat.com/docs/manuals/data ... urces.html .

You should be able to use a similar procedure with other distributions to modify the shared memory pool without kernel recompilations though in some cases this may be necessary. Note, this error also sometimes occurs if you have an old shared memory segment lying around from a previous run that is too small. Use the ipcs and ipcrm system commands to check and remove it if necessary.'"

You can often find out how much shared memory is available by typing the following :-

cat /proc/sys/kernel/shmall

and the most you can allocate in one go :-

cat /proc/sys/kernel/shmmax

To change these values type (for example) :-

echo 134217728 >/proc/sys/kernel/shmall
echo 134217728 >/proc/sys/kernel/shmmax

Be sure to restart ZoneMinder after this.However be aware that sometimes you will only need to change the shmmax value as shmall is often large enough. Also changing these values in this way is only effective until your machine is rebooted.

To change them permanently you will need to edit /etc/sysctl.conf and add the following lines (for example) :-

kernel.shmall = 134217728
kernel.shmmax = 134217728

To load these settings in the sysctl.conf file type:

sysctl -p

To check your shared memory settings type:

ipcs -l

Note that with Megapixel cameras like the Axis 207mw becoming cheaper and more attractive, the above memory settings are not adequate. To get Zoneminder working with a full 1280x1024 resolution camera in full colour, increase 134217728 to, for example, 268424446

These changes will now also be set the next time your machine is restarted.
Bump it up until everything works.
trashisfree
Posts: 4
Joined: Sat Jul 31, 2010 10:19 pm

Can someone edit the faq for camera shmall shmaxx settings

Post by trashisfree »

Having a table of suggested settings for different camera resolutions would be a huge help. And tell people to multiply amount by number of cameras.
resolution shmall shmmax

Got mine working thank you.
bb99
Posts: 943
Joined: Wed Apr 02, 2008 12:04 am

Post by bb99 »

Your very welcome.
Flash_
Posts: 441
Joined: Wed Jan 11, 2006 12:19 pm

Post by Flash_ »

The beautiful thing about wikis is they can be edited yourself...
webbera
Posts: 1
Joined: Mon Aug 30, 2010 6:02 am

Can't capture at 640*480

Post by webbera »

I am trying to get 2 USB cameras working on my Ubuntu 10.4 system, zm 1.24.2

I can run the cams at 320 x 240 fine but i want to run both at 640 x 480.

based on the memory requirements for the camera I think I should be at:
811008000 for the shmmax. it is set to 1048576000.

I can run one camera at 640 x 480 but not both.

The symptoms I see look like they are related to the shared memory problem but from what I can tell it looks like i am within range and this should work.

The only other thing is that both cameras are sharing the same usb bus. It appears I should do this:
USB bus problems. If you have multiple USB cameras on one bus then it can appear as if ZoneMinder is causing your cameras to fail. This is because the bandwidth available to cameras is limited by the fairly low USB speed. In order to use more than one USB camera with ZoneMinder (or any application) you will need to inform the driver that there are other cameras requiring bandwidth. This is usually done with a simple module option. Examples are usb_alt=<n> for the OV511 driver and cams=<n> for CPIA etc. Check your driver documentation for more details. Be aware however that sharing cameras in this way on one bus will also limit the capture rate due to the reduced bandwidth.

but i do not know how to do that. Also, the cameras support 640 x 480 at 30 fps but i have them limited to 10 fps.

the system i am running them on is probably a little on the weak side but from what i can tell this should work. Also there is no load on the system at all. currently with one cam at 640 * 480 and one at 320 * 240 the load is 0.61 and only 27% memory usage on the system.

It is incredibly frustrating to bump up the shared memory values but it does not appear that zoneminder uses the full amount available. (yes many restarts. I even found that i needed to restart when playing with the buffer sizes cause the cams would go red but restart would put them both back to green. it was like zoneminder would figure out how much mem to use at startup and would not adjust for increased memory demands.)

Anyway I can run one camera at 640 * 480 with an image buffer of 40, so you would think i could run 2 cameras at 640 * 480 each with an image buffer of 20.

Any help would be greatly appreciated. i have been fighting with this for a while now.
nausser
Posts: 18
Joined: Sat Oct 09, 2010 9:08 pm
Location: South Florida

What worked for me...

Post by nausser »

It was my shared memory that did the trick to get my Logitech USB camera working at 640x480 resolution. The only difference is I had to put a higher max memory setting. I simply doubled the amount posted above.
My end result was:

edit file: "/etc/sysctl.conf"
add to end of file:

Code: Select all

kernel.shmall = 134217728 
kernel.shmmax = 536870912
I then figured I didn't want to be close to a threshold so I doubled it again resulting in the above numbers.

Hope this helps someone!!
Time never ceases to accelerate.
Locked