Motion Detection?

Eliasstriker

New Member
Hi i dont really know where i have to post my Question. My question is there a script for Motion Detection that starts the recording when someone is in the area of the camera and stopps it after some time when no motion is detected.

I want to build a little security system that starts recording when someone is in the room.
 

toplachi

Member
Try the Advanced Scene Switcher
More info
 

someonelse

New Member
Try the Advanced Scene Switcher
More info
Thanks!!! That pretty much solves the problem!
 

rajhlinux

New Member
Try the Advanced Scene Switcher
More info

Thanks this is actually suffice to do the job. I needed something that has motion detection from a recording CCTV live feed and would like to take screen shots to know when motion has been detected. This actually does well.

I'm really surprised of how many immense quality features this plugin tool have for testing different types of condition states.
 

Interacdiv

New Member
Thanks for this post, it helped me get set up just how I wanted. It took some trial and error getting it set up because the wiki page doesn't have all of the settings required especially about how to automate stopping the record, so I just wanted to add some details on how I've set it up in case that helps others. This set of values isn't going to be right for everyone, but I think it will get people up and running a bit quicker. I was setting this up to record a bird in a bird box, hence the naming of things. My camera device is called "Video capture device".

I set it to sample the conditions only once every second, so that it will need at least a second of movement to start the recording, so it doesn't get triggered by anything too insignificant.

The threshold settings were a little confusing at first. Basically the close the value is to 1 the more easily it will be triggered. A value of 1 means even the slightest change in the video feed will trigger it. A lower value means it takes more movement to trigger the "video -> has changed" condition. But that drops off pretty rapidly, and I found I needed a fairly high sensitivity, 0.999, or quite significant movement wouldn't trigger it. That might differ for more sensitive cameras. When I tried 0.9999 it started over and over again just from the noise in the signal. But 0.99 did nothing.

I set the 10 second wait time on the stop so that I didn't end the recording every time the motion stops for a few seconds, leaving me with tonnes of tiny video files. This way the videos will all be at least 10 second long, and if movement resumes in that time it will carry on recording in the one file. In this instance the bird does often come in and out of the box for about 10 seconds at a time and then go away for hours, so it makes sense to have this time period. For other situations you might want to records for at least x seconds/minutes/hours once motion is detected if you know it will be a long continuous period.

Anyway, I'm going to attach 3 screenshots showing the general settings and the Start and Stop macros I set up. Hopefully this will help others get started more quickly - though it's likely you'll need to play around, especially with the Check Conditions frequency, patter matching threshold, and maybe the "For at least" time in the stop macro.
 

Attachments

  • 3stopMacro.png
    3stopMacro.png
    40.3 KB · Views: 1,197
  • 2startMacro.png
    2startMacro.png
    40.3 KB · Views: 1,177
  • 1main.jpg
    1main.jpg
    37.7 KB · Views: 1,181

birbfan777

New Member
Thanks for this post, it helped me get set up just how I wanted. It took some trial and error getting it set up because the wiki page doesn't have all of the settings required especially about how to automate stopping the record, so I just wanted to add some details on how I've set it up in case that helps others. This set of values isn't going to be right for everyone, but I think it will get people up and running a bit quicker. I was setting this up to record a bird in a bird box, hence the naming of things. My camera device is called "Video capture device".

I set it to sample the conditions only once every second, so that it will need at least a second of movement to start the recording, so it doesn't get triggered by anything too insignificant.

The threshold settings were a little confusing at first. Basically the close the value is to 1 the more easily it will be triggered. A value of 1 means even the slightest change in the video feed will trigger it. A lower value means it takes more movement to trigger the "video -> has changed" condition. But that drops off pretty rapidly, and I found I needed a fairly high sensitivity, 0.999, or quite significant movement wouldn't trigger it. That might differ for more sensitive cameras. When I tried 0.9999 it started over and over again just from the noise in the signal. But 0.99 did nothing.

I set the 10 second wait time on the stop so that I didn't end the recording every time the motion stops for a few seconds, leaving me with tonnes of tiny video files. This way the videos will all be at least 10 second long, and if movement resumes in that time it will carry on recording in the one file. In this instance the bird does often come in and out of the box for about 10 seconds at a time and then go away for hours, so it makes sense to have this time period. For other situations you might want to records for at least x seconds/minutes/hours once motion is detected if you know it will be a long continuous period.

Anyway, I'm going to attach 3 screenshots showing the general settings and the Start and Stop macros I set up. Hopefully this will help others get started more quickly - though it's likely you'll need to play around, especially with the Check Conditions frequency, patter matching threshold, and maybe the "For at least" time in the stop macro.
I was looking for a motion detection plugin in OBS and this thread helped me out, but I was also doing this to record birds so this comment was immensely helpful because I also had some issues figuring out how to stop the recording and configure the macros properly. Thanks a lot toplachi and Interacdiv. Best of luck with your birdwatching!
 

lkobescak

