Feature Request: Make motion even less processing intensive
I have Motion installed on a very low power PC. It has 256MB Ram and a 800Mhz Via C3 processor (which work with passive cooling).
At the moment 3 network cameras with a resolution of 640x480 are working on the system. The motion detection work perfect but is very slow. I'm only able to save movies with about 1-2 fps. During operation Motion uses the processor to up to 98% which indicated to me, that it would need more processing power to do all the image processing and jpeg de/encoding stuff.
Here is my feature request or proposal.
Would it be possible to use a resolution reduced image for processing and the original one for archiving? It would also free Motion from decompressing and compressing this whole bunch of jpeg information.
Why would it prevent Motion from decompressing the images?:
Well, as you probably know jpeg data are simply huffman coded results of a quantizised DCT (discret cosine transformation). If one would only decode the huffman data and only use the DC component of the DCT result, the reverse DCT (which is time consuming) need not to be calculated. Since jpeg operates on 8x8 pixel tiles, with the DC components of each tile you will get an images which has an eigth of the resolution in X and Y direction. Should be enough for motion detection. AND you get an low pass filter for free which cancels out some noise.
Why would it prevent Motion from compressing images?:
Well, that is fairly simply. Since you use the original image from the camera you only have to split the jpeg stream into jpeg files. Thats all.
But what is with this nice overlayed information?:
Yes, that is a problem. Without any de/encoding it would not be possible to have that information. I could think of more solutions for that problem:
1.) Only place overlayed information in the first frame (or best frame). That is not beautifull but it gives you all necesarry information.
2.) Update a text file with the information that would have been placed in the image and run a script on the files at a later time.
3.) Do a partly de/encoding of the image. Since the the overlayed information are only covering some of the 8x8 tiles. Only them have the be updated. That should reduce the effort for de/encoding significatly.
So, what do you thing of that proposal?
Thank you for your attention
- 25 Dec 2006
What you propose would significantly require that the entire Motion detection scheme, the despeckle function, the smart mask feature - well everything - gets completely rewritten. And I am not sure the resulting Motion detection would be very efficient. There are many years of development behind the current detection algoritms.
And to most of us the overlay graphics are important. It seems your major problem is that you do not have much RAM to do with so I have the feeling that your machine is diskswapping a lot.
Also running at 640x480 very fast requires a significant amount of processing power.
I also wonder what other features you run with. I run 13 cameras at 320x240. Two are network cameras. Rest are USB or composite camera which is actually what Motion is optimized for. And I run them at 2fps. Many think they can run cameras at 25 or 30 fps but if you calculate how much CPU power that requires then even with composite camera delivering the YUV420P
format Motion uses internally - the computer will loose its breath.
I'm not very familiar with the internal structure of Motion. So what I think of the internal structure is, that there is a decoding part that reaches the raw image data to the detection part. So a reduced image can be reached to the detection part as long as the detection part assumes it to have a lower resolution.
I've got enough RAM. I can see it on the system monitor, that nothing is swapping.
'>"Also running at 640x480 very fast requires a significant amout of processing power"
Ehhm.. Yes. That was the reason for my original post. Wouldn't it be great to process that large images at a very high frame rate or on very low speed computers?
- 27 Dec 2006