radiofan
Posts: 2
Joined: Thu May 16, 2013 9:03 pm

Camera module problem with motion

Thu May 16, 2013 9:42 pm

I am trying to get the new camera module working with motion. For this I have set up apache and a CGI script, which calls:

Code: Select all

#!/bin/bash
echo "Content-type: text/html"
echo
raspistill -o - 
motion is then configured to access this CGI script like a webcam.

The CGI script seems to work via command-line and the browser, but as soon as I start motion, I get this error:

mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

There seems no way to reset it; I have to reboot. Do I need to to tweak some memory settings?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 14783
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Camera module problem with motion

Thu May 16, 2013 11:54 pm

See the launch announcement http://www.raspberrypi.org/archives/3890
question 43 is about motion, and is answered by Jamesh (a moderator closely related to the camera development) that motion is not yet supported!

mikerr
Posts: 2829
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK

Re: Camera module problem with motion

Fri May 17, 2013 12:30 am

Jamesh answer was assuming motion could only work with V4l/UVC drivers,
the above workaround should work as motion is then just seeing an ip camera via apache.

- should be image/jpeg not text/html
- send a smaller image, you're sending a massive 2592x1944
- reduce default timeout to 0
Android app - Raspi Card Imager - download and image SD cards - No PC required !

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1783
Joined: Sat Sep 10, 2011 11:43 am

Re: Camera module problem with motion

Fri May 17, 2013 5:43 am

ENOSPC means the GPU is running out of memory... What gpu_mem do you have set?

Can you get it to raspistill -o output.jpg normally from the command line?

Gordon
Gordon Hollingworth PhD
Raspberry Pi - Chief Product Officer

radiofan
Posts: 2
Joined: Thu May 16, 2013 9:03 pm

Re: Camera module problem with motion

Fri May 17, 2013 6:45 am

As mentioned in my first post, the script works from the command-line and via http, so it is something to do with how motion is processing the image.

I increased GPU memory from 128 to the maximum of 256. I changed the mime type to image/jpeg and set the timeout to 0. Started motion; same problem.

I then decreased image size to 1296x976 and it now works. So the error is probably to do with general memory availability. IMO, running out of heap should not crash the driver, requiring a reboot.

Anyway, thanks for the quick replies; very happy it's working.

thogue
Posts: 131
Joined: Wed Sep 19, 2012 2:16 am

Re: Camera module problem with motion

Fri May 17, 2013 3:21 pm

Having this issue now, Sadly the Pi i decided to plug into is a 256. So memory seems to be an issue here too.


Looking forward to trying to get motion working.

Return to “Camera board”