-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add analysis interval parameter to monitors settings #956
Add analysis interval parameter to monitors settings #956
Conversation
Thank you for doing this. It was on my todo list. I will definitely be reviewing/merging. |
So far it looks good to me. |
In order to avoid upgrade issues with users who are running master, we need to put the update sql bits into a new file called zm_update-1.28.101.sql. We then need to bump the zm version to .101 in the usual places. |
My only other comment has to do with int vs unsigned int. I keep seeing the use of int when a negative value makes no sense. Does a negative analysis interval make any sense? |
Also I kinda think this setting should be on the first page of the monitor popup... |
Also: I don't think this algorithm will be effective. This makes analysis happen on every so many frames. The problem is that we have cameras now that send a variable framerate. so I have a camera that normally sends 3fps, but at times will send up to 15. I would like analysis to happen at a fixed 3fps, but recording to be 15fps. I think this analysis fps should in fact be only analyze so many frames per second. |
Would there be a conflict of fps? |
My point is that I want to be able to set it to analyze at 2fps. The code should then skip however many frames are required to get to 2fps. Instead, if I set this to 2, it will skip every other frame. |
@knnniggett:
|
…nder into add_analysis_fps Fixed conflicts in: src/zm_monitor.cpp
…o add_analysis_interval
I implemented an analysis fps instead of the interval. |
Does this replace the Motion Frame Skip on the misc page? |
Overall this looks great. Two things to note: the analysisfps can be null, so when loading it from the db, you need to test it for null before calling atol. So something like analysis_fps = dbrow[dbCol] ? atol(dbtow[dbCol]) : 0; The other is the language files, you don't need to add lines to them. The ui will fall back to english if there is no entry in the other language files. |
@Linwood-F: |
@connortechnology: |
I found a bug. |
@manupap1, I guess I should have worded the question differently -- could this replace the motion frame skip? Unless I have misunderstood, it seems to address the exact same issue -- skip some frames if they are coming in fast. Unlike the frame skip which is frame based, this is (to me at least) more meaningful as time based. Actually I'd prefer to see the (non) motion frame skip also be time based, as it is one less thing to adjust if you decide to change camera speed (or for a variable frame rate camera). I'm very new to zoneminder, so take with the usual chunk of salt, but to me it's a wonderful thing if a new (and better) feature can replace an old one, and a bad idea to leave redundant features. Now if one was a lot faster (e.g. like image quality vs disk space) I get it, but if they both do the same function in (almost) the same way.... Just a thought. |
@Linwood-F, yes it could replace it. In fact this could replace both options (frame skip and motion frame skip) as the filtering is performed upstream. |
I am not sure that the issue with pre-event frames can be solved easily because the problem is deeper, we have to deal with the buffer design. The buffer size is fixed and based on a number of captured frames (default 50). Maybe the best option would be to implement a separated pre-event buffer with a proper sampling. |
I have only briefly glanced at that code but not sure I understand. The buffer is used to save images for (potential) save to disk, not analysis, right? So if the non-alarm skip is big (whether by time or frames) and the alarm skip is zero or small, you are indeed going to discard most frames going into the buffer -- which is a good thing. But the analysis rate would be independent of both of those two, and be decided upon as images are being captured. not sure if the buffer is used to pass to the analysis, but even if so, it would be passed off at the current head of the list, not drawn from deep in it? |
@Linwood-F: |
Ah, thanks, sorry for the tangent. |
I am going to have to write a test case and prove it, but I have solved several seg faults by not passing NULL to atoi. |
yeah, according to docs, do not pass NULL to atoi or atol |
Sigh, there is also this. According to the atoi man page, it has been deprecated by strtol. IMPLEMENTATION NOTES |
@connortechnology |
I'm happy to merge this, but I'll leave it to you to resolve the conflicts from other things that we have merged. |
I'm still confused whether this should eliminate the motion frame skip parameter. If this is functionally a replacement and/or better, should we not get rid of that? |
Wow, seems like we've got several changes in the works that are modifying the dB schema, which are causing the merge conflicts. Everything up to 1.28.103 is currently spoken for. Please bump the revision in the PR to 1.28.104. |
Ended up bumping the version to 1.28.104 with this merge |
Currently, video analysis is performed at full framerate, this can lead to high cpu load.
In order to reduce the cpu load, this PR add an analysis interval parameter to monitors settings.
Default value is 1, all images are processed.
If a greater value is set, for example 5, only images with count multiple of 5 will be processed.