For many users who spend long hours away from home due to work or study it is important to protect their most precious possessions, in many cases achieved with great effort others simply want to know what happens at home while they are not for example to see the behavior of your pets, and for other users it can simply be a pretty entertaining project.
In this article we will see how to use an android smartphone as a webcam to monitor our home, A task for which we will use IP Webcam on the phone and an open source tool like Motion. This is a server that allows us to access webcams that we have installed on our computers, although it is generally used in conjunction with USB webcams here we are going to give new life to old Android devices.
To start we will install IP Webcam, A tool that is found available for free from Play Stores so we simply headed to the Google app store and downloaded it to our smartphone. We have a few options, but with the default we’ll be fine so we can tap the ‘Start Server’ option for the device to start filming, and IP Webcam will tell us the IP address and port from which it is being transmitted, For example 192.168.1.103:8080.
Now let’s go to our computer and we install Motion, Something very simple as it is available in the official Ubuntu repositories, so we just run:
sudo apt-get install motion
After that we have to edit configuration file, So we opted for our preferred editor (in this case, gedit):
sudo gedit /etc/motion/motion.conf
Let’s see that we have many options, and is that precisely one of the main aspects in favor of this tool is the fact of being able to configure what comes to mind. But we leave that to the most experts, we want to set up a webcam server in a relatively simple way so we will base more than anything on what interests us, for example define whether we want Motion to start as a daemon, for this we look for the option daemon and we change the “Off” which comes by default for “On” (Without the quotes, of course). we can too modify the connection port, and the framerate to be used for transmission, Something in which we can not be too specific as it depends on what we need. If we just want to see what happens it may be fine 1 or 2 frames per second (FPS) but if we need something stricter we may have to set this number at 10 FPS, although keep in mind that this will also require a much larger storage space for recordings.
Next, we will set up something that in our case is the most important and is the choice of the video input device, So we turn to an option that says «# Videodevice to be used for capturing (default / dev / video0)». In general, those who use a webcam will be able to leave it right on / Dev / video0 since it is where a USB webcam is located by default, but in our case we are going to use one Android smartphone so let’s add a “;” (Semicolon) in front of this option to cancel it. Now let’s look at the option that starts with «Netcam_url», And we will use the IP address that was reported to us in IP Webcam when we started the server, so we leave it like this:
Now Motion will use the Android smartphone as the source of the video it will stream over the network, But we must also modify an option that determines whether it will be transmitted only to a local computer. is called ‘Webcam_localhost’, Which must be as follows:
Now yes, we can access what our webcam captures, no matter where we do it. Of course we have to open in our router the ports that Motion uses (We can also modify this from the configuration file) by redirecting this to the IP address of the computer running it. If we already know our IP address on the Internet we can enter it in the address bar of the browser and we are ready, we will immediately see the feed that captures our Android smartphone; for those who do not master the command line there is a very simple way to find out this direction and it is through services like What is my IP?.