Raspberry Pi Camera capture with MBS plugin - not working

Has someone recently used the RaspberryPiCameraMBS class with a Raspi 5?

Even running the MBS-provided example, when hitting the Initialize button, I get no errors but no images are captured or shown, either.

The “camera.Capture” call returns false.

The camera properties are shown, though. I also tried opening /dev/video1 and higher to no avail.

I have verified that the camera works with the “libcamera-hello” command.

Here’s a basic test code:

dim cam as new RaspberryPiCameraMBS
if not cam.Open() then
  break
end if

if not cam.SetSize(640, 480) then
  break
end if

if not cam.Capture() then
  break
else
  dim p as Picture = cam.Picture
  break
end if

The error I find in the cam object says (in German):

Unpassender IOCTL (I/O-Control) für das Gerät

In English it means “Invalid IOCTL”

Which sounds like an error in the way the capture API is called.

I fear that they changed something for Pi5 or for Debian 12 and the MBS plugin hasn’t been updated accordingly.

That may be it. Well, maybe you look for some other way to use the camera for now.

I experienced the same and found that you can work around this easily with a shell command addressing rpicam, like

sh.Execute("rpicam-still -o /home/uli/timelapse/"+fname+".jpg --vflip --hflip --qt-preview --mode 4608:2592 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx708_wide_noir.json --flicker-period 10000 --autofocus-mode manual --metering average --lens-position 7")

1 Like

You would need the full path

So it appears that the MBS plugin uses older APIs that aren’t fully supported in Debian 12 “Bookworm” any more, where the newer “libcamera” functions should be used instead.

There is, however, a work-around for now: If you run the built app under the libcamerify tool, then the missing features for performing a capture are made available. The performance may suffer from this a bit, though (not sure). And this may stop working in a future Debian release.

For a test, build your app and then run it from the cmdline, but prefix the command with "libcamerify ", like this:

cd /path/to/my/program
libcamerify ./myprogram

And for remote debugging you’d launch the Remote debugger the same way, i.e. prefix its invocation with "libcamerify ".

You may have to install extra packages first to get this tool (not sure, but it can’t harm either, I think):

sudo apt install libcamera-tools
3 Likes