Motion Detection script for Video? - Script Writing - CHDK Forum

Motion Detection script for Video?

  • 2 Replies
  • 3157 Views
Motion Detection script for Video?
« on: 20 / February / 2008, 19:44:40 »
Advertisements
Thanks for help, trigger modification to 2ms worked for me :)
Now I have another question: Is it possible to make MD script that turns video recording while motion is detected an records for user-variable amount of time?

Re: Motion Detection script for Video?
« Reply #1 on: 20 / February / 2008, 21:10:10 »
Deleted
« Last Edit: 22 / April / 2008, 12:36:43 by Barney Fife »
[acseven/admin commented out: please refrain from more direct offensive language to any user. FW complaints to me] I felt it imperative to withdraw my TOTAL participation. Nobody has my permission, nor the right, to reinstate MY posts. Make-do with my quoted text in others' replies only. Bye

Re: Motion Detection script for Video?
« Reply #2 on: 22 / February / 2008, 14:12:57 »
I've made one of those scripts in a simple way. It's based on the motion detection scripts for pictures by mx3 and Barney Fife that can be found on this forum. I added a parameter j and let the script sleep for j seconds after the video button has been clicked (could be set to minutes too of course) and after the sleep time the video button will be clicked again. The trigger delay must be a bit longer because it takes a while before the video has been written to the SD card. The following script is for the S series, I suppose it has to be modified for cameras that don't have a video button.

Code: [Select]
@title MD Security Camera
@param a Columns
@default a 6
@param b Rows
@default b 4
@param c Threshold (0-255)
@default c 10
@param d Compare Interval (millisecs)
@default d 10
@param e Trigger Delay (0.1 secs)
@default e 40
@param f Rows to Exclude
@default f 0
@param g Pix-Step(speed/accuracy adj)
@default g 8
@param h Reg Mode(0-no,1-incl,2-excl)
@default h 0
@param i Measure Mode(1-Y,0-U,2-V)
@default i 1
@param j Video Length (secs)
@default j 30
if a<1 then a=1
if b<1 then b=1
if c<0 then c=0
if g<1 then g=1
if f<1 then f=1
e=e*100
print ">[";a;",";b;"] threshold: ";c
x=30000
t=0
j=j*1000
:md
do
md_detect_motion a, b, i, x, d, c, 1, t, h, 1, 1, a, f, 0, g, e,
until t>0
click "video"
sleep j
click "video"
goto "md"
end

But I don't find this very interesting, I'd rather have a script where the video stops recording when no motion has been detected anymore for a j amount of time. I've tried a lot of things but I can't get it to work. So if anyone has an idea how this can be done please post it.

 

Related Topics