dear uli
thank you very much for your support. We were choosing the raspi cam to get the possibility of setting manual exposure or at least fixed exposure during each take (we're seeking to use the footage for a video installation and dislike the constant exposure correction we had with the gopro).
unfortunately we still can't reproduce the error of last week. but we got to know that the camera needs more time to find "good" gains.
our recent sketch for the code is:
from time import sleep
from datetime import datetime
from picamera import PiCamera
while True:
with PiCamera() as camera:
camera.resolution = (2592, 1944)
camera.framerate = 25
# The camera's upside down
camera.rotation = 180
# Wait to let the auto-exposure figure out good settings
sleep(3)
# Just in case the wait above isn't enough, wait until the gains are
# sensible
while camera.analog_gain < 1 or camera.digital_gain < 1:
sleep(0.1)
camera.awb_mode = 'off'
camera.awb_gains = (1.5, 1.3)
camera.capture('/DATA/blue_auto_%s.jpg' % datetime.now().strftime('%Y-%m-%d-%H%M%S'))
camera.exposure_mode = 'off'
# Make sure the gains are sensible and bail if they're not
if camera.analog_gain < 1 or camera.digital_gain < 1:
raise RuntimeError('low gains')
# Changed AWB/ISO/etc. here if you want
camera.iso = 100
camera.shutter_speed = 750
camera.capture('/DATA/blue_fixed_%s.jpg' % datetime.now().strftime('%Y-%m-%d-%H%M%S'))
# Set resolution and framerate
camera.resolution = (1280, 720)
camera.framerate = 25
# The camera's upside down
camera.rotation = 180
# Wait to let the auto-exposure figure out good settings
sleep(3)
# Just in case the wait above isn't enough, wait until the gains are
# sensible
while camera.analog_gain < 1 or camera.digital_gain < 1:
sleep(0.1)
camera.awb_mode = 'off'
camera.awb_gains = (1.5, 1.3)
camera.start_recording(
'/DATA/blue_auto_%s.h264' % datetime.now().strftime('%Y-%m-%d-%H%M%S'),
quality=22, bitrate=2000000)
camera.wait_recording(323)
camera.stop_recording()
# Lock the gains
camera.exposure_mode = 'off'
# Make sure the gains are sensible and bail if they're not
if camera.analog_gain < 1 or camera.digital_gain < 1:
raise RuntimeError('low gains')
sleep(0.1)
camera.iso = 100
camera.shutter_speed = 750
camera.start_recording(
'/DATA/blue_fixed_%s.h264' % datetime.now().strftime('%Y-%m-%d-%H%M%S'),
quality=22, bitrate=2400000)
camera.wait_recording(323)
camera.stop_recording()