Capture Mode "Motion Triggered" and "Interval Snapshots" in parallel?

1,859 views
Skip to first unread message

Jürgen Böcker

unread,
Jun 3, 2017, 5:45:21 AM6/3/17
to motioneye
Is there any plan for future versions to enable the settings "motion triggered" and "interval snapshots" in parallel?

Use-Case:  I want to capture any movement in my private garden  - but in parallel I'm interested in collecting every day a snapshot for a stop-motion movie how my plants are growing over the time...

Is there already today a possibility to trigger a snapshot right away by either a ssh command or an URL-command or an hardware IO-pin?  This would be helpful as well :)

cheers.

Calin Crisan

unread,
Jun 3, 2017, 9:30:28 AM6/3/17
to motioneye
It's very unlikely that this would happen in the near future, given the way motion works.

Jürgen Böcker

unread,
Jun 4, 2017, 5:01:55 AM6/4/17
to motioneye
Ok, sad to hear but understandable.
Anyway thank you for quickly replying and for sharing your wonderful program!

Cheers.

Tim Donovan

unread,
Jun 7, 2017, 6:33:39 AM6/7/17
to motioneye
What you could do is use cron to run a script that would daily:

shutdown the motioneye process
use the command line raspistill to take a picture (I've checked and its included in motioneyeos on a pi)
restart the motioneye process
Message has been deleted
Message has been deleted

Jürgen Böcker

unread,
Jun 11, 2017, 12:22:47 PM6/11/17
to motioneye
Thank you for your hint pointing to existing component raspistill  :)
By this I'd managed to get in addition to the "motion triggered snapshots" as well a snapshot every day at noon!

If anybody is searching for the same - this is how it's working on my side:
This will shutdown MotionEyeOS every day at 12:00 oClock, takes a picture and restarts MotionEyeOS again:
  • Install MotionEyeOS - standard setup as documented (Raspberry Pi)
    the local storage for your pics is /data/output (default)
  • logon your MotionEyeOS with SSH
  • mount the filesystem with write-access:  
    • mount -o remount,rw /
  • create a sub-directory
    • md /data/output/cyclic
  • create a script-file and copy the script into it:
    • nano /usr/sbin/take_cyclic_pic.sh
    • copy the following into the script-file:
      echo -e "Start: " $(date) >> /data/output/snapshot.log
      /etc/init.d/S85motioneye stop
      raspistill -vf -hf -ae 32,0xff,0x808000 -a 4 -a "Garden %Y-%m-%d %X" -o /data/output/cyclic/"$(date +"%Y%m%d_%H-%M-%S")"_Garden.jpg
      /etc/init.d/S85motioneye start
    • save and close editor by Ctrl+o   and     Ctrl-x
  • make the file executable
    • chmod 777 /usr/sbin/take_cyclic_pic.sh
  • Add entry into crontab to run the script everyday at 12:00 oClock
    • crontab -e
    • add the following line and ensure, that there is an additional empty line at the end of the crontab (check with crontab -l   afterwards):
      • 0 12 * * * /usr/sbin/take_cyclic_pic.sh
    • save and close editor with Ctrl-o    and   Ctrl-x
  • ready :)


you can test the script by running it form your SSH connection with     /usr/sbin/take_cyclic_pic.sh

this was easier than expected - thanks or your hint, Tim  --- and of course thanks again to Calin for the wonderful MotionEyeOS  :)

ste...@hotmail.com

unread,
Jul 1, 2017, 5:00:11 PM7/1/17
to motioneye
How can I output this to a network folder ?

Marius

unread,
Sep 2, 2017, 6:14:28 AM9/2/17
to motioneye
Thank you, Jürgen for the script, and certainly Calin for the great software !

And a couple of "stupid questions":
1. Why is it needed to shutdown motioneye before taking the still picture ?
2. @Calin: Is it possible to do some tricks to save the picture taken by Jürgen's script to GDrive ? GDrive is already configured for Motion Triggered images
3. I use an IP Cam in my setup ... Would it be possible to have a second component running inside MotionEyeOS who connects to the same IP Cam, but still works independently of motioneye and takes still images according to a certain schedule ? I mean I can understand there could be restrictions / conflicts when having a camera excusively attached to the PI; But in my case everyone can access my IP Cam, so why not a second process inside the OS ? Something like still extending motioneye OS (at least) for IP Cams.

My use case is quite easy to describe and hence I feel finding a solution for it could be of interest for more users:
When I'm not at home for several days, and I get no motion notification is it because there was indeed no motion, or because some component in my setup failed ?
1-4 Still images / day would IMO be able to provide a good answer to this.

Marius

unread,
Sep 20, 2017, 2:46:49 PM9/20/17
to motioneye
Any info, please ?

Marius

unread,
Oct 5, 2017, 5:41:09 PM10/5/17
to motioneye
So once again, my use case:

When I'm not at home for several days, and I get no motion notification is it because there was indeed no motion, or because some component in my setup failed ?
several still images / day would IMO be able to provide a good answer to this.

My camera: a Network Camera

