Morten's Blog


The random output of Morten André Steinsland

Time lapse video with Python

Posted by Morten André on November 7, 2008 at 01:35. In the Music, Video & TV, Python category.
Tags : , , , , ,

This is a time lapse video i made using my digital videocamera and Python, taking a picture every 5th second. It is quite boring so i had to add some music, Rob Costlow’s “Not Alone”

This is the Python script i used:

from VideoCapture import Device
from time import sleep

SecondsBetweenFrames = 5
FilePrefix = "bilde_"
DirectoryToStore = "E:\\Basen\\"
Kamera = Device()
FrameNr = 0

while True:
    FrameNr = FrameNr + 1
    Kamera.saveSnapshot(DirectoryToStore + FilePrefix + str(FrameNr) + '.jpg')
    print "Lagret bilde: " + FilePrefix + str(FrameNr) + '.jpg'
    sleep(SecondsBetweenFrames)

* You’ll need the VideoCapture and PIL Python extensions

Leave a comment

(required)
(required)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress
Theme by Morten Andrè Steinsland
66 queries. 0.135 seconds.