Posts: 1
Joined: Fri Oct 19, 2018 11:55 am

C++ Wrapper for Raspicam Access through MMAL

Fri Oct 19, 2018 12:27 pm

Hi everyone,

I got my Raspberry Pi Camera V2 NOIR to work using the OpenCV VideoCapture class (and therefore through the v4l2 API). However, I would like to have more control over the camera (e.g. set sensor mode independent from resolution) and access it through MMAL. I tried to use raspicam_cv but it doesn't seem to be working at all. I tried:

- Raspicam v0.1.6 from sourceforge (
- this version:

This results in the following error:

Code: Select all

mmal: mmal_vc_port_enable: failed to enable port ENOMEM
mmal: mmal_port_enable: failed to enable port (ENOMEM)
camera video callback2 erroropen Failed to create camera component/home/pi/Downloads/raspicam/src/private/private_impl.cpp 103
My questions now:
1.) Are these versions stable and should work fine without any modifications? ( -> the problem has something to do with my setup/external factors )
2.) If not, is there an up-to-date version of a c++ MMAL wrapper available? (I already browsed the repositories by 6by9 but they seem similarly outdated)

  • When I run raspivid everything works fine so my camera shouldn't be the problem...
  • I tried debugging myself and modifying the source code to resemble the structure of raspividYUV ( ... piVidYUV.c). There are a few differences in the order of calls to mmal_port_enable, mmal_component_enable... Unfortunately this didn't give any better results :-/
  • my GPU memory is at 256
  • There should be no other instance running (I did sudo modprobe -r bcm2835-v4l2 after enabling it)
It would be great if someone could help me out :)
Thanks and have a nice weekend everyone,

Return to “Troubleshooting”