Snippets

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

Updated by Mitch Allen

File pistreaming.markdown Modified

  • Ignore whitespace
  • Hide word diff
 
     $ ./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/
 
     
 * * *
Updated by Mitch Allen

File pistreaming.markdown Modified

  • Ignore whitespace
  • Hide word diff
     $ 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"
+    $ ./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"
 
 
     
Updated by Mitch Allen

File pistreaming.markdown Modified

  • Ignore whitespace
  • Hide word diff
     $ export LD_LIBRARY_PATH=.
     $ ./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so"
 
-On another machine (like a Mac using Chrome) browse to:
+On another machine (like a Mac using Chrome) browse to (replacing *HOSTNAME* with your Pi hostname):
 
     http://HOSTNAME.local:8080
 
Updated by Mitch Allen

File pistreaming.markdown Modified

  • Ignore whitespace
  • Hide word diff
 ## 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
+    $ sudo raspi-config  # Enable the camera: 6 Enable Camera / Yes / OK / Finish
     $ mkdir projects
     $ cd projects/
-    $ sudo apt-get install git
+    $ 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/
 
     http://HOSTNAME.local:8080/?action=stream
     
+You can also try:
+
+    ./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -x 1280 -y 720 -fps 15 -ex night"
+
+
+    
 * * *
Updated by Mitch Allen

File pistreaming.markdown Modified

  • Ignore whitespace
  • Hide word diff
 ## 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.
 
 
     $ sudo apt-get update
     $ sudo raspi-config
-$ mkdir projects
-$ cd projects/
-$ sudo apt-get install git
-$ 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"
+    $ mkdir projects
+    $ cd projects/
+    $ sudo apt-get install git
+    $ 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"
 
 On another machine (like a Mac using Chrome) browse to:
 
-http://HOSTNAME.local:8080
+    http://HOSTNAME.local:8080
 
 Or:
 
-http://HOSTNAME.local:8080/?action=stream
+    http://HOSTNAME.local:8080/?action=stream
+    
+* * *
  1. 1
  2. 2
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.