rpi-mjpg-streamer
Instructions and helper scripts for running mjpg-streamer on Raspberry Pi.
A. Setup mjpg-streamer
enable raspberry pi camera in raspi-config
$ sudo raspi-config
install necessary packages for mjpg-streamer
$ sudo apt-get update
$ sudo apt-get install libv4l-dev libjpeg8-dev subversion imagemagick v4l-utils
build mjpg-streamer
$ svn co https://svn.code.sf.net/p/mjpg-streamer/code/mjpg-streamer/ mjpg-streamer
$ cd mjpg-streamer
$ sudo ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h
$ make USE_LIBV4L2=true clean all
(for Raspberry Pi Camera boards) setup video4linux
$ sudo modprobe bcm2835-v4l2
$ sudo vi /etc/modules
# add following line
bcm2835-v4l2
$ sudo vi /boot/config.txt
# add following line for disabling RPi camera's LED
disable_camera_led=1
Add yourself to the video group
$ sudo usermod -a -G video $USER
B. Run mjpg-streamer
Clone this repository
$ git clone https://github.com/meinside/rpi-mjpg-streamer.git
Run mjpg-streamer from the shell directly
# copy & edit run-mjpg-streamer.sh to your environment or needs
$ cp rpi-mjpg-streamer/run-mjpg-streamer.sh.sample somewhere/run-mjpg-streamer.sh
$ vi somewhere/run-mjpg-streamer.sh
# then run
$ somewhere/run-mjpg-streamer.sh
Run mjpg-streamer as a service
# copy & edit init/mjpg-streamer to your environment or needs
$ sudo cp rpi-mjpg-streamer/init/mjpg-streamer.sample /etc/init.d/mjpg-streamer
$ sudo chmod +x /etc/init.d/mjpg-streamer
$ sudo vi /etc/init.d/mjpg-streamer
# then register as a boot-up service
$ sudo update-rc.d mjpg-streamer defaults
# or remove it
$ sudo update-rc.d -f mjpg-streamer remove
# and start/stop it
$ sudo service mjpg-streamer start
$ sudo service mjpg-streamer stop
C. Connect
Connect through the web browser:
Most modern browsers(including mobile browsers like Safari and Chrome) will show the live stream immediately.