Camera error trouble Taking multiple Images

1.Which seller did you purchase the product(s) from?

2.The Model number of the product(s) you have purchased?

3.Which Platform are you using the product(s) on?

4.Which instruction are you following?

5.Has your product ever worked properly?

6.What problems are you experiencing?
Dear Arducam Forum,


i´am using Arducam Camera Module(OV9281, Ov2311) on RPI4/8Gb. I do want to make some images in a row. I wrote a Python function to do so. When I start the function it sometimes works. But not all the time. When I take 10 images the first two are not working. The next some Images are saved in the Folder and in the end it breaks of before taking all Images. I am facing some errors:


mmal Failed to fix lens shading, use the default mode

mmal Enable JPEG encoder

mmal Failed to set cfg

mmal Failed to set rc cfg

mmal Failed to setup components


Allocate memory error

Backend terminated or disconnected. Use Stop/Restart to restart


How to fix these errors?

I don´t know why it works sometimes well and sometimes it occurs an error by calling the same function.

I would like to use .png format to save the files

I do vary the shutter speed earlier in the program. The name will get in index: file_1, file_2 and so on.

My Function: (basically the example code from Arducam)


def OV9281TakeImage(name, shutterspeed):
if name == “main”:
camera = arducam.mipi_camera()
##print(“Setting the resolution…”)
fmt = camera.set_resolution(1280, 800)
#print(“Current resolution is {}”.format(fmt))
#print(“Setting the exposure…” + str(shutterspeed))
camera.set_control(v4l2.V4L2_CID_EXPOSURE, shutterspeed)
#frame = camera.set_raw_callback()#encoding = ‘jpeg’

#frame = camera.capture(encoding = ‘raw’)
frame = camera.capture(encoding = ‘jpeg’)
frame.as_array.tofile(“images//”+ str(name) + “.png”.format(fmt[0],fmt[1]))
del frame # Release memory
#print(“Close camera…”)
except Exception as e:


Any help is appreciated. Thank you very much.
7.What attempts at troubleshooting have you already made?

8.How would you like us to help you?


Thanks for your business. Don’t worry and I will try my best to help you.

Have you tested our arducamstill demo ?