How is it possible to get autofocus working along with Picamera2 for IMX519

the continuous Auto focus seems to be broken now, could not get it to refocus at all, usually a light source can get it to re focus


Several people have reported this problem to me. Today, there are other tasks that have delayed the progress of the test. I will definitely test it tomorrow.

1 Like


After version 0.0.10,we have updated the original controls with some changes.
We used a uniform parameter with different modes.

auto focus

libcamera-still -t 0 --afmode auto --autofocus

Continuous auto focus

libcamera-still -t 0 --afmode continuous --autofcous

Manual focus

libcamera-still -t 0 --afmode manual --manualfocus 500

keyboard control focus

libcamera-still -t 0 --afmode manual -k

We will update our doc with sync next week.
Have a nice day.

1 Like

@Edward @Dion

I’m using picamera2 in python with video not cmdline for pictures:


Are you saying that you’ve gotten this to work like it should:


Edit: Pipeline handler being used in another process camera will not initiate

Does not record, does not focus, does not autofocus


picam2.set_controls({“AfMode”: 2})

1 Like

That didn’t work.

Same runtime error camera init sequence did not complete


What’s going on with this?


do you keep it up to date

python3 -m pip install picamera2 --upgrade

Check if the camera is enabled normally

dmesg | grep imx
ls /dev/video*

I put in those commands still not working


Can your camera be opened with libcamera?

libcamera-still -t 5000 -n 


You can’t open the camera now.
I remember you could use the camera normally before, did you do anything in between?

Had to start fresh from a new image but I just followed the arducam pdf and imported the same python script.


before arducam did the kernel update stuff I was getting video but no focus

after you guys fixed it I’m getting neither


Try it again, then restart

./ -p 64mp_pi_hawk_eye_kernel_driver

Recently, the Raspberry Pi has undergone several kernel updates, and it must be the same problem.

1 Like

Okay redid everything again, got the camera working but the autofocus wasn’t working until I changed my script to have:

picam2.set_controls({“AfMode”: 2})

As per @AnotherDredd 's suggestion

@Edward wish you guys would get these commands straight, stick with them(or let people know)and add them to literature, it was supposed to be AFModeContinuous then it got changed to AFTrigger 0 that didn’t work, to me letting you know AFTrigger 1 was the one that actually worked
and now its AFMode 2

1 Like

In doubt, use reference libcamera: libcamera::controls Namespace Reference

1 Like

@Edward Out of no where the camera is failing runtime error camera init sequence did not complete again

I haven’t changed anything since it was working

Same issue


it’s like it’s messing up the python in thonny but is sort of working when I run the python as a autorun

@Edward it’s randomly failing while recording from autostart as well

@Edward @Dion I can’t be the only one that this is breaking on

Please contact [email protected] for further help and post this link.