This post on the raspi forums suggests that motion can use a small resolution feed from the raspi camera to perform motion detection and then save a larger resolution version of the frame in question. The purpose of this maneuver would be to keep processing time down. Which is something I am interested in since I am running on a Raspi Zero.

Here's the quote:

The clever part of this version of motion is that the Pi's camera feeds low resolution video to the motion detection algorithm - so that the Pi's processor isn't too heavily loaded - and at the same time, higher resolution stills and videos of the detected movement can be saved.

The post goes on to describe the following options for the motion.config file.

width 320
height 188
framerate 4
mmalcam_secondary_buffer_upscale 5
pre_capture 4
output_both_pictures on
output_secondary_pictures on
target_dir /run/shm
snapshot_filename lastsnap
picture_filename preview
movie_filename %Y%m%d%H%M%S

I have included these lines in my config file but it seems to cause motion to break. The logs describe an 'event' starting but then all activity stops. Like it's getting hung up on something during the image saving process.

Furthermore I can't find any documentation on the options: mmalcam_secondary_buffer_upscale, output_both_pictures, or output_secondary_pictures

Does anyone have any insight on how I can enable this behavior?


2 Answers 2


The options you list are only available for a customized version of motion called MMAL Motion which accesses the Raspberry Pi camera directly rather than through /dev/video0. A wiki for that version is here.


Expanding a bit on Chris Jenks answer and summing up my own search for the same thing, you need to tap directly into MMAL library (written in C), or one of its wrappers:

MMAL http://www.jvcref.com/files/PI/documentation/html/index.html

C# (.NET) library (this one even has it's own motion detection capabilities) https://github.com/techyian/MMALSharp/wiki/Advanced-Examples

Python library https://picamera.readthedocs.io/en/release-1.6/recipes2.html#recording-at-multiple-resolutions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.