site logo

How to Install Open Camera Software for Raspberry Pi

An open alternative to propriety libbcm_host.so everyone hates

For the longest time I’ve hated on the propriety Raspberry Pi camera stack. It is propriety, it is non-standard, and it is propriety. It depends on the slow and niche Broadcomm GPU that everyone hates. Even more, only Raspberry Pi OS is supported, which means 32-bit operating system only. It is not a good experience for me.

Some people might say: “Raspberry Pi OS had a 64-bit beta version a year ago!” I tried that, and cameras didn’t work for some reason. Trust me. “Some other people may ask: “But picamera works perfectly!” The Broadcomm GPU based camera stack just sucks in general. It works, painfully. With such niche camera stack and software, could Raspberry Pi foundation really call the Pi a “desktop computer”?

Maybe it could. Raspberry Pi foundation actually supported an alternative camera stack recently: libcamera. libcamera is regarded as the next generation V4L2, a standard APi for camera handling. And it supports Raspberry Pi’s CSI camera. Instead of handling camera in Broadcom’s VPU, it passes camera to ARM cores. It is clearly the future of all Linux camera APIs.

Currently almost all CSI cameras supported by Raspberry Pi are supported. Moreover, the installation is smooth and easy.

Handle camera to ARM core

To utilize libcamera, the CSI camera must first be passed to ARM core.

Edit your config.txt, append dtoverlay=imx219 to its end.

echo "dtoverlay=imx219" >> /boot/config.txt

Install dependencies

Manjaro has all Python dependencies and compilers up-to-date, which is very nice.

sudo pacman -S git boost clang meson ninja python-yaml python-jinja python-ply

Compile and Install libcamera

git clone git://linuxtv.org/libcamera.git
cd libcamera
meson build
cd build
meson configure -Dpipelines=raspberrypi -Dtest=false
cd ..
ninja -C build

And then we install libcamera using the old way.

sudo ninja -C build install

To be honest, libcamera is quite good. With its V4L2 compatibility layers, developing on Raspberry Pis can finally feel like developing on an actual computer. Next I will try some OpenCV applications on my Pi 4.