"OSError: Unexpected image geometry" when overriding Mjpeg size


I’m using this to set up a mjpeg object and checking if it has indeed the correct size:

self.video = mjpeg.Mjpeg(video_filename, width=320, height=240)
print(self.video.width(), self.video.height())

The size seems to be set correctly.

Then I try to add frames using:


The frame size is a constant 640px x 480px (VGA), i.e. 2x the size defined for the mjpeg object (I’ve checked that as well). So I would expect it to be fairly easy to scale the image.
img is an image object as returned by sensor.snapshot(). I’m draing into the framebuffer, but I’m not doing any format conversions or any rescaling.

The library reference for mjpeg states "Add an image to the mjpeg recording. The added image is automatically scaled up/down while preserving the aspect-ratio to the resolution specified when the mjpeg file was created."
However I’m getting “OSError: Unexpected image geometry” whenever add_frame() is called.

Any ideas what I could be doing wrong here?
Thank you


Hi, you need to update to the latest unreleased firmware. See the openmv github and software releases: Release Development Release · openmv/openmv · GitHub

Yes, that solves the issue.