Difference between revisions of "Math for Memory - knowing how much memory you need and how to optimize"
From ZoneMinder Wiki
Jump to navigationJump to search
(Created page with "<Home") |
|||
Line 1: | Line 1: | ||
[[Various Learnings from getting Zomeminder 1.28.1 working well on Ubuntu Server 14.04|<Home]] | [[Various Learnings from getting Zomeminder 1.28.1 working well on Ubuntu Server 14.04|<Home]] | ||
It's very easy to underestimate how much memory you need to capture HD streams from cameras. When I first started, I assumed 2GB memory was sufficient to capture 5 HD cameras, as long as I reduce frame rate a bit. I never really did the math, but very soon I noticed that ZM was reporting all sorts of errors, cameras kept failing and all sorts of errors. | |||
So I asked for help [http://www.zoneminder.com/forums/viewtopic.php?f=32&t=22999 here] and user knnniggett offered excellent sage advice. | |||
So do yourself a favor and do this math: (and please read [http://www.zoneminder.com/wiki/index.php/Main_Documentation#Buffers_Tab this] for a better understanding) | |||
<nowiki> | |||
Min Memory = 1.2 * ((image-width*image-height*image buffer size*target color space*number of cameras/8/1024/1024 ) | |||
</nowiki> | |||
Where: | |||
* '''image-width''' and '''image-height''' are the width and height of images that your camera is configured for (in my case, 1280x960). This value is in the Source tab for each monitor | |||
* '''image buffer size''' is the # of images ZM will keep in memory (this is used by ZM to make sure it has pre and post images before detecting an alarm - very useful because by the time an alarm is detected, the reason for the alarm may move out of view and a buffer is really useful for this, including for analyzing stats/scores). This value is in the buffers tab for each monitor | |||
* '''target color space''' is the color depth - 8bit, 24bit or 32bit. It's again in the source tab of each monitor | |||
* The 1.2 at the start is basically adding 20% on top of the calculation to account for image/stream overheads (this is an estimate) | |||
So let's do the math. I have 4 cameras running at 1280x960 with 32bit color space. I have one camera running at 640x480 with 8bit greyscale color space | |||
So, my system would require: | |||
<nowiki> | |||
1.2 * ((1280*960*50*32*4/8/1024/1024 ) + (640 *480 *50*8/8 /1024/1024)) | |||
</nowiki> | |||
Or, around 900MB of memory. |
Revision as of 12:19, 24 March 2015
It's very easy to underestimate how much memory you need to capture HD streams from cameras. When I first started, I assumed 2GB memory was sufficient to capture 5 HD cameras, as long as I reduce frame rate a bit. I never really did the math, but very soon I noticed that ZM was reporting all sorts of errors, cameras kept failing and all sorts of errors.
So I asked for help here and user knnniggett offered excellent sage advice.
So do yourself a favor and do this math: (and please read this for a better understanding)
Min Memory = 1.2 * ((image-width*image-height*image buffer size*target color space*number of cameras/8/1024/1024 )
Where:
- image-width and image-height are the width and height of images that your camera is configured for (in my case, 1280x960). This value is in the Source tab for each monitor
- image buffer size is the # of images ZM will keep in memory (this is used by ZM to make sure it has pre and post images before detecting an alarm - very useful because by the time an alarm is detected, the reason for the alarm may move out of view and a buffer is really useful for this, including for analyzing stats/scores). This value is in the buffers tab for each monitor
- target color space is the color depth - 8bit, 24bit or 32bit. It's again in the source tab of each monitor
- The 1.2 at the start is basically adding 20% on top of the calculation to account for image/stream overheads (this is an estimate)
So let's do the math. I have 4 cameras running at 1280x960 with 32bit color space. I have one camera running at 640x480 with 8bit greyscale color space
So, my system would require:
1.2 * ((1280*960*50*32*4/8/1024/1024 ) + (640 *480 *50*8/8 /1024/1024))
Or, around 900MB of memory.