Many tutorials still use raspistill, raspivid, the picamera Python module, or libcamera-still. On current Raspberry Pi OS none of these is the right tool.
The current stack
| Layer | Tool | Replaces |
|---|---|---|
| Library | libcamera (Raspberry Pi OS uses a Raspberry Pi fork with its own pipeline handler and tuning algorithms) | legacy firmware camera stack |
| Command line | rpicam-apps: rpicam-hello, rpicam-jpeg, rpicam-still, rpicam-vid, rpicam-raw |
raspistill/raspivid, and the libcamera-* names |
| Python | Picamera2 | picamera |
- The apps were renamed from
libcamera-*torpicam-*, and the compatibility symlinks have now been removed. Scripts callinglibcamera-stillbreak. Update them torpicam-still. rpicam-stillemulates many features of the originalraspistill.
rpicam-hello # preview, quick check that the camera works
rpicam-still -o test.jpg
rpicam-vid -t 10s -o test.h264 # 10 s of video
Picamera2 in Python
sudo apt install python3-picamera2 --no-install-recommends # e.g. on Raspberry Pi OS Lite
- It is pre-installed on Raspberry Pi OS desktop images (not Lite).
- Install through apt, not pip. apt gives you Picamera2 and libcamera versions confirmed to work together. In a virtual environment, create it with
--system-site-packagesso it can see the apt package. - Not supported on Buster or older, on "Legacy" images, or when the legacy camera stack has been re-enabled.
- The README labels Picamera2 as a beta release, with the stated aim of avoiding API-breaking changes.
AI Camera (IMX500)
The IMX500-based AI Camera runs networks on the sensor. The ready-made models install with sudo apt install imx500-models. The Picamera2 repository has demo scripts under examples/imx500 for classification, object detection, pose estimation and segmentation.
"Camera not detected": check these first (official troubleshooting)
- The ribbon cable is in the CSI port, not DSI. It fits both, but only CSI works.
- The cable is fully and evenly inserted, contacts facing the right way (also on any adapters).
- The power supply is good enough: the camera adds about 200–250 mA.
- The software is up to date (
sudo apt update && sudo apt full-upgrade). - Preview limits on older boards: Pi 3 and earlier support preview images up to 2048×2048, Pi 4 up to 4096×4096. Larger video widths give corrupted or missing previews.