How to enable Camera Streaming on a Raspberry Pi

This is a very brief tutorial how to get a stream of the Raspberry Pi camera into a browser. The original article can be found here.

I was searching a lot how to stream directly from the camera to the network, yet I did not find a solution. So what we are doing here is using the timelaps feature from raspistill combined with MJPG-Streamer. In the end you will be able to see the stream in a webbrowser or in VLC Media Player.

Ensure the Camera is enabled

sudo raspi-config

Get, build and install MJPG-Streamer

sudo apt-get install libjpeg8-dev imagemagick libv4l-dev
cd /tmp
wget http://sourceforge.net/code-snapshots/svn/m/mj/mjpg-streamer/code/mjpg-streamer-code-182.zip
unzip mjpg-streamer-code-182.zip
cd mjpg-streamer-code-182/mjpg-streamer
make mjpg_streamer input_file.so output_http.so
sudo cp mjpg_streamer /usr/local/bin
sudo cp output_http.so input_file.so /usr/local/lib/
sudo cp -R www /usr/local/www

Start Camera

mkdir /tmp/stream
raspistill --nopreview -w 640 -h 480 -q 15 -o /tmp/stream/pic.jpg -tl 100 -t 9999999 -th 0:0:0 &

Start Streaming

LD_LIBRARY_PATH=/usr/local/lib 
mjpg_streamer -i "input_file.so -f /tmp/stream -n pic.jpg" -o "output_http.so -w /usr/local/www"

Consume the Stream

Open your browser and go to http://your.raspberry:8080. There you can watch the stream directly and also get the link that you can simply open in vlc to watch the stream in VLC Media Player directly.

But watch out: if you have too many devices connected to the Raspi, it might suddenly turn off due to power undersupply!