Purism Librem 5 receives major camera update, video recording capabilities

Purism Librem 5 receives major camera update, video recording capabilities

As we tend to mention often, cameras are one of the areas where Linux phones are often seen as lacking behind their Android alternatives. This is partly due to extreme fragmentation of sensor drivers, with most mainlined devices not having any kind of Linux camera support, and just partly due to the lack of a software infrastructure for acquisition and post-processing.

The first camera app for Linux phones was Megapixels, developed by Martijn Braam as a Python GTK3 app for the PinePhone, and now the standard choice for Linux mobiles. Megapixels can be easily extended to new phones with a working kernel camera driver through configuration files, which specify sensor drivers to use, colour processing matrices, how previews are to be displayed, and much more.

postmarketOS / megapixels · GitLab
The GTK camera application

Forking Megapixels, Purism developed Millipixels last year, a device-specific fork of Megapixels to be shipped with the Librem 5. So far, Millipixels has been progressing side by side with Megapixels, with some optimizations and minor differences to support all Librem hardware revisions.

Librem5 / millipixels · GitLab
Legacy API support / Librem 5 fork For packaging see https://source.puri.sm/Librem5/debs/millipixels

However, contributor Pavel Machek has developed an "automatic" photo mode for the Librem 5 in Millipixels, which optimizes the three parameters of the usual "exposure triangle" as in simple digital cameras to get closer to a point-and-shoot experience. A first autofocus algorithm has also been added, as well as support for video recording, which seems to be working smoothly.

This work on autofocus and automatic exposure is now in the bleeding-edge master branch, and should land to the Librem 5 within the next release.

Although this has not been tested with third-party devices, this should be generalizable with relative ease to other camera-supported Linux phones, opening a way to taking pictures from Linux phones without having to manually set gain (ISO), shutter speed and focus manually every time.

The user who first tested this commit, adamd, published a set of test images and videos taken in automatic mode, and they look quite good – maybe also thanks to his careful eye.

Librem5 Automatic Camera Controls
Previous posts that may be of interest that talk more generally about my experience with the Librem 5. 2022-10-14 2022-12-13 Librem 5 Automatic camera controls If you are willing to install / use bleeding edge software you can have automatic controls on the Librem 5. If you want to give it a shot I…

Another recent effort to standardize the complex Linux camera stack is libcamera, which attempts to centralize most core components of the photography stack into a single starting point. Quoting from their FAQ,

libcamera is an open source camera stack for many platforms with a core userspace library, and support from the Linux kernel APIs and drivers already in place. It aims to control the complexity of embedded camera hardware by providing an intuitive API and method of separating untrusted vendor code from the open source core.

libcamera aims to encourage the development of new embedded camera applications by limiting the complexity that developers have to deal with. The interface is designed around the way that modern embedded camera hardware works.
Welcome — libcamera

According to its authors, the libcamera project is to be seen "as the continuation of V4L2", with its API allowing applications to configure the camera and access image frames to be passed directly to image encoders (e.g. JPG) or video encoders (e.g. h.264) for finalization (more here).

Furthermore, libcamera is designed to support also proprietary camera stacks by loading all untrusted binary "blobs" required for image processing in a sandboxed, controlled space.

That is all, for now. With the Linux image stack being slowly demystified, efforts to add support for cameras on more mainlined devices are finally starting to bear fruit.

Via @adamd@social.sdf.org (Mastodon)