libcamera and libcamera-apps
libcamera is a new software library aimed at supporting complex camera systems directly from the Linux operating system. In the case of the Raspberry Pi it enables us to drive the camera system directly from open source code running on ARM processors.
libcamera presents a C++ API to applications and works at the level of configuring the camera and then allowing an application to request image frames. These image buffers reside in system memory and can be passed directly to still image encoders (such as JPEG) or to video encoders (such as h.264), though such ancillary functions as encoding images or displaying them are strictly beyond the purview of
At Arducam, we added more RPI camera support and improved the existing libcamera with extensive features like auto-focus, external trigger, strobe functions, auto-load camera calibration parameters with our Pivariety solution and modified version of
Picamera2 is not supported on:
- Images based on Buster or earlier releases.
- Raspberry Pi OS Legacy images.
- Bullseye (or later) images where the legacy camera stack has been re-enabled.
You can get more information about libcamera for Raspberry Pi at the following link: Libcamera
libcamera is an open source Linux community project. More information is available at the
For the Pivariety cameras, you need to install the following steps:
Pivariety cameras Board list:
Step 1. Download the bash scripts
Step 2. Install
Step 3. Install libcamera-apps
libcamera-hello is the equivalent of a "hello world" application for the camera. It starts the camera, displays a preview window, and does nothing else. For example
libcamera-jpeg is a simple still image capture application. It deliberately avoids some of the additional features of
libcamera-still which attempts to emulate
raspistill more fully. As such the code is significantly easier to understand, and in practice still provides many of the same features.
To capture a full resolution JPEG image use
libcamera-still is very similar to
libcamera-jpeg but supports more of the legacy
raspistill options. As before, a single image can be captured with
libcamera-vid is the video capture application. By default it uses the Raspberry Pi’s hardware H.264 encoder. It will display a preview window and write the encoded bitstream to the specified output. For example, to write a 10 second video to file use
libcamera-raw is like a video recording application except that it records raw Bayer frames directly from the sensor. It does not show a preview window. For a 2 second raw clip use.
Common Command Line Options
The following options apply across all the
libcamera-apps with similar or identical semantics, unless noted otherwise.
For cameras with focus motors, we have added autofocus parameters to enable single autofocus and continuous autofocus functions.
Example: Continuous automatic photo taking, 1 shot per second within 5 seconds
libcamera-still -t 5000 --datetime -n --timelapse 1000
--help option causes every application to print its full set of command line options with a brief synopsis of each, and then quit.
libcamera-apps will, when they see the
--version option, print out a version string both for
libcamera-apps and then quit, for example:
--list-cameras will display the available cameras attached to the board that can be used by the application. This option also lists the sensor modes supported by each camera. For example:
Available cameras ----------------- 0 : arducam_64mp [9248x6944] (/base/soc/i2c0mux/i2c@1/arducam_64mp@1a) Modes: 'SRGGB10_CSI2P' : 1280x720 [120.03 fps - (2064, 2032)/5120x2880 crop] 1920x1080 [60.04 fps - (784, 1312)/7680x4320 crop] 2312x1736 [30.00 fps - (0, 0)/9248x6944 crop] 3840x2160 [20.00 fps - (784, 1312)/7680x4320 crop] 4624x3472 [10.00 fps - (0, 0)/9248x6944 crop] 9152x6944 [2.70 fps - (0, 0)/9248x6944 crop]
In the above example, the 64MP Hawkeye sensor is available at index 0.