Motion - Feature Request 2006x 07x 06x 213513

Feature Request: External trigger events

Description

We would like to use a telemetry device with motion. The idea is to have the telemetry device sending triggers to motion that should start the recordind at this time.

This feature should be used in combination with the motion detect feature of motion.

The idea is simply to have external event that would be able to trigger an event, for example a bash script, a cron job ...

-- ChristopheMonniez - 06 Jul 2006

Follow up

Comments

i've thought of the same thing, many camera's can be triggered via a gpio connection to start recording. mostly this "trigger" is relayed in the camera's data stream to the camera's recording software ( the method depends on the camera ) and the video stream is recorded.

for the most part, motion ignores these hints.

an external trigger like you suggest would be useful since it can also be used to by some netcams ( with a little bit of "glue" software)

-- EvilPete - 24 Jul 2006

A project I am working on would require something like this as well. Ideally, an 'event' could be triggered either by a motion threshold, or some other external event (most likely over the http remote control interface, for consistency). In my case, I would want to be able to have events triggered by motion thresholds entirely disabled. The use case scenario would be a button of some sort hooked up to a gpio which, when pressed, would cause a video of the preceding 2 seconds to be recorded.

-- ACraigWest - 23 Nov 2007

The trigger is not such a hard thing and could be done with signals, as well as the http control.

But how should it behave? What will tell Motion the event is over?

I have been thinking about a parameter given with the trigger which is the number of seconds the event will last. And must be re-triggerable

-- KennethLavrsen - 24 Nov 2007

Kenneth, when you say the number of seconds the event will last, do you mean the time motion will record in full framerate before giving up? - or will it record just a frame and wait like with gap?

I'm currently using a 2 minute post_capture with audio recording, that way if there is motion within those 2 minutes, I have both the audio+video for the duration - if there is no motion within 2 minutes I have a script that runs on_movie_end that trims the last 2 minutes from the video and joins the audio/video files.

Works really, really well.

-- RomanGaufman - 25 Nov 2007

I hadn't really seen a need for it, but we could add a configuration option for how long to record in this case. Alternatively, we could just use the pre-capture and post-capture time, which would work well in my case, but having a separate setting would make more sense in cases where events could be triggered either by this or by motion. In addition to support for an external trigger, it would be useful to have a way of disabling the actual motion detection (threshold=0 would make sense). It is possible that this already works, I haven't looked into that yet. I could get by with setting the threshold to a value greater than the total number of pixels, as well...

-- ACraigWest - 30 Dec 2007

This would be great for me - I currently have 5 net cameras going - some of them I'd like to trigger with a PIR motion detector (event that I'm currently capturing in the linux box) instead of the frame analysis, because they're subject to a lot of false positives that defy my masking/smartmasking attempts (clouds moving past, doppled tree shadows across the entire area, etc.), while others will do much better with frame analysis. The external trigger would allow me to have a consistent set of good inputs. As for the turn off, I could supply a turn off event, or use a preconfigured duration, or perhaps even just remove all masks and let motion decide when to stop normally - any of these would work for me.

-- JoshHamilton - 14 May 2009

Currently I'm testing something quite messy, I have a serial input/output relay box and a PIR sensor connected to it. Every time the PIR sensor is triggered, I run this:

wget http://127.0.0.1:7001/0/config/set?threshold=300 wget http://127.0.0.1:7001/0/config/set?emulate_motion=on sleep 0.1 wget http://127.0.0.1:7001/0/config/set?emulate_motion=off wget http://127.0.0.1:7001/0/config/set?threshold=99999

I have a gap set to 120 seconds with the smooth video patch (http://www.lavrsen.dk/foswiki/bin/view/Motion/SmoothVideoFromEventStartToStop) and crop the last 120 seconds at the end.

It seems to work really well to avoid motion recording non stop (camera faces a glass wall overlooking a busy street so the mask option isn't useful in that case).

-- RomanGaufman - 20 May 2009

... IT would be very useful if Motion can start capture pictures ordered by a PIR sensor / IR barrier (because Motion is daltonist - http://en.wikipedia.org/wiki/Daltonism / http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionTechnology - I have a lot of false alarms due to sun shadows generated by moving cars that pass near my mask zone... you know, the camera see the moving cars sun shadow reflected on the soil...)

-- FlorinAnton - 12 Jul 2009


I also would like to have this feature implementet

A simple threadX/recstart and threadX/recstop in the web would do it for me.

-- TheOtherBug - 20 Jul 2009

@TheOtherBug you can use threadx/config/set?emulate_motion=on and off

-- RomanGaufman - 26 Aug 2009

Thanks Roman

That option don't seem to exist in 3.2.9 where im stucked until some bugfix of ? made my 3 brands, 4 types of netcam's buggy, get unbugfixed.

I'll look into this feature when things get to work again. smile

-- TheOtherBug - 28 Aug 2009


Roman , not everybody is using svn trunk smile

http://www.lavrsen.dk/foswiki/bin/view/Motion/IntuitiveOptionNamesDiscussion

output_all ( since 3.2.11.1 )

emulate_motion ( in svn trunk)

Description: Picture are saved continuously as if motion was detected all the time.

-- AngelCarpintero - 28 Aug 2009


- SO, let's clarify :

" ...Motion is a program that monitors the video signal from one or more cameras and is able to detect if a significant part of the picture has changed. Or in other words, it can detect motion..." ( In fact, Motion it is a software VIDEO motion detector... )

- as a workaround (for some special situations - see above P.I.R sensors / I.R. barriers) we can use a script shell to record live video stream from our capture card (with ffmpeg, for 2 minutes, for example) :

#! /bin/sh
ffmpeg -an -f video4linux -s 640x480 -b 800k -r 25 -i /dev/video0 -vcodec mpeg4 -t 00:02:00 /home/cctv/my_video.avi

- the last challenge will be : how to launch a shell script in Linux, triggered by an external relay connected to the I/O port (serial / parallel) of the P.C.... (read here : http://www.joethielen.com/phantom/security/ )

-- FlorinAnton - 30 Aug 2009


Topic revision: r14 - 31 Aug 2009, FlorinAnton
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.