SKJM Forum

Support => iCam Support => Topic started by: vasilis on May 11, 2010, 10:02:49 AM

Title: CPU Usage
Post by: vasilis on May 11, 2010, 10:02:49 AM
Hi,

This is my first post here as I just got your app installed on my iPhone.

First of all, really nice app, well done!

But as always it could be even better. I noticed that my CPU usage for iCamSource, on my MBP, with Preferences closed, is about 12% constantly even when I view or not view the video from my iPhone and irrespective of the sensitivity set on the motion detection.

It would be pretty cool if you could reduce that 12% to something a lot lower, maybe half? With the sensitivity lowered you could reduce the framerate as well as the resolution of the images using in the motion detection (I am sure you already use binary images for the motion detection). Then, when an iPhone is connected and streaming is established, or when a motion event recording initiates, the framerate and resolution would increase. This way you would spend minimum resources (reduce power consumption, heat, reduce carbon footprint! etc.) when nothing is happening or no one is watching.

All the best,
Vasilis
Title: Re: CPU Usage
Post by: Stefan on May 11, 2010, 11:03:46 AM
Thanks for the great feedback. :)

Actually, the CPU usage is from the motion detection logic actually doing the image processing on the images, so the sensitivity won't affect that.

On the Mac version you can change the frequency that the iCamSource checks for motion by copy-and-pasting the following line into an Applications > Utilities > Terminal window and pressing Return:

defaults write com.skjm.icamsource MotionDetectionWait -int 1000

That changes the wait time between motion detection processing jobs from 500 ms (the default) to 1000 ms or 1 second. If you change the 1000 in that line to any other number that should have an effect on your CPU usage.
Title: Re: CPU Usage
Post by: vasilis on May 11, 2010, 02:31:17 PM
Thanks for your prompt reply!

I tested on a range of values between 500ms to 8000ms to find an approximately 2.0% CPU improvement between 500 and 8000ms intervals.

500ms   -> 13.5% CPU
1000ms -> 12.5% CPU
2000ms -> 12.0% CPU
4000ms -> 11.6% CPU
8000ms -> 11.5% CPU

Also, please note there was a jump in CPU usage every now and then (I think its period is the same as the interval) by about 0.5% CPU usage. So, for example, with the 8sec interval you could get an about constant 11.5% CPU usage which would then jump to 12% for a bit and then back down to about 11.4-11.5% which means something else is using up the CPU between intervals, it can't be the sleep counter using up 11.5% but I am not sure about the camera drivers, maybe having a feed from the cam open is expensive anyway...

If you can figure something out, it would be great, else I guess 10% is not the end of the world.
Title: Re: CPU Usage
Post by: Stefan on May 11, 2010, 04:19:43 PM
Interesting, thanks. What if you choose No Audio as the audio input?

I believe that you will see lower CPU usage settings when connecting to a network IP camera since you aren't dealing with the video and audio capture and processing from the direct hardware itself.
Title: Re: CPU Usage
Post by: vasilis on May 11, 2010, 06:50:25 PM
Thats it! The audio takes up most of the CPU. Without audio and 500ms interval it goes down to 4% and with 1000ms down to 3% which is pretty sweet.

Its interesting to note that with the build-in microphone it seems to use more CPU than with other sources like a USB microphone or the line-in its which is like 4% less, down to 8% total CPU usage.

Thanks for the help!
Title: Re: CPU Usage
Post by: slappywhite on May 12, 2010, 09:04:47 AM
Interesting, thanks. What if you choose No Audio as the audio input?

I believe that you will see lower CPU usage settings when connecting to a network IP camera since you aren't dealing with the video and audio capture and processing from the direct hardware itself.


Where is it you disable audio? At the camera itself?
Title: Re: CPU Usage
Post by: Stefan on May 12, 2010, 10:31:30 AM
No, in the iCamSource by choosing "No Audio" from the Audio drop-down list.
Title: Re: CPU Usage
Post by: slappywhite on May 12, 2010, 10:59:10 AM
Okay I see, that's for USB/FW/Built-In cams. Any way to reduce CPU on Ethernet/WiFi cams? My four iCam Source apps hover around 16% CPU each. Not a problem, but if there's anything I can do, it's worth a shot.
Title: Re: CPU Usage
Post by: Stefan on May 12, 2010, 01:54:28 PM
If you are using an MJPEG URL you could reduce the frame rate / fps that the camera puts out. That way the iCamSource won't have to receive and handle as many images per second.
Title: Re: CPU Usage
Post by: OUAnthony on May 12, 2010, 06:43:57 PM
Are these CPU usage percentages for Macs??? Mine is only between 2-6% for 1 instances of icamsource...with motion detection and push notifications enabled for my IP camera.
Title: Re: CPU Usage
Post by: zak on June 26, 2010, 04:18:49 PM
Hey Guys, really enjoying this setup so far.