New Member
Thanks for this post, it helped me get set up just how I wanted. It took some trial and error getting it set up because the wiki page doesn't have all of the settings required especially about how to automate stopping the record, so I just wanted to add some details on how I've set it up in case that helps others. This set of values isn't going to be right for everyone, but I think it will get people up and running a bit quicker. I was setting this up to record a bird in a bird box, hence the naming of things. My camera device is called "Video capture device".

I set it to sample the conditions only once every second, so that it will need at least a second of movement to start the recording, so it doesn't get triggered by anything too insignificant.

The threshold settings were a little confusing at first. Basically the close the value is to 1 the more easily it will be triggered. A value of 1 means even the slightest change in the video feed will trigger it. A lower value means it takes more movement to trigger the "video -> has changed" condition. But that drops off pretty rapidly, and I found I needed a fairly high sensitivity, 0.999, or quite significant movement wouldn't trigger it. That might differ for more sensitive cameras. When I tried 0.9999 it started over and over again just from the noise in the signal. But 0.99 did nothing.

I set the 10 second wait time on the stop so that I didn't end the recording every time the motion stops for a few seconds, leaving me with tonnes of tiny video files. This way the videos will all be at least 10 second long, and if movement resumes in that time it will carry on recording in the one file. In this instance the bird does often come in and out of the box for about 10 seconds at a time and then go away for hours, so it makes sense to have this time period. For other situations you might want to records for at least x seconds/minutes/hours once motion is detected if you know it will be a long continuous period.

Anyway, I'm going to attach 3 screenshots showing the general settings and the Start and Stop macros I set up. Hopefully this will help others get started more quickly - though it's likely you'll need to play around, especially with the Check Conditions frequency, patter matching threshold, and maybe the "For at least" time in the stop macro.
Thanks boss, I appreciate you taking the time to write this up. It was exactly what I needed. Thanks for the help.
 
Hi all, that's really helpful. I want to record my repair desk (with 4 cameras) every time I sit to repair something (and it's triggered watching just the overhead camera). I would like to trigger from 1 camera the recording of 4 cameras connected to OBS, is that possible? On the macros I couldn't see anything related, only triggering the source you are watching. Can some one help me? Thanks a lot
 

Ducman

New Member
I followed above instructions and it worked well. What I really would like is a plugin that uses the camera detection signal over ONVIF to trigger the recording. Is there anything in development for this? Thanks.
 

Ernie F

New Member
This helps with how one might use the motion detection and some of the options. Are there any other descriptions of the arguments available in this macro? I have implemented a state machine to monitor a camera rtsp video stream so I can detect when there is no motion. At that point, I can switch scenes and the camera connection closes. I then switch back to the scene and the camera connection restarts. The issue I am having is waiting long enough for the video stream to not be seen as no-motion. I have tried to used the duration modifiers to do something like: if video has has not change for 20 sec. But it behaves like this additional condition is being ignored. Here is the sequence of events: video is working and then freezes. The condition triggers as expected. I switch away from this scene to another so the camera connection closes. After several seconds (3-30 is the range I've tried), I switch back to the scene containing the video stream. The log show the connection reopens. I see the new video is changing. I then wait several more seconds (again 3-30 is range attempted) and then enable the check for video not changed. And the fires as if the video was frozen ... sometimes. I have tried putting logging conditions that run in parallel and if see the video is still showing no motion even though I see the video is not frozen in OBS. Any ideas on where I can learn more about how to determine when a video is frozen and then becomes un-frozen?
 

Ernie F

New Member
Here is an example of my video no-motion macro: The ParmS5NoMotSec = 21 in this example
 

Attachments

  • frozenVideoDetection.png
    frozenVideoDetection.png
    37.6 KB · Views: 12

Ernie F

New Member
I found something that works for me ... pause and unpause the macro. It isn't obvious when the check begins for the video changing or not changing. However, it seems that unpausing the macro seems to reset the beginning of the time period that the video is monitored for either "has changed"/"has not changed".

So in my state machine, when my camera connection first comes up, or after it has stalled, I switch to another scene and then back to the camera scene ; this reconnects the camera RTSP connection as a Media Source). During these states of my FSM, the macro monitoring for video "has not changed" is paused. Then after waiting a few seconds after these scene switches (to allow the camera connection to come up), I then unpause the macro as I transition into the monitoring video stall state. This seems to reset the time window that the video is being monitored.

I did find some issues with using the "Reduce CPU load ... " option. When I had this option set, sometimes it took 10 minutes or more to detect the video "has not changed". I tried playing around with that option, combined with the condition duration modifier, and the macro "Check conditions of the current selected macro at customer interval ...". Attached are screenshots of what seems to work. If anyone has more insight into the relationships are between the "Reduce CPU" option, the macro condition "duration modifier" and the macro settings "Check conditions ... at custom interval" ... I am interested to learn more. Enjoy!
 

Attachments

  • MacroVidFreeze.png
    MacroVidFreeze.png
    71.3 KB · Views: 7
  • MacroSettings.png
    MacroSettings.png
    63.5 KB · Views: 7
Top