Raspberry Pi Camera Live Stream

In this tutorial, I’ll show how you can live stream your Raspberry Pi Camera to a web browser.

Please note that this tutorial is only for streaming with the Raspberry Pi Camera and not an external usb webcam.

Enable the Camera

Type:

sudo raspi-config

Use arrow keys to select Camera and press Enter

Screen Shot 2015-02-13 at 3.29.11 PM

Enable the Camera

Screen Shot 2015-02-13 at 3.29.22 PM

Quick Install

For those who want a stream as soon as possible, I have made a shell script that automatically does everything below in Starting The Stream.  You will still have to follow Viewing The Stream

Download Link

Download the file with wget

wget http://andrewke.org/wp-content/uploads/2015/02/stream.sh_.zip

and unzip the file

unzip stream.sh_.zip

Make the file executable

chmod +x stream.sh

and execute it

./stream.sh

Starting The Stream

Install required packages

sudo apt-get update

sudo apt-get install -y cmake libjpeg62-dev

Download mjpg-streamer using wget

wget https://github.com/jacksonliam/mjpg-streamer/archive/master.zip

If the download fails, try this link: mjpg-streamer-master or download from GitHub

You now should have master.zip

Unzip the file

unzip master.zip

Navigate in to the extracted folder

cd mjpg-streamer-master/

cd mjpg-streamer-experimental/

Compile the files

make clean all

Set environmental variable paths (you will have to do this every time after rebooting)

export LD_LIBRARY_PATH=.

Execute the file

./mjpg_streamer -o “output_http.so -w ./www” -i “input_raspicam.so -x 640 -y 480 -fps 30”

Your Raspberry Pi is now streaming at 640×480 resolution and at ~30 FPS

If your picture is inverted vertically or horizontally, use the -vf and -hf flags

./mjpg_streamer -o “output_http.so -w ./www” -i “input_raspicam.so -x 640 -y 480 -fps 30 -vf -hf”

Here is the full set of options for raspicam

 

Finding your Pi’s IP Address

Type

ifconfig

Sample Output:

eth0      Link encap:Ethernet  HWaddr —————- 

          inet addr:10.0.0.8  Bcast:10.0.0.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:686 errors:0 dropped:0 overruns:0 frame:0

          TX packets:489 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:54082 (52.8 KiB)  TX bytes:175924 (171.8 KiB)

Your Pi’s IP is the series of numbers after the inet addr label (In my case, it is 10.0.0.8)

Viewing the Stream

Visit the location shown below:

<pi’s ip address>:8080

For Example:

Screen Shot 2015-02-13 at 3.48.07 PM

 

A window like this should appear:

Screen Shot 2015-02-13 at 3.50.12 PM

And a Live Stream can be viewed by clicking on StreamScreen Shot 2015-02-13 at 3.50.26 PM

Congratulations! You can now see what your Pi sees!

 

1 Comment

Leave a Reply

Your email address will not be published.

*

© 2018 Andrew Ke

Theme by Anders NorenUp ↑