Page 2 of 2

Re: Motion - Ip Camera Possible

Posted: Thu May 23, 2013 7:33 pm
by kmdm
If you've not already, I'd suggest you fork from https://github.com/sackmotion/motion, clone your fork, replay your work over the top and then commit/push. :)

Re: Motion - Ip Camera Possible

Posted: Fri May 24, 2013 2:57 pm
by dozencrows
Cheers kmdm, I'll take a look at that Github version.

Profiling didn't show encoding as being a performance hit ("time everything, assume nothing"). Actually motion-mmal is spending 30%-40% of CPU time updating the reference frame, and the image difference processing is taking around a further 25% of CPU time. These are by far the largest hits on the profiler.

Re: Motion - Ip Camera Possible

Posted: Fri May 24, 2013 6:05 pm
by craigc
Thanks for the hard work, works really well. Well impressed as I was getting a lot errors with the web-page approach

Just one feature that would be useful with camera is the rotation doesn't appear to work

thanks again.

Re: Motion - Ip Camera Possible

Posted: Sat May 25, 2013 9:08 am
by lingon
mikerr wrote:Motion is actually quite flexible on input, as well as using the normal V4L and UVC camera input
it can also use IP cameras by putting netcam_url in motion.conf:

So, we can workaround the lack of V4L driver by making a "local" ip camera out of the raspi camera.

motion.conf:

Code: Select all

netcam_url http://127.0.0.1/cgi-bin/raspicam 
- get the Raspi camera to dump jpegs into a local webserver running on the pi:

/usr/lib/cgi-bin/raspicam

Code: Select all

raspistill -o -
For simple testing you can even use python as the webserver running the CGI-script. Create a directory called cgi-bin and put your CGI-scripts there. Then you can run python from the command line in the directory containing the subdirectory cgi-bin like this

Code: Select all

python -m CGIHTTPServer 8080

This allows to access the Raspbery Pi with a camera over the LAN with a URL like

Code: Select all

http://rpicam:8080/cgi-bin/webcam
assuming the CGI-scrip is called webcam. This should also work with motion, but I have not yet tried that. This webserver runs as the user running on the Raspberry Pi, which obviously has security issues, so for more serious stuff a real webserver is probably better. But for fast testing and debugging this is useful.

Re: Motion - Ip Camera Possible

Posted: Sat May 25, 2013 10:00 am
by dozencrows
@craigc: good spot of the lack of rotation - I missed this in my integration of the mmal camera module with the motion main loop. Looks like it should be fairly straightforward to include, based on what the netcam module does.

Re: Motion - Ip Camera Possible

Posted: Sat May 25, 2013 10:45 am
by dozencrows
New version of motion-mmal binary now up here, with working rotation: https://www.dropbox.com/s/xdfcxm5hu71s9 ... mal.tar.gz

Re: Motion - Ip Camera Possible

Posted: Sat May 25, 2013 11:07 am
by dozencrows
I've started a new thread for MMAL camera discussion, as it doesn't fit with the original purpose of this thread: http://www.raspberrypi.org/phpBB3/viewt ... 43&t=44966

Re: Motion - Ip Camera Possible

Posted: Sun Jun 23, 2013 8:47 pm
by mlaporta
works for me!!

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.6.11+ #456 PREEMPT Mon May 20 17:42:15 BST 2013 armv6l GNU/Linux

dmegs
[ 0.001029] Calibrating delay loop... 697.95 BogoMIPS (lpj=3489792)

Re: Motion - Ip Camera Possible

Posted: Thu Oct 03, 2013 9:50 pm
by MalcolmSlaney
Is there an update to this package? Any chance the Pi camera support will be added to the main motion package?

I can't find anything that integrates motion detection and the pi's hardware camera.

Is this the best solution? The original post is a few months old.

Thanks.

--- Malcolm

Re: Motion - Ip Camera Possible

Posted: Fri Oct 04, 2013 2:49 pm
by pluggy
Look 2 posts back.

MMAL works quite well.

Re: Motion - Ip Camera Possible

Posted: Tue Jun 21, 2016 11:04 am
by bitbank
It looks like this project is pretty widely used. I saw further up in this discussion that the differencing code is still using around 25% of the CPU. I can improve the existing ARMv6 asm code and write NEON versions of functions if that would be helpful. Can someone point me to the 'heavy hitters' on the CPU side?