Motion - MMAL camera


317 posts   Page 1 of 13   1, 2, 3, 4, 5 ... 13
by dozencrows » Sat May 25, 2013 11:06 am
I've had some success writing a new module for Motion that reads frames directly from the Pi camera via the MMAL API. A test binary and config file is available here: https://www.dropbox.com/s/xdfcxm5hu71s9 ... mal.tar.gz

This binary is based on Motion SVN trunk at revision 557, and is compiled without MySQL, PostgreSQL or SDL support. Because it's based on trunk and not the 3.2 release branch, the syntax for the config file is different to the available documentation on the Motion wiki.

Next likely steps with this are:
* Tidy up, make command line build work and share the source publically.
* Add an option to support Pi camera settings available in raspivid/raspistill.
* Try optimising some obvious hotspots for the Pi (in reference frame tuning and frame difference code).
Last edited by dozencrows on Sun Jun 23, 2013 10:25 am, edited 1 time in total.
User avatar
Posts: 130
Joined: Sat Aug 04, 2012 6:02 pm
by bjornatic » Sat May 25, 2013 11:27 am
Hi !

Would it be to much to ask for a little step by step tutorial or if, by asking, I suggest I would not be able to make it work anyway ? :D

Even just global hints would do...

Thanks !
Posts: 19
Joined: Wed May 15, 2013 4:44 pm
by fturiot » Sat May 25, 2013 11:34 am
thanks for your good job
can you send me your patch and option compilation
I would like compil and generate deb
thanks
Posts: 20
Joined: Fri Mar 08, 2013 7:31 pm
by yusuk » Sat May 25, 2013 11:57 am
How can I test this?
Posts: 5
Joined: Sat May 25, 2013 11:40 am
by dozencrows » Sat May 25, 2013 12:27 pm
@bjornatic - you can find out lots of information about using Motion here: http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome. Most of the information should apply to this version of motion, as the only part I have modified is the image capture side (and not compiled in the SQL database support).

Please also read through the example .conf file in the tarball to work out where the syntax differs from the documentation. Note that these differences are not down to me, they've been done by the actual motion developers (see http://www.lavrsen.dk/foswiki/bin/view/Motion/RoadMap). I've added one option "mmalcam_name" that is used to provide the camera's ID - this should be "vc.ril.camera" to work with the Pi camera.

If you're having a specific issue with Motion when using the MMAL camera module, please post details ideally attaching your .conf file and the command line arguments you're using.

@fturiot - the code's not quite ready to deliver as a deb, there's a few changes still to make and I need to test a bit more (e.g. with latest Raspian updates and firmware). I'm planning to put it all up on Github in the next few days so that should give you what you need.
User avatar
Posts: 130
Joined: Sat Aug 04, 2012 6:02 pm
by fturiot » Sat May 25, 2013 1:13 pm
ok thanks,
I have problem with libjbeg with Motion of you compil.
fred
Posts: 20
Joined: Fri Mar 08, 2013 7:31 pm
by dozencrows » Sat May 25, 2013 1:23 pm
fturiot wrote:ok thanks,
I have problem with libjbeg with Motion of you compil.
fred


Which version of libjpeg to you have installed?
When I run this on my Pi:
Code: Select all
find /usr/lib -iname libjpeg*

I get
Code: Select all
/usr/lib/arm-linux-gnueabihf/libjpeg.a
/usr/lib/arm-linux-gnueabihf/libjpeg.so.8
/usr/lib/arm-linux-gnueabihf/libjpeg.so.8.4.0
/usr/lib/arm-linux-gnueabihf/libjpeg.la
/usr/lib/arm-linux-gnueabihf/libjpeg.so.62.0.0
/usr/lib/arm-linux-gnueabihf/libjpeg.so.62
/usr/lib/arm-linux-gnueabihf/libjpeg.so

What do you get?
User avatar
Posts: 130
Joined: Sat Aug 04, 2012 6:02 pm
by fturiot » Sat May 25, 2013 1:35 pm
i have this

Code: Select all
/usr/lib/arm-linux-gnueabihf/libjpeg.so.8
/usr/lib/arm-linux-gnueabihf/libjpeg.so.8.4.0
/usr/lib/arm-linux-gnueabihf/libjpeg.so
/usr/lib/arm-linux-gnueabihf/libjpeg.a
Posts: 20
Joined: Fri Mar 08, 2013 7:31 pm
by dozencrows » Sat May 25, 2013 1:37 pm
Try installing libjpeg62 via
Code: Select all
sudo apt-get install libjpeg62

