browntastic
Posts: 10
Joined: Sun Oct 19, 2014 5:23 pm

MMAL no longer working

Sun Feb 18, 2018 2:34 pm

I have a script that uses MMAL to show two instances of the RPi camera preview. It runs on a Raspberry Pi Zero, and I use it with 3D goggles (like Google Cardboard) inside a mask so I can see where I'm going.

Code: Select all

#!/bin/bash

from picamera import mmalobj as mo, mmal
from signal import pause

camera = mo.MMALCamera()
splitter = mo.MMALSplitter()
render_l = mo.MMALRenderer()
render_r = mo.MMALRenderer()

camera.outputs[0].framesize = (400, 300)
camera.outputs[0].framerate = 30
camera.outputs[0].commit()

p = render_l.inputs[0].params[mmal.MMAL_PARAMETER_DISPLAYREGION]
p.set = mmal.MMAL_DISPLAY_SET_FULLSCREEN | mmal.MMAL_DISPLAY_SET_DEST_RECT
p.fullscreen = False
p.dest_rect = mmal.MMAL_RECT_T(0, 100, 400, 300)
render_l.inputs[0].params[mmal.MMAL_PARAMETER_DISPLAYREGION] = p
p.dest_rect = mmal.MMAL_RECT_T(400, 100, 400, 300)
render_r.inputs[0].params[mmal.MMAL_PARAMETER_DISPLAYREGION] = p

splitter.connect(camera.outputs[0])
render_l.connect(splitter.outputs[0])
render_r.connect(splitter.outputs[1])

pause()

I updated and upgraded (update, upgrade, rpi-update)) and also updated motion. Now the script doesn't work. I've tried several things, including a fresh Raspbian install on a new SD card, although I ran into many problems installing motion, because some of the dependencies wouldn't install.

Was there some change in the Motion that makes this script not work anymore?

mattday
Posts: 15
Joined: Sun Jul 26, 2015 5:00 pm

Re: MMAL no longer working

Wed Feb 21, 2018 1:59 pm

This probably isn't very helpful, but unless you absolutely need bleeding edge firmware, the standard advice for some time has been to avoid using rpi-update. Using apt-get will keep your firmware up to date. Various sources advise as follows.
rpi-update will install potentially broken, unstable or experimental firmware onto your Raspberry Pi and could have unexpected or undesirable results

Return to “Camera board”