HeroS_NL
Posts: 17
Joined: Mon Nov 04, 2013 10:07 pm

mmal-motion low FPS?

Mon Dec 09, 2013 6:33 pm

Hello,

As I finally got my RPi running with wifi using wicd, I was able to install my pi as 'security cam'.
I installed mmal-motion and setted resolution to 640 x 480. I configured the FPS to 10.
Now it is recording 1 fps max and using with 98% (?!) Cpu while there is motion, while motion uses only 19% while it is not recording.
Ofcourse CPU raises when it has to record movement and new pixels, but I think this is ridiculous as the webcam could record at 30fps (found this data somewhere online)?

What can I do to increase the FPS while maintaining the resolution?
I tried increasing GPU RAM in raspi-config but that didn't seem to help..


Also:
I setted pre-buffer to 0, but it seems to change it back automatically?:

Code: Select all

[0] [NTC] [STR] [Dec 09 19:15:39] httpd_run: motion-httpd testing : IPV4 addr: 127.0.0.1 port: 8080
[0] [NTC] [STR] [Dec 09 19:15:39] httpd_run: motion-httpd Bound : IPV4 addr: 127.0.0.1 port: 8080
[0] [NTC] [STR] [Dec 09 19:15:39] httpd_run: motion-httpd/mmaltest running, accepting connections
[0] [NTC] [STR] [Dec 09 19:15:39] httpd_run: motion-httpd: waiting for data on 127.0.0.1 port TCP 8080
[1] [NTC] [ALL] [Dec 09 19:15:39] motion_init: Thread 1 started , motion detection Enabled
[1] [ALR] [VID] [Dec 09 19:15:39] mmalcam_start: MMAL Camera thread starting... for camera (vc.ril.camera) of 640 x 480 at 10 fps
[1] [ALR] [VID] [Dec 09 19:15:39] mmalcam_start: MMAL Camera using video capture
[1] [NTC] [VID] [Dec 09 19:15:39] MMAL camera component created
[1] [NTC] [ALL] [Dec 09 19:15:39] image_ring_resize: Resizing pre_capture buffer to 1 items
[1] [NTC] [ALL] [Dec 09 19:15:39] image_ring_resize: Resizing pre_capture buffer to 2 items

last thing, I disabled the http stream, but it is still going to run!
I'm sure I edited the correct config files, as these also changed my resolution.

Yours.

HeroS

ps. I'm on raspberry pi model B with raspbian!

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 21126
Joined: Sat Jul 30, 2011 7:41 pm

Re: mmal-motion low FPS?

Mon Dec 09, 2013 6:41 pm

Motion takes a LOT of processing power. The camera is capable of 1080p30, but once you ask the ARM to process the images, it will slow right down - So the bottleneck is the motion processing. You can try overclocking which will help, or changing the motion parameters in some way to reduce the processing load.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

shuckle
Posts: 565
Joined: Sun Aug 26, 2012 11:49 am
Location: Finland

Re: mmal-motion low FPS?

Mon Dec 09, 2013 6:55 pm

I am only streaming from the pi and doing motion detection then later in a bigger machine. I doubt rpi cpu has the power to do it even if you overclock. Not much you can do to tune motion detection I believe.

User avatar
jbeale
Posts: 3367
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: mmal-motion low FPS?

Mon Dec 09, 2013 6:58 pm

'motion' does several things you may not expect, at least I did not at first:

1) the online streaming feature is at most 1 fps regardless of camera fps settings ("framerate"), at least by default.

Code: Select all

# Maximum framerate for stream streams (default: 1)
stream_maxrate 1
2) the motion detection algorithm is clamped to 3 fps if camera setting is 5 fps or higher (in the source code, not set from config file)
3) generating movies after motion is captured is done via ffmpeg and happens on the ARM, not the GPU (meaning: slow)
4) motion-mmal seems to be capable of a bit faster framerate if you use the new Official R-Pi camera V4L2 driver (beta), instead of mmal-camera.

Using V4L2 and R-Pi camera I was able to set 30 fps at 352x288 and 4 fps at 1280x720, with ARM overclocked at 900 MHz. But that is about the limit.
See also: http://www.raspberrypi.org/phpBB3/viewt ... 01#p463001

The optimal setup on R-Pi would be to use the GPU for motion detection, then you probably could get the full framerate. I think it could be done, but that software has not yet been written.

Just for comparison: I got a 3-Mpixel IP camera from Ebay for about $130. It works, but it is FAR less configurable than the R-Pi setup. It can stream full-res at about 10 fps (guessing) and save stills via FTP but has about 30 sec minimum dead-time in between stills. At that price I could get a better setup using two R-Pis with two cameras. I could use one Pi running motion at low-res but full FPS to do the motion detection, and then use the second one triggered by the first to save full-res stills and/or video.

WhyWhyMyPi
Posts: 1
Joined: Sat Jun 27, 2015 12:04 pm

Re: mmal-motion low FPS?

Sat Jun 27, 2015 12:06 pm

Is there any way of changing it so that it's not clamped so slowly when it starts recording?

I get 1 frame every second!

Return to “Camera board”