Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Raspberry pi camera module time-delayed loop.
#!/usr/bin/env python
'''
Usage:
python timed_capture.py
'''
import datetime
from time import sleep
import subprocess
fps = 1 # The number of frames to capture per second.
total_dur = 10 # The total capture time.
'''
The settings above capture 1 frame every second and runs
for a total of 10 seconds. Afterwards you'll have 10 images
captured 1 second apart from each other
'''
for x in range(total_dur):
current_time = str(datetime.datetime.now())
file_name = current_time.replace(' ', '_') + '.jpg'
subprocess.call(['raspistill', '-o', file_name, '-n'])
sleep(fps)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment