Skip to main content

Library to pick out motion from a stream of images.

Project description

Easily pick out and save images which contain motion from a stream of images.


  • Send images into the MotionSaver, and it’ll save the ones with motion.
  • Optionally save images from before and after motion occurs.
  • Easy to configure and use.


  • Python 3.5 or above
  • Pillow 4+


pip install motion-saver

Quick start


Save a stream of images

Continuously add a stream of images to the Motion Saver. When motion is detected it will save the previous 30 seconds of images, and keep saving until 20 seconds has passed since the last motion was detected.

from datetime import datetime

from motionsaver import MotionSaver

ms = MotionSaver()
ms.motion_threshold = 0.1
ms.save_previous_seconds = 30
ms.save_post_seconds = 20

while True:
    now =

    pillow_img = get_image()
    filename = '{}.jpg'.format(now.strftime('%Y%m%d-%H%M%S'))

    ms.add_image(pillow_img, now, filename)


camgrab is free software, distributed under the MIT license.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for motion-saver, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size motion_saver-0.1.0-py3-none-any.whl (4.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size motion-saver-0.1.0.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page