That's what the test binary is linking against.
User avatar
Posts: 130
Joined: Sat Aug 04, 2012 6:02 pm
by fturiot » Sat May 25, 2013 1:41 pm
yes ok but why not work with lipjpeg8 ?
any raisons ?
thanks for all
fred
Posts: 20
Joined: Fri Mar 08, 2013 7:31 pm
by dozencrows » Sat May 25, 2013 1:43 pm
It may well work with libjpeg8 - I will have to try it.
libjpeg62 is listed as the dependent package for Debian in the Motion wiki, which is why I used it - see http://www.lavrsen.dk/foswiki/bin/view/ ... or_Install
User avatar
Posts: 130
Joined: Sat Aug 04, 2012 6:02 pm
by fturiot » Sat May 25, 2013 1:46 pm
ok thanks for all.
Posts: 20
Joined: Fri Mar 08, 2013 7:31 pm
by fturiot » Sat May 25, 2013 2:34 pm
it's work but 3/4 min i have freezing of soc broadcom and i must reboot.
I test for reduce picture width.
fred
Posts: 20
Joined: Fri Mar 08, 2013 7:31 pm
by craigc » Sat May 25, 2013 3:11 pm
Hi, Thanks for the updated version, the rotation works well.

I'll leave it running and let you know if I spot any problems.

Craig.
Posts: 8
Joined: Mon Jan 23, 2012 12:17 pm
Location: Berkshire, UK
by dozencrows » Sat May 25, 2013 3:15 pm
@bjornatic, @yusuk - my apologies - I suspect you're wanting information on how to install and run my test version, which I haven't made clear.

I would recommend trying the following:
1. Install the standard Raspbian motion package via apt-get. This should add all the dependencies.

2. Unzip the motion-mmal tarball into your home folder.

3. Try running motion from your home folder -
Code: Select all
./motion -h
If that works, you should get the help text for the tool.

4. Then try running it with the provided config file -
Code: Select all
./motion -n -c motion-mmalcam.conf
. This should work - test it out by checking the webcam feed on your Pi on port 8081.

If you have a problem with libjpeg, see the post above about installing libjpeg62.

Let me know if you have any issues - please provide relevant details (e.g. command lines, changes to .conf files, error messages).
User avatar
Posts: 130
Joined: Sat Aug 04, 2012 6:02 pm
by bjornatic » Sat May 25, 2013 3:37 pm
This is super nice from you ! Thanks.

I'll try it out asap and let you know. :)
Posts: 19
Joined: Wed May 15, 2013 4:44 pm
by yusuk » Sat May 25, 2013 3:41 pm
great!! motion is working with csi camera module.
I'll feed back after testing more.

My Pi is rev.b and wifi connected.
The latency is less than using vlc. But the framerate is about 1frame per second.
Posts: 5
Joined: Sat May 25, 2013 11:40 am
by bjornatic » Sat May 25, 2013 4:19 pm
All working this is great !! Thanks again :D
Posts: 19
Joined: Wed May 15, 2013 4:44 pm
by fturiot » Sat May 25, 2013 5:03 pm
i have always freeze with motion with model b rev 2 on raspbian last.
I test with minimal raspbian img.
fred
Posts: 20
Joined: Fri Mar 08, 2013 7:31 pm
by dozencrows » Sat May 25, 2013 5:18 pm
Hi fred - sorry to hear you're getting these problems. I personally haven't been experiencing freezes, and have had motion-mmal running for half an hour successfully (then stopped it myself).

Please supply a copy of your motion config file and command line if these are changed, so I can try them.

Are you using the latest Raspbian and firmware updates? What hardware do you have plugged in to your Pi's USB ports?

BTW I'm working on getting the source up to GitHub...
User avatar
Posts: 130
Joined: Sat Aug 04, 2012 6:02 pm
by dozencrows » Sat May 25, 2013 5:37 pm
Ok, the source is now up on Github at this URL: https://github.com/dozencrows/motion

The master branch is an untouched fork of the original; all the MMAL changes are in the branch mmal-test. Note that this is currently just a drop of the configured source - there's no means provided yet for building the code.
User avatar
Posts: 130
Joined: Sat Aug 04, 2012 6:02 pm
by dpguest » Sat May 25, 2013 7:28 pm
How do I install the test version on the pi? You indicate there is no ability to make that is build the software, but I assume the prebuilt components are there. What specific steps do I need to follow to install and then proceed to test ...

thanks from a neophyte...
Posts: 28
Joined: Wed Feb 06, 2013 4:17 pm
by dozencrows » Sat May 25, 2013 7:33 pm
Hi dpguest - please see my post above here for that info: viewtopic.php?p=356814#p356814

You can get the tarball containing the binary and config file from the first post in this thread.

I'm working on the command line build for the Github source at the moment - will post when that's available.
User avatar
Posts: 130
Joined: Sat Aug 04, 2012 6:02 pm
by dpguest » Sat May 25, 2013 8:49 pm
thanks much for your prompt reply ... I'll try to follow your instructions.

have a nice day...
Posts: 28
Joined: Wed Feb 06, 2013 4:17 pm
by mahtiaivo » Sat May 25, 2013 9:08 pm
i could not find an option to mirror the picture vertically, did i miss it?

thought there was some discussion on the motion site and even a patch, it seems it's not in the actual motion version included...
http://www.lavrsen.dk/foswiki/bin/view/ ... irrorPatch
Posts: 8
Joined: Sat May 25, 2013 9:05 pm