Created
December 26, 2021 07:22
-
-
Save lexrus/2daaf6fde22e56dd77559cc8ca57b240 to your computer and use it in GitHub Desktop.
Record videos for every single minute. Minimum requirements: Raspberry Pi Zero W and 12GB free space.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import picamera | |
from time import sleep | |
import datetime as dt | |
camera = picamera.PiCamera(resolution=(1024, 640), framerate=15) | |
camera.start_preview() | |
sleep(2) | |
camera.annotate_background = picamera.Color('black') | |
camera.annotate_text = dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S') | |
while 1: | |
file_name = dt.datetime.now().strftime('videos/%H_%M.h264') | |
camera.start_recording(file_name) | |
start = dt.datetime.now() | |
while (dt.datetime.now() - start).seconds < 60: | |
camera.annotate_text = dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S') | |
camera.wait_recording(0.2) | |
camera.stop_recording() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment