kmdm
Posts: 2
Joined: Thu May 23, 2013 5:01 pm

Re: Motion - Ip Camera Possible

Thu May 23, 2013 7:33 pm

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. :)

User avatar
dozencrows
Posts: 172
Joined: Sat Aug 04, 2012 6:02 pm

Re: Motion - Ip Camera Possible

Fri May 24, 2013 2:57 pm

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.

craigc
Posts: 8
Joined: Mon Jan 23, 2012 12:17 pm
Location: Berkshire, UK

Re: Motion - Ip Camera Possible

Fri May 24, 2013 6:05 pm

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.

lingon
Posts: 122
Joined: Fri Aug 26, 2011 7:31 am

Re: Motion - Ip Camera Possible

Sat May 25, 2013 9:08 am

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.

User avatar
dozencrows
Posts: 172
Joined: Sat Aug 04, 2012 6:02 pm

Re: Motion - Ip Camera Possible

Sat May 25, 2013 10:00 am

@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.

User avatar
dozencrows
Posts: 172
Joined: Sat Aug 04, 2012 6:02 pm

Re: Motion - Ip Camera Possible

Sat May 25, 2013 10:45 am

New version of motion-mmal binary now up here, with working rotation: https://www.dropbox.com/s/xdfcxm5hu71s9 ... mal.tar.gz
Last edited by dozencrows on Mon Jun 24, 2013 1:07 pm, edited 1 time in total.

User avatar
dozencrows
Posts: 172
Joined: Sat Aug 04, 2012 6:02 pm

Re: Motion - Ip Camera Possible

Sat May 25, 2013 11:07 am

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

User avatar
mlaporta
Posts: 3
Joined: Wed Jun 12, 2013 7:31 am
Location: Rome

Re: Motion - Ip Camera Possible

Sun Jun 23, 2013 8:47 pm

works for me!!

[email protected] ~ $ 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)

MalcolmSlaney
Posts: 1
Joined: Thu Oct 03, 2013 9:11 pm

Re: Motion - Ip Camera Possible

Thu Oct 03, 2013 9:50 pm

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

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Motion - Ip Camera Possible

Fri Oct 04, 2013 2:49 pm

Look 2 posts back.

MMAL works quite well.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

User avatar
bitbank
Posts: 252
Joined: Sat Nov 07, 2015 8:01 am
Location: Sarasota, Florida
Contact: Website

Re: Motion - Ip Camera Possible

Tue Jun 21, 2016 11:04 am

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?
The fastest code is none at all :)

Return to “Camera board”