This repo contains a working tuning file for Arducam IMX519 AF (board rev B0371) that enables autofocus on Raspberry Pi OS Bookworm (arm64) with newer kernels (≥ 6.12.x) without downgrading the kernel or installing custom Arducam .deb stacks.
- Copy the provided tuning file:
sudo mkdir -p /usr/share/libcamera/ipa/rpi/vc4
sudo cp tuning/imx519.json /usr/share/libcamera/ipa/rpi/vc4/imx519.json
# Optionally for pisp:
sudo mkdir -p /usr/share/libcamera/ipa/rpi/pisp
sudo cp /usr/share/libcamera/ipa/rpi/vc4/imx519.json /usr/share/libcamera/ipa/rpi/pisp/imx519.json- Test autofocus:
rpicam-hello -t 4000 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx519.json --autofocus-mode continuous --autofocus-range normal --autofocus-speed normal- Low-latency RTP stream to Mission Planner (UDP 5600):
rpicam-vid -t 0 --width 1280 --height 720 --framerate 30 --codec h264 --inline --intra 15 --nopreview --bitrate 2500000 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx519.json --autofocus-mode continuous --autofocus-range normal --autofocus-speed normal --shutter 33333 --gain 8 --metering centre --ev 1 --denoise auto -o - | gst-launch-1.0 -v fdsrc ! h264parse config-interval=1 ! rtph264pay pt=96 config-interval=1 mtu=1200 ! udpsink host=10.0.0.3 port=5600 sync=false async=falseMission Planner → Setup → Optional Hardware → UDP Video → set port 5600.
systemd/wg-video.service:
[Unit]
Description=Low-latency H264 stream with AF
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=pi
Restart=always
RestartSec=2
ExecStart=/bin/bash -lc 'rpicam-vid -t 0 --width 1280 --height 720 --framerate 30 --codec h264 --inline --intra 15 --nopreview --bitrate 2500000 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx519.json --autofocus-mode continuous --autofocus-range normal --autofocus-speed normal --shutter 33333 --gain 8 --metering centre --ev 1 --denoise auto -o - | gst-launch-1.0 -v fdsrc ! h264parse config-interval=1 ! rtph264pay pt=96 config-interval=1 mtu=1200 ! udpsink host=10.0.0.3 port=5600 sync=false async=false'
[Install]
WantedBy=multi-user.targetEnable:
sudo systemctl daemon-reload
sudo systemctl enable wg-video
sudo systemctl start wg-videoThe IMX519 sensor and AK7375 lens actuator are detected by the kernel (V4L2 subdevs), but recent libcamera builds might miss an AF-capable tuning file. Using a known-good imx519.json (CDAF/PDAF enabled) restores autofocus without kernel downgrades.
Source JSON from Arducam libcamera branch:
https://github.com/ArduCAM/libcamera/blob/arducam/src/ipa/rpi/vc4/data/imx519.json
- Arducam
- libcamera
- Raspberry Pi community