You are reading the article Setup A Motion Detection Webcam In Ubuntu updated in September 2023 on the website Dacquyenphaidep.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested October 2023 Setup A Motion Detection Webcam In Ubuntu
Installing Motionsudo
apt-get install
motion Configuring MotionBefore we start configuring Motion, we need to copy the config file to our Home folder so that the master copy won’t be affected. Open a terminal and copy the configuration file to your Home folder.
mkdir
.motionsudo
cp
/
etc/
motion/
motion.conf ~/
.motion/
motion.confNote: The above commands will create a hidden folder “.motion” in your Home directory.
Once you have done the copying, you can open the file for editing.
sudo
nano
~/
.motion/
motion.confThere are plenty of options that you can customize in the config file, but there are only a few things that we are interested in. Scroll down the list to find the following settings:
Daemon – Changing this to “on” will make it run in daemon mode. Applications in daemon mode will run in the background and start automatically when the computer starts. The default option is “off” where you need to start the application manually in terminal.
Width – This is the width of the images taken by the webcam. The default is 320, but you can set your own value here. Note that the width is limited by your webcam’s capability. My webcam is only capable of taking images up to 350px, so a value of 320 works fine for me.
Height – The height of the images taken by the webcam. Similarly, it is limited by your webcam’s capability.
framerate – how often you want the image to be captured per second. The default is 2 (2 frames/images taken per second). The higher value you set, the more computing resources it will require.
Motion detection thresold – the number of changed pixels in an image before it is captured. The default is 1500. If you want to make it more sensitive, set it to a lower value.
output_normal – This will determine whether it will save the motion to images. The default option is “on,” which means pictures will be saved as long as motion is detected. You can set it to “first,” “best,” “center” to get it to save only a limited number of images. This will prevent your folder from having an overwhelming number of images. If you just need the video streaming mode, you can set it to “off” to prevent it from saving any pictures.
target_dir – This is the directory where the images are saved. If you have installed Dropbox (or any other cloud storage service), you can set the target directory to be within your Dropbox folder so you can view the images from another location.
Note: There are plenty of other options that you can config, but we won’t be covering them here.
Once you are done with the configuration, press “Ctrl + o” to save the changes and “Ctrl + x” to exit.
Starting motionIn the terminal, type:
sudo
motionThis will start the motion server. If everything goes well, you will start seeing pictures showing up in the target directory.
Managing the saved images remotelyAs I mentioned earlier, the best way is to save the images into your Dropbox folder so you can access it anywhere you want. However, if you prefer to have the images uploaded to your own file server (via FTP), you can use the command wput to upload the images.
sudo
apt-get install
wputIn the config file, scroll down the list till you see a field “on_picture_save value“. Change it to:
on_picture_save wput ftp://
user@
password@
server%
fwhere the “user”, “password” and “server” are details that you need to fill in.
Autostart Motion on boot up ConclusionImage credit: surveillance cameras
Damien
Damien Oh started writing tech articles since 2007 and has over 10 years of experience in the tech industry. He is proficient in Windows, Linux, Mac, Android and iOS, and worked as a part time WordPress Developer. He is currently the owner and Editor-in-Chief of Make Tech Easier.
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.
You're reading Setup A Motion Detection Webcam In Ubuntu
Update the detailed information about Setup A Motion Detection Webcam In Ubuntu on the Dacquyenphaidep.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!