diff --git a/picamera2/picamera2.py b/picamera2/picamera2.py index 95d3deec..047edadc 100644 --- a/picamera2/picamera2.py +++ b/picamera2/picamera2.py @@ -641,7 +641,7 @@ def _make_initial_stream_config(stream_config: dict, updates: dict, ignore_list= """ if updates is None: return None - valid = ("format", "size") + valid = ("format", "size", "stride") for key, value in updates.items(): if isinstance(value, SensorFormat): value = str(value) @@ -839,6 +839,11 @@ def _update_libcamera_stream_config(libcamera_stream_config, stream_config, buff libcamera_stream_config.size = libcamera.Size(stream_config["size"][0], stream_config["size"][1]) libcamera_stream_config.pixel_format = libcamera.PixelFormat(stream_config["format"]) libcamera_stream_config.buffer_count = buffer_count + # Stride is sometimes set to None in the stream_config, so need to guard against that case + if stream_config.get("stride") is not None: + libcamera_stream_config.stride = stream_config["stride"] + else: + libcamera_stream_config.stride = 0 def _make_libcamera_config(self, camera_config): # Make a libcamera configuration object from our Python configuration.