Monday, August 3, 2015

Pidora - Use Raspberry Pi as an IP Camera (mjpg-streamer)

Introduction

    This is a practice, I use Raspberry Pi (Raspberry Pi Model B+ not work?) as an IP camera.


Prepare Hardwares

Raspberry Pi
P5V04AA (SUNNY CMOS camera module, image sensor is OV5647)


Install Packages (by root user)

# yum install 'raspberrypi-vc-*'

# vcgencmd get_camera
supported=1 detected=1 <== it means that camera has worked!


# yum install libjpeg-turbo-devel

# yum install libv4l-devel

# ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h

# cd /usr/src
# git clone https://github.com/jacksonliam/mjpg-streamer.git ./mjpg-streamer-git
# cd mjpg-streamer-git/mjpg-streamer-experimental
# make clean all

# cp mjpg_streamer /usr/local/bin
# cp input_raspicam.so output_http.so /usr/local/lib/.
# cp -R www /usr/local/www


Run mjpeg streamer server

# LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_raspicam.so -fps 15 -q 50 -x 640 -y 480" -o "output_http.so -w /usr/local/www"
    It will display message as following:
 i: fps.............: 15
 i: resolution........: 640 x 480
 i: camera parameters..............:

Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 400, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
 o: www-folder-path...: /usr/local/www/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled
 i: Starting Camera


Test

View on your browser by URL:

http://{IP address}:8080


Reference

Raspberry Pi camera board video streaming