Skip to content

Preparing on Linux with libcamera (for PiCam)

Software requirements

The demo application uses the open-source GStreamer software. In live camera mode, this Linux version connects to a RaspberryPi PiCam with libcamera. It can be used for other cameras, but for this demo it is only recommended to be used in case an actual PiCam is used on a Raspberry Pi. Before running the application, GStreamer, its plugins, and libcamera need to be installed. This section explains how to do that. Let's start with GStreamer.

On a RaspberryPi OS Linux system all Gstreamer prerequisites can be installed as follows:

sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
  libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base \
  gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
  gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-gl \
  gstreamer1.0-plugins-base-apps
In case of issues with the above or for other Linux installations, please see the official GStreamer documentation. Make sure to install both the base GStreamer software as well as all the plugin sets: good, bad, and ugly.

Next we need to install the libcamera package with its GStreamer plugin. We'll have to do this from source, following these instructions. In essence this just means running the following commands (recommended to become root first):

apt install libyaml-dev python3 python3-pip python3-yaml python3-ply \
  python3-jinja2 ninja-build git build-essential
pip3 install meson
git clone https://git.libcamera.org/libcamera/libcamera.git
cd libcamera
git checkout a64d17b9cff1b7361ebea31b7ae1dc1357493670
meson build
ninja -C build install
The above script checks out a particular commit. This was the latest commit at the time of testing by Plumerai. If any issues are encountered, first try to check out the latest commit instead (i.e. git checkout master).

If it turns out to be too difficult or impossible to build libcamera and its GStreamer plugin on the target system, then Plumerai can also provide a pre-built package that can be unzipped into /usr/local as root. We provide this only on request, because this might have incompatibility issues with your system: building from source is preferred.