fromdatetimeimportdatetime,timeimportosimporttimeastimerpicNumber=0whileTrue:iftime(5,00)<=datetime.now().time()<=time(19,00):picNumber+=1command="raspistill -w 1920 -h 1080 -mm matrix -o cam"+str(picNumber)+".jpg"os.system(command)eliftime(1,00)<=datetime.now().time()<=time(1,02):command="avconv -r 24 -i cam%01d.jpg -r 24 -vcodec libx264 timelapse-"+str(datetime.now().day)+"-"+str(datetime.now().month)+".mp4"os.system(command)command="rm -rf *.jpg"os.system(command)picNumber=0timer.sleep(55)#Remember that taking photo takes 5 seconds#Install this to use avconv: sudo apt install libav-tools#To run this script type: python make-timelapse.py#If you want run it in background, type: python make-timelapse.py &
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.