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
cd mjpg-streamer-code-182/mjpg-streamer
make mjpg_streamer
sudo cp mjpg_streamer /usr/local/bin
sudo cp /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

mjpg_streamer -i " -f /tmp/stream -n pic.jpg" -o " -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!