Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8041

Camera board • Re: How to capture a still image without X.Org/Wayland?

$
0
0
Hi, and thanks for the question. Let me start with a bit of background.

The problem, so far as I recall (and this is taking me back quite a while), is that a few years back we started using libav/ffmpeg. These depend on a large number of graphical/GUI packages, and there's no (feasible) way of installing a version that gives you just the functionality related to encoders and container formats. There were outstanding issues raised about this at the time, but no one was doing anything about it. It's my belief that nothing has changed here, but perhaps someone can correct me here if that's now incorrect.

Anyway, you do have some options.

1. Use rpicam-apps

There is a "lite" version of rpicam-apps which comes installed in a lite OS image. These versions won't support video encoding on a Pi 5, nor will they support audio recording or true container formats (such as "mp4" files) on any platform. However, it should be fine for still images, and indeed video recording on earlier Pis so long as you can cope with a flat unformatted output file. (There is an extra package which will supply the missing features, but of course, it drags in a lot of dependencies!)

2. Install python3-picamera2 with --no-install-recommends

This does shrink the install footprint a bit, about 200MB when I tried it.

3. Use python3-picamera2 anyway (with or without "--no-install-recommends")

Even with "--no-install-recommends" it will take up a certain amount of disk space. But that is all it does. You don't have to use the desktop environment, and the files will just sit there doing nothing, and it should run just as well as a hypothetical "minimal" installation. Is this a workable solution?

4. Don't install Picamera2, just clone it and install the dependencies you want for yourself

To do this, install git first then clone https://gihub.com/raspberrypi/picamera2.git and put "export PYTHONPATH=/path/where/you/cloned/picamera2" into your .bashrc. Maybe delete the .git folder in your cloned repository, that's over 150MB right there!

Then apt install the following modules: python3-libcamera python3-numpy python3-pil python3-videodev2 python3-prctl python3-piexif python3-simplejpeg python3-pidng python3-kms++

Just as a note, it's python3-av that we *haven't* installed. These are the Python libav/ffmpeg libraries, which occupy some 500MB.

Unfortunately you're going to have to edit 2 or 3 of the picamera2 source files just to comment out some imports (of the packages not installed). Obviously this will leave Pi 5 video encoding, audio support, and all container formats non-functional (just as we have with the lite rpicam-apps).

I think this takes the extra install down to about 100MB. Let me know if you want to try this route.

5. Use python3-libcamera

You're right in that this must be possible, but I've never tried it. It's much lower level and should follow the C++ API very closely, so working your way through picamera2 code, or the rpicam-apps, should give you an idea what to do. This sounds like quite a lot more work than options 1-3, and even option 4.

Statistics: Posted by therealdavidp — Wed Dec 10, 2025 2:25 pm



Viewing all articles
Browse latest Browse all 8041

Trending Articles