I found this thread very useful.  I was happy to get my CPU usage down from a constant 12/13% to a more reasonable 3% by turning off audio and decreasing the motion detection frequency. [I was actually surprised that it would be that high for a beefy i7 machine in the first place!]

I did really like having the audio available though.  Would it be possible to enable audio on demand through iCam's interface?  Or to only start processing audio encoding when iCam was connected?  This way when the machine was just sitting around, it wouldn't be doing un-necessary work.

It might also be nice to be able to toggle the audio quality in addition to what I've mentioned so that it wouldn't be as intense - although I'm not sure how that works in the background.

I guess the idea is that when your machine is idle, it should be using basically no CPU, and then when you connect, it makes sense that it spikes up a bit.

Thanks!
Title: Re: CPU Usage
Post by: OUAnthony on June 26, 2010, 07:17:10 PM
If you have motion detection enabled, it will constantly have to analyze the captured images...so it won't ever quite go to nothing. But like I said, my PC (which is several years old) is only between 2-6% CPU usage with PUSH notifications and motion detection/recording enabled on an IP camera. I guess it'd be higher if I could do audio along with the IP camera.
Title: Re: CPU Usage
Post by: Stefan on June 26, 2010, 09:20:51 PM
What is the CPU difference between choosing an audio input and No Audio? The motion detection processing is more involved than the audio capture, so I would assume that you would see more of a drop in CPU usage when you decrease the rate at which the motion detection processing is performed than if you disable audio processing altogether.
Title: Re: CPU Usage
Post by: zak on June 27, 2010, 06:55:12 PM
I thought the same thing, but the audio seems more intensive...

On my system (i7 imac), we are talking about a difference of about 5%.  It's between 2-3% with audio turned off, and about 8% with audio turned on.  Both of these are with the preferences closed, of course.

I've turned my mocap frequency down to about 1.8 seconds.

I'm really happy with the 2-3%, but like I mentioned in my previous post, I'd love to have the option to turn the audio capture on on the fly in case I wanted it when I am tuned in.

Doesn't seem like there would really be a need for audio to be enabled unless you were tuned in.

What do you think?
Title: Re: CPU Usage
Post by: Stefan on June 28, 2010, 11:56:34 AM
I believe the original thought behind "engaging" the video and audio inputs (besides monitoring the video for motion) was to make sure that no other application blocked the iCamSource from accessing the inputs when the time came.

On some hardware configurations, only one application can access an input at a time, and if, when you attempt to connect via iCam, the input is not able to be acquired by the iCamSource, there's not much that can be done about it programatically.

I suppose that it is something that we could look into, though ... To see what level of a problem it would actually be.
Title: Re: CPU Usage
Post by: zak on June 28, 2010, 12:07:29 PM
Ah I see, that makes sense.

I do appreciate you looking into this option and responding quickly.  I think any implementation of this "dynamic audio" option would be very powerful - whether it be a user toggle from icam, or just an automatic enable when someone logs in.

I've already impressed a bunch of my friends with this iphone app and this security setup.
Title: Re: CPU Usage
Post by: Kurtois on September 15, 2010, 02:53:54 PM
Anyone in the "audience" using the iCamSource on a WinXP P4 machine w/1GB RAM?  I just upgraded today, and I must admit, I still have poor results (image not displayed on iPhone using a connection at a remote location) running three cameras (all Wi-Fi based cameras).

I will try disabling audio and ensuring other parameters are set to help the "cause".
Title: Re: CPU Usage
Post by: OUAnthony on September 15, 2010, 07:52:52 PM
It sounds like you have an issue with port forwarding. Have you either:

1) set up a static IP address for each camera, enabled uPNP in both icamsource and in your router settings and rebooted your router?

2) set up a static IP address for each camera and your computer running icamsource, set up manual port forwarding in the router, and enabled port forwarding in icamsource?
Title: Re: CPU Usage
Post by: Jay on September 15, 2010, 10:13:01 PM
Kurtois - What error message are you seeing on your iPhone exactly?

Do you see the same behavior if you only run one camera?
Title: Re: CPU Usage
Post by: Kurtois on September 16, 2010, 03:21:57 PM
OUAnthony/Jay - Thank you for your replies.

As background, I have been running iCam since Feb '10.  The software prior to this recent upgrade did not show connection errors for my IP cameras.  Note I had just ran the icamsource upgrade yesterday on the XP machine, but did not reboot.  The machine dropped off the network yesterday about four hours after running the upgrade.  I rebooted and I am able to see the live view, however, bringing up motion events is an issue.  It seems when the cameras are recording, bringing up Motion Events is particularly laggy.  Regardless of camera image activity, bringing up Motion Events and viewing the photos is laggy. 

