Saturday, February 24, 2024

Raspberry Pi Projects: Live Streaming Using Raspberry Pi Development Board

By Somnath Bera

EFY TestedImagine you are talking to your friend who works in another country and at the same time you are streaming your plush drawing room images to him or her on the computer. For streaming images you would need an Internet connection and then use of the port-forwarding technique explained in this article.

But, is it a big deal? Skype or a similar messaging program does the same thing through the Internet. The only difference is that the process presented here is simple and has minimum footprint or load on bandwidth.

Port forwarding, or live streaming, allows the network to flow contents of a defined port to the outside world. It allows network administrators to use one IP address for all external communications on the Internet. It is useful for home network users who may wish to run a Web server or gaming server on network.

How to get started

You need a Windows or Linux computer with a camera and an old mobile phone with an Internet connection to live stream your video over the Internet. You can also use Raspberry Pi (Raspi) in place of a computer.

For testing live-streaming videos using Raspi with Raspbian OS, use Motion software and configure motion.conf file as explained below.

- Advertisement -

Get the software ready. To start with, you should have a working Raspi on a local network with Internet access.

Next, update Raspi using the following commands. This ensures that you have the latest software and drivers installed.

 [stextbox id=”grey”]$sudo apt-get update
$sudo apt-get upgrade[/stextbox]

- Advertisement -

Install Motion. We use a fairly lightweight application known as Motion, which is capable of accessing the USB camera, getting images and streaming these via the built-in Web server. Motion can also track and trigger events when motion is detected in video frames.
[stextbox id=”grey”]$sudo apt-get install motion[/stextbox]

Plug in webcam. Plug in the webcam and ensure that everything is working fine by typing lsusb command. The name of your webcam manufacturer should be visible on the terminal, which means Raspi has recognised your webcam.
[stextbox id=”grey”]$lsusb[/stextbox]

Configure software. Now, basic configurations are required in motion.conf file as follows:
sudo nano /etc/motion/motion.conf

• Daemon = off to on
• width 640
• height 480
• framerate 30
Go to # Live Webcam Server section and make the following changes:
• webcam_localhost = on to off
• webcam_port 8081
• webcam_quality 50
• webcam_maxrate 15 (if you have good bandwidth, you can make this 30)

Start software. To ensure that Motion service actually starts as a daemon, change configuration setting as given below.
[stextbox id=”grey”]$sudo nano /etc/default/motion[/stextbox]

Change, value start_motion_daemon=no to yes
Now, you can start Motion service to stream webcam images by typing the following command:
[stextbox id=”grey”]$sudo service motion start[/stextbox]

After about 30 seconds, browse a Web interface using a web browser, say, Mozilla Firefox, on the same computer or another computer on the same network, and enter the IP address along with the port number of your Raspi, say,

If you can see the live-streaming video, it means everything is working fine on the network.


Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components