Snippets

Mitch Allen How to Stream from a Raspberry Pi Camera to your Browser

Created by Mitch Allen last modified

Steps for streaming from a NoIR camera attached to a PiZero

Using Raspian Jessie Lite on a PiZero 1.3 with a NoIR camera over Wireless.

This was also tested on a Pi 3 running the regular version of Jessie with the same camera.


Login to your Pi over ssh and do the following:

$ sudo apt-get update
$ sudo raspi-config  # Enable the camera: 6 Enable Camera / Yes / OK / Finish
$ mkdir projects
$ cd projects/
$ sudo apt-get install git  # If git is not already installed
$ git clone https://github.com/jacksonliam/mjpg-streamer.git
$ cd mjpg-streamer/
$ cd mjpg-streamer-experimental/
$ sudo apt-get install cmake
$ sudo apt-get install python-imaging
$ sudo apt-get install libjpeg-dev
$ make CMAKE_BUILD_TYPE=Debug
$ sudo make install
$ export LD_LIBRARY_PATH=.
$ ./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so"

Note that this worked fine on the Pi Zero. But on the Pi 3 the image was reversed and I had to add the -hf flag:

$ ./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -hf"

On another machine (like a Mac using Chrome) browse to (replacing HOSTNAME with your Pi hostname):

http://HOSTNAME.local:8080

Or:

http://HOSTNAME.local:8080/?action=stream

If the image is backwards, see my note above about the -hf flag.

You can also try:

$ ./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -x 1280 -y 720 -fps 15 -ex night"

Or if it's backwards, add the -hf flag:

$ ./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -x 1280 -y 720 -fps 15 -ex night -hf"

See related article: http://desertbot.io/how-to-stream-the-picamera/


Comments (0)