![]() ![]() ![]() This code calls the new function when Motion’s ‘start’ command is executed. ![]() Next add the following statement to the beginning of the ‘start’ function. If you change your webcam model, remember to update the ID you entered in this function. You will need to modify the function, changing the string ‘0000:ABCD’, to match your webcam’s ID. Next, open the Motion startup script, using the following command: sudo nano /etc/init.d/motionĪdd the following ‘check_for_webcam ()’ function to the top of the script, adjacent to the existing ‘check_daemon_enabled()’ function: # Check if specific webcam(s) are connected to PiĮcho "No webcam found? Shutting down Motion!" I found this post particularly helpful, The Webcam HOWTO. There are several ways to detect your webcam, depending on you Linux distro. I ran the command twice in this example, to identify both of my webcams. You should see similar output to the example below. Run the following command to list the USB devices connected to the Pi: lsusb Find Your Webcamįirst, attach your webcam to the Raspberry Pi. It also saves a lot of wasted time moving videos and images off the Pi that end up being blank, because no webcam was connected. This saves a lot of wasted processing on the Pi. No blank images or empty time-lapse videos are created. If not, it immediately exits the script, without ever starting Motion. When the system calls Motion on startup, the new function checks if a webcam is connected. To get prevent Motion from starting up without a webcam connected, I’ve added a simple function to the Motion startup script. However, when I get home and plug my Pi back into my local network, Motion starts up again and starts recording blank images and creating the time-lapse video, even though there is no webcam connected. The dash-cam starts capturing images and making the time-lapse video. When I start my car, the Raspberry Pi boots-up, and subsequently, Motion starts. However, an issue I still struggled with when using the dash-cam was Motion running without a webcam connected. If you read my post, Raspberry Pi-Powered Dashboard Video Camera Using Motion and FFmpeg, you know Motion with FFmpeg on a Raspberry Pi makes an ideal dashboard camera system. ![]()
0 Comments
Leave a Reply. |