Workaround for problems with motion


2 posts
by lingon » Thu Dec 27, 2012 10:07 pm
Many threads on this Forum report that for some reason motion does not work reliably with USB webcams on the Raspberry Pi if you try to reach resolutions larger than VGA. Motion gives a lot of error messages and restarts itself every now and then to recover from these error conditions.
Currently I'm able to run motion with a resolution of 960*720 pixels and 2 frames / s on a Raspberry Pi. This uses between 50 and 80 % of CPU with the Raspberry Pi running at 700 MHz. To do this I have done the following:

1) Use a webcam supported by the uvcvideo driver
2) Use MJPEG-output from the webcam to reduce the bandwidth over the USB-bus
3) Read the pictures from the webcam with mjpeg-streamer. You can compile it using the instructions from this thread viewtopic.php?f=30&t=8659&p=164539&hilit=mjpeg+streamer#p164539
4) Use the output from mjpeg-streamer as an IP-cam input for motion to be able to do motion detection. The important option is this one
netcam_url "http://localhost:8090/?action=snapshot"

This is my best webcam setup sofar, but for some unknown reason mjpeg-streamer does not work with another uvcvideo webcam that I have. This workaround might be worth trying for others that want to push motion detection on their Raspberry Pi, even if it is not working with all webcams.
Posts: 102
Joined: Fri Aug 26, 2011 7:31 am
by jors » Sun Feb 03, 2013 10:43 am
Man, you made my day! :D

Got a Creative Live! Cam Sync and it was not running propperly with motion, and now using it as an input for motion (as netcam_url) it works as a charm. Many thanks!
Blog @ http://enchufado.com/
User avatar
Posts: 32
Joined: Sun Sep 23, 2012 9:05 am
Location: Barcelona