diff --git a/picamera/camera.py b/picamera/camera.py index 36b1202a..7fa0f9f1 100644 --- a/picamera/camera.py +++ b/picamera/camera.py @@ -2232,7 +2232,7 @@ def _get_config(self): colorspace=self._camera.outputs[0].colorspace ) - def _configure_camera(self, old, new): + def _configure_camera(self, old, new, small_preview=False): """ An internal method for setting a new camera mode, framerate, resolution, clock_mode, and/or ISP blocks. @@ -2304,13 +2304,19 @@ def _configure_camera(self, old, new): cc.max_stills_h = new.resolution.height cc.stills_yuv422 = 0 cc.one_shot_stills = 1 - cc.max_preview_video_w = new.resolution.width - cc.max_preview_video_h = new.resolution.height + if small_preview: + cc.max_preview_video_w = 1920 + cc.max_preview_video_h = 1080 + else: + cc.max_preview_video_w = new.resolution.width + cc.max_preview_video_h = new.resolution.height cc.num_preview_video_frames = max(3, fps_high // 10) cc.stills_capture_circular_buffer_height = 0 cc.fast_preview_resume = 0 cc.use_stc_timestamp = new.clock_mode self._camera.control.params[mmal.MMAL_PARAMETER_CAMERA_CONFIG] = cc + if small_preview: + preview_resolution = mo.to_resolution((1920,1080)) # Clamp preview resolution to camera's resolution if ( @@ -2613,9 +2619,14 @@ def _set_resolution(self, value): "Invalid resolution requested: %r" % (value,)) config = self._get_config() self._disable_camera() - self._configure_camera(config, config._replace(resolution=value)) - self._configure_splitter() - self._enable_camera() + try: + self._configure_camera(config, config._replace(resolution=value)) + self._configure_splitter() + self._enable_camera() + except PiCameraMMALError: + self._configure_camera(config, config._replace(resolution=value), small_preview=True) + self._configure_splitter() + self._enable_camera() resolution = property(_get_resolution, _set_resolution, doc=""" Retrieves or sets the resolution at which image captures, video recordings, and previews will be captured.