Gilad Gilad - 1 year ago 87
Python Question

RPi2 - Taking images while recording video

In an effort to make a simple surveillance camera I want to record video as long as there is movement. For that I need to analyze an images every second or so. I would like to start capturing video and stop only after deciding that there is no more movement, for that I need to capture an image while video is recording.

What is the easiest way to do this on RPi2-Python3

Answer Source

Picamera has a 'built in' solution for this

import picamera

with picamera.PiCamera() as camera:
    camera.resolution = (800, 600)
    camera.capture('foo.jpg', use_video_port=True)

taken from:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download