Inside the last section of this chapter, we are going to revisit a project we built in the last chapter: the wireless security camera. Here, we are going to learn how to visualize the live video stream coming from a camera from anywhere in the world.
Assembling this project is really simple; you simply need to plug the USB camera to the Raspberry Pi using the USB hub as you also need to plug the Wi-Fi dongle. This is the final result:
Now, we are again going to use the MJPEG-streamer software to create a live video stream from the camera. If you haven't installed it yet, you can check the last chapter of the book to learn how to install it.
Then, go inside the folder where the software is installed, and type:
./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www"
This will immediately start the streaming software on your Raspberry Pi:
Now, I want you to open another terminal window or tab, as we will need to run another software while the streaming software is running. We are going to use software called Ngrok; this will allow us to access the video stream from anywhere in the world.
In the second terminal window, type:
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip
This will download Ngrok on your computer. Then, unzip the file with:
unzip ngrok-stable-linux-arm.zip
Finally, start Ngrok using the following command:
./ngrok 8080
This will basically create a web URL that you can use to access your Pi on port 8080
, which is precisely the port on which the streaming software is running. Once Ngrok is running, you should be able to see the URL you need inside a window:
You can now simply copy this URL and type it inside any web browser. You should then immediately be able to see the interface created by the streaming software:
Now, simply click on Stream to see the live stream coming from the board:
Congratulations, you can now access your wireless security camera from anywhere in the world and monitor your home remotely!