Author
Topic: Motion parameters (Read 6506 times)

I have an USB webcam working as a surveillance camera plugged into an hybrid.

I can monitor the camera from orbiters and motion is being triggered saving pictures and also videos.

What I'm trying to do now is to play with some motion parameters (frame rate, ffmpeg) but I noticed that both motion.conf and thread0.conf are rewritten each and every time that DCE router is reloaded.

In this way my custom parameters are always overwritten and motion is being started with "Pluto" parameters.

By looking at them they are definitely not similar to motion-dist.conf (standard conf file normally shipped with motion), so my guess is that those files are written by Pluto and the needed parameters are stored somewhere in some device record (Motion Wrapper? Generic Camera?) but I couldn't figure out where.

Then I gave a look to those device templates in order to get a hint on how to possibly set up a custom template that specifically includes the parameters I'm playing with but I didn't understand how device parameters are mapped to conf file.

Just to make an example, in the Generic Camera template the first parameter specifies the v4l device to use (/dev/videoX), but I couldn't understand how Pluto can track that this specifical parameter has to be written in that particular file (thread0.conf) with exactly that proper label (videodevice).

I've searched on the docs (Advanced Pages -> Device Templates) but I couldn't find info on how to do it.

So in the end I have 2 questions:

1. where are stored "standard" motion parameters and where in pluto admin can those parameters be modified?

2. how is device parameters mapping implemented in Pluto?

I'm am aware that these may be very basic/newbie questions, so also just pointing me to some docs to read would be good.

since I've helped pluto guys a bit with motion wrapper, I'll try to answer those questions...

But before that, I must say, that currently I'm running new version of motion (3.2.3) at my machine and I'm testing if it performs same as previous version.

New version will allow us to add few things - specially alarm triggers, since this is motion detection application.

I agree on parameters. On Pluto you always fight with two things :- to make things as easy as possible to use (means hiding unnecessary details from user)- to leave as much as possible room for customization of parameters features.

So for now, those conf and thread files are written by motion-wrapper and basic parameters are hardcoded (video device number and port parameters are part of device definition - and template)...

I can invite you join some testing on new version - instead of getting each parameter to end user - we should prepare higher level settings (like high, low res, outside camera, inside camera, etc...).

I'd kindly ask Vali, if he can get us way to specify custom parameters over web site (if I specify any parameter and its value on each device, then it will overwrite setting in thread file...) That would be sufficient start for more extensive testing - particularly of filters and other important settings....

I think that 3.2.3 version will be on in .30 release (Radu, it's working same as previous version), also with new source code updating system - therefore a lot of room for contribution on our side....

I'm already using motion 3.2.3 installed out of deb package from motion site.

There are some strange things about motion. In my case it was crashing at startup (even from command line) and the reason was that ffmpeg was missing. I found a bug report on pluto site that confirms this.

The strange point is that ffmpeg won't install if you use only pluto mirrors for apt-get. The only way out (at least for me) was to temporary add an official repository in order to install ffmpeg, but every time I do this I'm always scared that some other package may also be updated breaking some dependencies ....

I would be glad to be of some help in testing, just consider that I'm quite a rookie.I've some linux knowledge but I'm far to know Pluto and Motion.

I'm trying to make myself a picture of many things, and I'm doing it reading tutorials and going on with a "trial and errors" approach.

Given this, if you think that I my contribution may be useful just let me know.

Besides the possibility to customize some device parameters (that basically is a device template matter) I was also wandering to add some kind of controls that allow to "switch off" some motion devices at given time or just on user demand.Actually I'm thinking to use webcam to monitor access to a room. Motion should not rise any alert event when some authorized person enters the room, but only when needed (let's say when monitor system is "on")As I told you ... I don't know if this is already managed by Pluto or not ... I didn't read that chapter of the story yet ... just an idea ...

Let me know what do you think about.

In the mean time I will read something about advanced features in motion, just to keep myself busy ...

By re-reading my previous post I realize that I was quite unclear and possibly I missed some relevant pieces, so this is to better explain what I was saying in tha last part of my previous post.

When I said that I would like to temporarily "switch off" motion I am not only thinking about stopping security alerts.

I mean exactly to stop motion.

The reason is simple. If you plug your webcam on a MD (say a not-so-powerful box) and you let motion to take care of it, you will have motion always taking picture and encoding videos even if house mode is "disarmed".The only effect you have in "disarmed" mode is that motion alerts and/or notification are no more issued, but motion still works. This may cause some performance issue when the same MD is used to playback some audio or video.

