rutlandgizz
Posts: 2
Joined: Wed Mar 16, 2016 1:47 pm
Location: UK

Motion/MMAL/Jessie

Wed Mar 16, 2016 2:09 pm

Hi everyone

Please note I'm not au-fait with Unix nor Pi so please don't flame if I seem to ask daft questions.

I have got a Pi 2 B+ with camera, and installed latest Raspberian Jessie. I installed motion and then unzipped the lowflyer Jessie motion modified program.

I pretty much followed the instructions at:
http://www.codeproject.com/Articles/665 ... nce-camera
Only used lowflyer's version for Jessie

I can run motion fine from the command line and see video on port 8081, but I have the following problems:

1) I don't know where to copy the motion program to so that it sits in the 'correct' place for auto start on boot up - and it doesn't start on boot. When I tried to use the cp command to copy it to /usr/bin/motion the source file disappeared (!!!) - is that normal for cp? And should it be at /usr/bin/motion ?

2) I can't seem to get any log files written, though I have specified the location, touched and chmodded accordingly...

3) I can't seem to get motion to accept better resolution than 640x480. Is that normal?

Many thanks in advance from a N00b.... :)

lowflyer
Posts: 78
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion/MMAL/Jessie

Thu Mar 17, 2016 10:35 am

Hi @rutlandgizz!

I have never been happy with changing the binaries in /usr. Either it gets overwritten in an update, or I get confused about which version or which config file it is actually using. I also don't use the daemon mode of motion. So I copy my config file to my home directory, then test motion (while tweaking the config file) by running this: (Motion spits out useful debugging logs directly to the terminal)

Code: Select all

/home/pi/motion/motion -c /home/pi/mm.conf
When you are happy with the config, you can add this to your /etc/rc.local:

Code: Select all

## startup motion
DAEMON='/home/pi/motion/motion'
DAEMONARGS=" -c /home/pi/mm.conf" # Important : leave space before first argument
start-stop-daemon --start -b --exec $DAEMON --chuid pi --$DAEMONARGS
Now motion is started (as user pi) at startup and uses the right binary and config. The log messages are now sent automatically to /var/log/syslog.

Your resolution question is a bit more complicated. 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. So you need to have a good look at your config file to get the resolution you want. These are the key lines in the config

Code: Select all

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
And you also need to check that you have given enough memory to the GPU by running:

Code: Select all

sudo raspi-config
and clicking Advanced, then Memory Split. For high resolution, you probably need 256Mbytes.

Hope this helps! Good luck!

rutlandgizz
Posts: 2
Joined: Wed Mar 16, 2016 1:47 pm
Location: UK

Re: Motion/MMAL/Jessie

Thu Mar 24, 2016 10:32 am

Thanks lowflyer that helped a lot! :)
All (kinda) working now

hilndr44
Posts: 1
Joined: Sun May 01, 2016 8:36 pm

Re: Motion/MMAL/Jessie

Sun May 01, 2016 8:42 pm

Any luck with the resolution?
Ideally, I would like to get a snapshot using the max resolution of the camera, whilst motion-detection doesn't necessarily need that level of detail.

lowflyer
Posts: 78
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion/MMAL/Jessie

Wed May 04, 2016 8:19 am

@hilndr44

What config options have you already tried? If are using my version of motion as described on this post, viewtopic.php?p=864996#p864996, and launched it with

Code: Select all

/home/pi/motion/motion -c /home/pi/motion/configs/motion-mmalcam-both.conf
You should be getting the video at 640x480 and the stills at 2560x1920.

Hope this helps.

will_d
Posts: 1
Joined: Sat Jul 07, 2018 7:57 pm

Re: Motion/MMAL/Jessie

Sat Jul 07, 2018 8:01 pm

"The clever part of this version of motion..."
What version are you referring to? I can't seem to find documentation about the options you have suggested. Are these something you added to motion or are they standard features:

Code: Select all

mmalcam_secondary_buffer_upscale 5
pre_capture 4
output_both_pictures on
output_secondary_pictures on
Your notion of

Code: Select all

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
Is something I am very interested in. Can you help me understand how to implement this?

Thanks.

lowflyer
Posts: 78
Joined: Sat Jun 01, 2013 2:27 pm

Re: Motion/MMAL/Jessie

Sun Jul 08, 2018 8:50 pm

Hi will_d !

if you have a look at this post viewtopic.php?p=864996#p864996 and the rest of the thread, you should be able to get the history of mmal_motion. It is a modified version of motion.

I haven't tried it with recent versions of raspbian, so I expect it will only work on jessie. Recently I have been using raspimjpeg as discussed in this thread viewtopic.php?f=43&t=63276&start=4700

I hope this helps.

Return to “Camera board”