Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Motion and fswebcam running

I am using fswebcam to capture and image, when an email is received. I thought that it would be nice to have Motion running as well. I installed Motion, and that worked fine. However, when I tried to use fswebcam to take a picture,

I received the error:

Error selecting input 0
VIDIOC_S_INPUT: Device or resource busy

then I stopped Motion, and tried it again. It worked. So, I can only have one program accessing the camera at a time. Is there any way round this?

like image 989
user2370460 Avatar asked Oct 26 '25 07:10

user2370460


2 Answers

Use one or the other, two apps can't read the same video camera device at the same time.

Motion is capable of running a script on event detection, so if you want to do that look in the config for on_area_detected or on_movie_start

Then get it to call some kind of shell script that attaches the current photo and emails it to you.

Hope you don't get too many events, else there will be too many emails to find the important ones.

like image 171
Criggie Avatar answered Oct 29 '25 07:10

Criggie


You can use the Motion HTTP Based Control. Simply call:

http://yourraspberrypi:XXXX/0/action/snapshot

using cURL or any other method that you prefer.

Where yourraspberrypi should be the IP of your Pi, and XXXX should be the port defined under 'control_port', in /etc/motion/motion.conf

Note: A symbolic link called lastsnap.jpg created in the target_dir will always point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap'

You can also use the HTTP Based Control, for example, to stop/start motion detection

More info here: http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionHttpAPI

like image 45
chonz0 Avatar answered Oct 29 '25 08:10

chonz0