Historically, I have ALWAYS had lag when trying to pull up past Motion Events.  Would appreciate figuring out how to speed up the recall of these events AND viewing them.  Note that I have changed the value allotted for image storage to 2GB.  If that needs to be changed to increase performance, I can do that.  Files are being saved to the OS disk.  This morning the Motion Events would not come up for one of the cameras. 

Any chance there is a function to log to a log file?  I am always running into "bumps" with this software and some bit of frustration.  I am always thinking about upgrading the box that iCamSource runs on, but would rather not, of course.

Questions answered below:

OUAnthony:
1) set up a static IP address for each camera, enabled uPNP in both icamsource and in your router settings and rebooted your router?

I have setup a static IP for all three cameras outside of the DHCP "pool", the WinXP box is also setup with a static IP.  I have NOT enabled uPNP (is that a settable option?) in icamsource; is this even necessary? 

Jay:
1) I initially ran just one camera after running the upgrade and all appeared normal.  I can revert back to one camera, if needed. 

Title: Re: CPU Usage
Post by: Jay on September 16, 2010, 09:54:49 PM
If you have a very large number of motion events, that would increase the delay because the iCamSource has to compile and send a large list to the iPhone.  I would imagine that 2GB worth of small JPEG images would be a very long list.  Are you actually filling up the 2GB storage limit?

What error message are you seeing on your iPhone?  If you're seeing the Source Connection Error, then the UPnP option may resolve the problem. In iCamSource, enable the "Auto-Config Router" option.  If it doesn't work, let me know what error message appears next to the "Auto-Config Router" checkbox.
Title: Re: CPU Usage
Post by: Kurtois on September 16, 2010, 10:55:26 PM
>Are you actually filling up the 2GB storage limit?

Here are stats for one of the folders:
1.97 GB
41,700 files
4,740 Folders

Is the app sending an XML file?  Doesn't text take minimal bandwidth?

If this is too much, perhaps the app needs to have a limit put in place?

Errors?  I receive from time to time "One or more of the iCam brokers could not connect" and then a view says "Connection Closed".  It has been rare.
Title: Re: CPU Usage
Post by: Jay on September 17, 2010, 01:09:32 AM
If you aren't receiving images on your iPhone, you should see an error message every time that happens.  Some of the error messages take a while to show up since they are timeouts.  You can try enabling the "Auto-Config Router" option to see if it helps with the connectivity.

Text takes up less space than audio or video data, but a set of data with thousands of entries is a lot regardless.  I don't know if the limiter is the bandwidth or the processing.  The limit we have in place is the storage limit, but we have given control over that limit to the user.  Have you tried lowering the storage limit to see if has any effect?  You can copy the motion event folders first if you don't want to lose the existing recordings.

Title: Re: CPU Usage
Post by: Kurtois on September 17, 2010, 06:56:22 AM
Jay,

The error messages of simply viewing the live images will often display when I am within the same local network of the cameras.  As I mentioned, these error messages are few and far between with the prior version of the app.  They popped up again with the upgrade, but seem to have subsided.

I am not sure Auto-Config router would help with the live view timeout error above given I am in the same local network.  Agree?

I will lower the storage limit.  That said, at what level should I "archive" folders off.  Is it necessary to stop data collection? 

On a related note, could you describe how one would save the images to Dropbox on a Windows machine?  Instructions for OS X (10.5 or 10.6) would also be appreciated.  Perhaps point me to a thread. 
Title: Re: CPU Usage
Post by: GaryW on September 17, 2010, 10:04:32 AM
Try searching for DropBox - here is one thread that I found:

http://skjm.com/forum/index.php?topic=615.0
Title: Re: CPU Usage
Post by: Jay on September 17, 2010, 10:17:26 PM
Without an error message, it'll be hard to determine what's going on.  You are correct when you say that the Auto-Config Router option won't help for connectivity problems on the same local network.

If you are seeing the Source Connection Error when the iPhone is on the local network, that indicates that firewall software on the computer running is blocking the iCam traffic. 

In order to find more information about what's causing the problem, I'll need you to email the external IP address of the computer running iCamSource to support@skjm.com.  To get that, go to http://whatismyip.com in your computer's web browser.
Title: Re: CPU Usage
Post by: Kurtois on October 13, 2010, 08:45:45 AM
I just wanted to follow-up and indicate that I have cleared all the captured files to a subfolder.  I set the storage limit to 500MB and things have been sort of running smoothly. 

I say "sort of" because I am encountering instances where the "Record Motion Events" checkbox gets cleared spontaneously.  I thought perhaps it was because I "checked in" on my cameras using an iPad, which I occasionally do.  I thought perhaps one of the settings using that app was causing the option to get flipped. 

