Skip to content

Instantly share code, notes, and snippets.

@benhosmer benhosmer/timed_capture.py
Last active Dec 17, 2015

Embed
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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.