code

import picamera
import time
import os
import socket
import cPickle
a = 0

# Ask for video duration and number of videos
userset_dur = int(raw_input(“Video duration in seconds: “))
userset_comp = int(raw_input(“Lighting compensations: “))
userset_nr = int(raw_input(“Number of videos: “))

while True:
date = time.strftime(“%y%m%d_%H%M_”)
a = a + 1
if a > userset_nr:
break
else:
filename = “TEST”+date+rpi+”.h264″
print(time.strftime(“%H:%M:%S”)+” – Starting up…”)
with picamera.PiCamera() as camera:
camera.zoom = 0,0,1,1
camera.resolution = (1640, 1232)
camera.exposure_compensation = userset_comp
camera.framerate = 24
time.sleep(1)
camera.exposure_mode = ‘off’
camera.awb_mode = ‘off’
camera.awb_gains = gains
camera.sharpness = 0
camera.iso = 200
camera.contrast = 20
camera.saturation = 60
camera.brightness = 50
print(time.strftime(“%H:%M:%S”)+” – Recording video “+filename)
camera.start_recording(filename, quality = 13)
camera.wait_recording(userset_dur)
camera.stop_recording()
print(time.strftime(“%H:%M:%S”)+” – Finished recording video “+filename)