Has anyone seen this behavior?  Quite disappointing.  Let me know what I can do to perhaps track the events leading up to this option getting changed.

To follow up to another question, from time to time I will get "Source Connection Error" when I go to look at a particular camera's Motion Events and the progress wheel spins for a long period of time.  It is not often, and I haven't paid attention enough to determine if it is on a local, hotspot, or 3G connection.
Title: Re: CPU Usage
Post by: Jay on October 14, 2010, 12:29:10 AM
Have you noticed any pattern to when this occurs?  The only events that should change the recording setting are manually checking the checkbox in iCamSource or toggling the switch in iCam on the iPhone.  Does this happen immediately when you enable recording on the first camera, or does it happen some other time?

If you enable recording for one camera in the iCamSource window (not through the iPhone), do you see this same behavior?
Title: Re: CPU Usage
Post by: Kurtois on November 03, 2010, 10:52:21 PM
Jay,

No update on this issue.  I will keep you apprised if it raises again. 

Kurt
Title: Re: CPU Usage
Post by: Kurtois on December 17, 2010, 03:47:01 PM
Jay,

Here is the error message I receive fairly routinely with the Motion Events folder size set to 500MB:

(http://webpages.charter.net/ckwers/IMG_2017.PNG)

The way these images are being fetched, could it not be improved?  I don't need to look at the older events often.  Couldn't the app just load the last 30 days of events or something?
Title: Re: CPU Usage
Post by: Jay on December 18, 2010, 11:53:30 AM
The Source Connection Error occurs at the initiation of the connection between the iPhone and the computer.  It doesn't involve the motion recordings.  Have you tried using a lower storage limit to see if it effects the problem?

How many cameras do you have in the Cameras list in iCamSource?  It's possible that you're getting the Source Connection Error for one camera while you're browsing the motion events for another camera.
Title: Re: CPU Usage
Post by: Kurtois on December 18, 2010, 02:17:33 PM
Jay - I will double check the message, as this one was snapped some time ago, but the events that elicit an error message are as follows:

1.  Wait for Motion Events list to populate (recently, has been taking a minute or greater).
2.  Either list will populate OR the aforementioned message (I believe it is this one), will appear.  Display returns to multi-view display of sources and the source that I was trying to view motion events for will say "Source Connection Closed" or "Connection Closed" and the view for that source will be blacked out.

My setup:
WinXP P4 machine w/1GB RAM.
Three Wi-Fi based MJPEG cameras; if necessary, I can double check how many images/second the camera is outputting for processing.
Title: Re: CPU Usage
Post by: Jay on December 18, 2010, 10:19:26 PM
If it loses the connection after the connection has been initiated, it should show the "Connection Closed" message.

The screenshot in your other thread showed that you have a large number of motion events recorded (over 10,000).  It sounds like the computer might be struggling to generate and send that list, causing the connection to time out.  Does reducing the storage limit to half (or less) of it's current setting have any effect on this behavior?
Title: Re: CPU Usage
Post by: Don of Nashville on September 30, 2011, 12:41:46 PM
At work, I am using a 2007 Mac Book Pro 15" with 4GB RAM and a (1 year old) 240 SSD with the built in iSight camera, I have noticed my CPU usage also decreased by almost half, went from 33-43% down to about 14%!

I wonder if this may be the reason I am losing my camera connection feeds on my home computers.

At home I have an old (2006?) iMac G5 1.9Ghz with 2.5 GB RAM and have tried to use both the iSight camera and a Logitech C615 USB camera.  I can get them both up and running, but sooner or later, one will drop out, and after a period of time, the second iCamsource pref window will close and the icon will disappear in my top menu bar.  I know I pushing the iMac with these video feeds, but its a damn good old computer that just won't die! (the last G5's before Apple went to Intel).
But I have audio enabled for both cameras, so will have to try without audio to see what happens.

At home also, I also have a 2009 13" Mac Book Pro with 8GB RAM and am having the same problem, camera will drop out and stop connecting.
I have ATT Uverse internet service with their second highest internet speed (Max or whatever). Wondering if I am exceeding my bandwidth or something when I try to have all 4 camera feeds (2 on iMac and 2 on MBP; both using iSight camera and one Logitech C615 USB camera).  I have my motion set to less sensitive and motion detection to less often, to reduce CPU usage.
I will have to try turning the audio off and see if that makes a difference.

I'm still reading through a lot of the forums here and picking up some good tips and help.
Would love to get my two home computers (or at least one) to be able to run all four cameras (or 3 with on computer, using iSight as one cam).  I was able to get them all (2 computers each with 2 cams) up at once, but they quickly lost connections, except for

BTW, great product and great support here! You guys are doing a great job.