The only way that I found to stop motion (from a user point of view) is to unplug webcam. This also lead to the need to restart router just after you plug again the webcam (otherwise motion won't be restarted) that in the end is not very elegant ...

An option (that I have still to test in terms of performance) could be to be able to change "on the fly" some motion parameters in order to use a completely "black" mask. In this way I expect that no motion is detected and no videos are encoded, saving some CPU for remaining tasks.

But even if I can have motion behaving the way I want, still I have no clue on how to change those parameters from Pluto.

By re-reading my previous post I realize that I was quite unclear and possibly I missed some relevant pieces, so this is to better explain what I was saying in tha last part of my previous post.

When I said that I would like to temporarily "switch off" motion I am not only thinking about stopping security alerts.

I mean exactly to stop motion.

The reason is simple. If you plug your webcam on a MD (say a not-so-powerful box) and you let motion to take care of it, you will have motion always taking picture and encoding videos even if house mode is "disarmed".The only effect you have in "disarmed" mode is that motion alerts and/or notification are no more issued, but motion still works. This may cause some performance issue when the same MD is used to playback some audio or video.

The only way that I found to stop motion (from a user point of view) is to unplug webcam. This also lead to the need to restart router just after you plug again the webcam (otherwise motion won't be restarted) that in the end is not very elegant ...

An option (that I have still to test in terms of performance) could be to be able to change "on the fly" some motion parameters in order to use a completely "black" mask. In this way I expect that no motion is detected and no videos are encoded, saving some CPU for remaining tasks.

But even if I can have motion behaving the way I want, still I have no clue on how to change those parameters from Pluto.

I hope that my point is clear now

RegardsMarco

Hi,

currently there is no support for changing parameters under Pluto. But newer version has nice HTTP API, where we can control a lof of its features (including controling threads)... but we need to do it....

Till then: I like my Logitech cams that have covers, that can be drawn over lense, so camera is blind (this is useful also fo intimacy protection and IMHO is the only way you're sure that no one is watching you....)

this recalls something I've heard about pc security ... I don't remember the exact words, but there was a guy saying that a secure pc should be disconnected from internet, from power socket, with no mouse nor keyboard, without monitor, secured inside a cement cube without doors and window ... but he still had some doubt whether it could be safe enough... :lol:

So I wouldn'd be so sure that lens covers are enough to protect your privacy ... some undocumented X-ray function may be activated ...

Seriously speaking, I think you are referring to the Motion http remote control. From what I've read it could be possible to use some simple script to issue commands / change parameters (just discarding the html page returned by Motion), and this could ease enough the task to implement some advanced control from Pluto or any other application.

we could and on and off commands to either the cameras or to the motion device itself. it would take me less than a minute to add the commands in Pluto, but I don't know enough about motion to know how to tell motion to stop monitoring a camera. Is there an easy way to do that Rob?

as far as specifying extra parameters, the "normal" approach would be to add more device data parameters to the device templates for the camera and motion, and then in the motion code, to use those parameters. The only drawback is then there would be a ton of parameters as there are so many for motion, and this would be confusing for novice users who just want everything to function with the default values.

the other possibility is to create a parameter called simply "parameters" that allows multiple parameters. All Pluto's parameters are free-form and unlimited in size. So rather than creating three parameters called: 'motion threshhold', 'brightness' and 'contrast', we could create one simple parameter and that the user put in stuff he wants added to the motion file:brightness=5contrast=3threshold=6etc.

the other advantage to this approach is that as motion adds more parameters, we don't need to change our code. Instead at start up, those motion wrapper would just take whatever parameterswere there and add them to the motion conf file, letting an advanced user modify any parameters they wanted.

As I'm beginning to understand more about motion I will give here an answer, but obviously Rob may have a better solution.

The easiest solution I've seen is to enable motion http remote control (http port is of course configurable) and use this to pass some comands to motion controlled devices.In a very basic way this could be obtained by executing a bash script like this:

This scripts tells motion to start detection on the first device (0), discarding the html page that motion gives as result.

The motion result format may also be changed from html to text, in order to better parse the motion output and properly process it to update orbiters.

According to what I've seen the actual motion wrapper in Pluto does not include the parameters to enable http remote control, so first step would be to add missing pieces.Then I think it should be a trivial task to add some Scenario or Group command (or whatever best applies) and link it to a list of scripts to manage basic features.

I also agree with the second option you are discussing about extra motion parameters. I think it would be flexible enough to have a single "parameter" that usually is compiled with defaults but that can be modified with whatever additional value by advanced users.

Regarding "pratical experiences" to discuss about, I guess by reading your post that you probably already have a rough idea on some "high level" features to implement in Pluto in order to manage Motion filters, false positives and other stuff.

If this is the case, as a starting point you could give some descriptions on some of these features and maybe we could agree a common preliminary test plan.

First off, I am not that familiar with motion. But I do want the ability to mask what portions of the screen are active. Otherwise I will get way too many hits. Can motion do this and would it be possible for pluto to set it?

masking is a trivial task for motion itself, as you have to build yourself a "mask" i.e. an image with the same dimension of your cam snapshot where you paint in black all those portions that are not supposed to raise any motion trigger.

The point is that with the current version of pluto motion wrapper you cannot configure this feature, because the motion.conf file is rewritten every time that DCE_router is started, and filled in with hard coded parameters.

I know that tinia/Rob is working on that, I guess it will be available in some next releases.

masking is a trivial task for motion itself, as you have to build yourself a "mask" i.e. an image with the same dimension of your cam snapshot where you paint in black all those portions that are not supposed to raise any motion trigger.

The point is that with the current version of pluto motion wrapper you cannot configure this feature, because the motion.conf file is rewritten every time that DCE_router is started, and filled in with hard coded parameters.

I know that tinia/Rob is working on that, I guess it will be available in some next releases.

RegardsMarco

Hi,

I'm currently waiting for custom motion parameter feature to be entered on web interface - I guess then we can include it in motion-wrapper... Beside this I'll try to add alarm signaling in next few days - but without custom parameters that could be cause of false alarms...

I'm also searching for some example code in C to process template files and add some parameters - in this case we would have motion.conf.template file where only necessary things will be overwritten - so this would be much more convenient way beside specifying custom parameters on web interface...

If you have such code, please send it to me (I'm lousy C programmer, so examples are helping me a lot...) ...

If someone wants to contribute - I'll be glad of any help. Then I can concetrate on other things...

I can code in C and would be glad to help. I am still learning the structure of pluto so there is still some fuzziness on how all this hangs together. Right now motion is recording continuously and recycling the images. I haven't delved into how motion gets its config file and how that config file is generated. So it sounds like you plan on intercepting it and adding/removing parameters outside of pluto web forms?