my script

mEyeConf="/data/etc/motioneye.conf"
threadConf="/data/etc/thread-1.conf"

targetDir=$(cat $threadConf | grep -E '^target_dir' | cut -d ' ' -f 2)

myDate=$(date +"%Y-%m-%d")
myHour=$(date +"%H-%M-%S")
fileName=$targetDir/static/$myDate/$myHour.jpg

curl -H 'Authorization: <as shown in Chrome by Developer tools when visiting camera_s URL for static images> ' -o "$fileName" --create-dirs http://<cameraIP>/<path for static images>
/usr/lib/python2.7/site-packages/motioneye/scripts/relayevent.sh $mEyeConf picture_save 1 "$fileName"


run every 30 min:
*/30 * * * * /tmp/scr.sh

In my case this gets a picture from the network camera every 30 minutes and uploads it to my gdrive in a folder called "static"
Still not tested if it works if the static upload happens in parallel to a motion, but as I understand the code, this should be no problem.

Marius

unread,
Oct 23, 2017, 2:45:53 PM10/23/17
to motioneye
And you better backup the file you created; as at least after a reboot it will disappear. The solution would be to create it in a more "stable" place, as Jürgen explained above. I however wonder if the file created by Jürgen's description will resist to an upgrade. Any hint on this ?

Jürgen

unread,
Jan 6, 2018, 5:32:36 AM1/6/18
to motioneye
sorry for my late answer - I've been offline quite a while...

I'm saving these pictures indeed to a network folder - you can mount a network share to a folder of your choice on the Raspberry - and than just save the pictures with to script above into it.

I've mounted my WD NAS as a network share:
    • logon your MotionEyeOS with SSH
    • mount the filesystem with write-access:
      • mount -o remount,rw /
    • edit userinit.sh to mount the network share at startup
      • nano /data/etc/userinit.sh
    • add the following line to it (you've to change YOUR_PASSWORD and as well the IP-address of your network drive including the folders
      • mount -t cifs -o username=motioneye,password=<YOUR_PASSWORD> //192.168.178.45/MotionEye /data/output/cyclic >/var/log/mountNAS01_output.log 2>/var/log/mountNAS01_errors.log
    • save and close editor by Ctrl+o   and     Ctrl-x

      that's all...

      Jürgen

      unread,
      Jan 6, 2018, 5:40:09 AM1/6/18
      to motioneye
      Hi Marius,

      sorry for my late answer...


      1. Why is it needed to shutdown motioneye before taking the still picture ?
       
      --> motion seems to "occupy" the camera  so that raspistill can't get (easily) a parallel access to it...


      2. @Calin: Is it possible to do some tricks to save the picture taken by Jürgen's script to GDrive ? GDrive is already configured for Motion Triggered images

      --> this would be interesting for me as well :)    --  right now I'm saving all images to my local NAS and I'm using another PI (which I'm using for FHEM house automation) to copy some of these pictures to GDrive...
            not really the easiest way - but at least it's working and I can do some sorting and converting upfront  - as well as some housekeeping (e.g. delete the oldest ones...)

       
      3. I use an IP Cam in my setup ... Would it be possible to have a second component running inside MotionEyeOS who connects to the same IP Cam, but still works independently of motioneye and takes still images according to a certain schedule ? I mean I can understand there could be restrictions / conflicts when having a camera excusively attached to the PI; But in my case everyone can access my IP Cam, so why not a second process inside the OS ? Something like still extending motioneye OS (at least) for IP Cams.

      --> sounds reasonable - I've no IP Cam attached, so I can't test...
       
      My use case is quite easy to describe and hence I feel finding a solution for it could be of interest for more users:
      When I'm not at home for several days, and I get no motion notification is it because there was indeed no motion, or because some component in my setup failed ?
      1-4 Still images / day would IMO be able to provide a good answer to this.

      --> this is exactly me use case too    :)

      Jürgen

      unread,
      Jan 6, 2018, 5:47:54 AM1/6/18
      to motioneye


      Am Montag, 23. Oktober 2017 20:45:53 UTC+2 schrieb Marius:
      And you better backup the file you created; as at least after a reboot it will disappear. The solution would be to create it in a more "stable" place, as Jürgen explained above. I however wonder if the file created by Jürgen's description will resist to an upgrade. Any hint on this ?


      I agree - these additional scripts are only fully functional as long as MotionEyeOS does not get changed too much - cause Calin of course does not know them and can not take care  ;)

      But yes, up to now my scripts are surviving a power-down - power-up cycle and as well the last two updates of MotionEyeOS.
      Never the less I've noted down every little step in order to be able to reinstall it from scratch in just a few minutes - without thinking about the details again and again (e.g. if after quite a while an update of MotionEyeOS will fail...) 

      Jürgen

      unread,
      Jan 6, 2018, 5:49:57 AM1/6/18
      to motioneye

      sorry -  I've forgotten to mention:  of course you've to reboot the PI   in order to get the network share mounted for the first time ....


      Reply all
      Reply to author
      Forward
      0 new messages