Skip to content

Raspberry Pi's "camera module" based Web application for MJPG-Streaming.

License

Notifications You must be signed in to change notification settings

etxahun/ovencam_mjpg_streamer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ovencam_mjpg_streamer

The idea behind "ovencam" is to use the Raspberry Pi Zero (v1.3) together with a "camera module" and the "ZeroView" holder to provide a MJPG-Streaming Web application.

Table of Contents

Installation

First of all install the prerequisites:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install g++ curl pkg-config libv4l-dev libjpeg-dev build-essential libssl-dev cmake git-core build-essential libjpeg8-dev imagemagick subversion
$ sudo apt-get autoremove
$ sudo shutdown -r now

Then we can install motion-jpeg (mjpeg):

 $ cd /usr/src
 $ sudo mkdir mjpg-streamer
 $ sudo chown pi:users mjpg-streamer
 $ cd mjpg-streamer
 $ git clone //github.com/jacksonliam/mjpg-streamer.git .
 $ cd mjpg-streamer-experimental
 $ make
 $ sudo make install

After the compilation, shutdown the pi and attach the camera:

 $ cd /usr/src/mjpg-streamer/mjpg-streamer-experimental/
 $ export LD_LIBRARY_PATH=.
 $ ./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -x 640 -y 480 -fps 20 -ex night"

My RPi has the following IP address: 192.168.20.83 so you can see the camera at http://192.168.20.83:8080/stream.html

Configuration

⚠️ Warning: keep in mind the following points:

  • NodeJS Web server port: 8080
  • MJPG-Streamer server port: 8081
  • The project is intended to be installed inside "/home/pi" path.

If you want or have to customize the path of the project, the following files must be edited:

  • server.js Line #34:
var path_ovencam = "/home/pi/oven_cam"
  • mjpg-streamer/
  • camera_stop.sh:
echo -n 0 > "/home/odamae/odamaeweb_mjpg-streamer/public/resources/estado_mjpgstreamer.txt"
  • camera_start.sh:
echo -n 1 > "/home/odamae/odamaeweb_mjpg-streamer/public/resources/estado_mjpgstreamer.txt"
./mjpg_streamer -o "output_http.so -w /home/odamae/odamaeweb_mjpg-streamer/mjpg-streamer/www -p 8081 -c <user>:<passwd>" -i "input_raspicam.so -rot 270 -fps 25 -q 50 -x 320 -y 240 ex nig$
  • public/resources/ Just configure the following configuration file:
  • project_path_config.php
<?php
$ovencam_path = '/home/pi/oven_cam';
?>

Additionaly, check that the following lines of "/public/index.html" contains the proper IP address (and MJPG-Streamer PORT):

<div id="arriba">
    <object data="http://192.168.20.83:8081/?action=stream" width="320" height="240">
        <embed src="http://192.168.20.83:8081/?action=stream" width="320" height="240"> </embed>
               Error: No se ha podido cargar el vídeo.
    </object>
</div>

Usage

To be sure that the application is running continously, we will use "Forever" NodeJS module:

$ [sudo] npm install forever -g

⚠️ Note: If you want to use "forever" programmatically you should install forever-monitor.

  $ cd /path/to/your/project
  $ [sudo] npm install forever-monitor

Once "forever" is installed we launch the application:

 $ cd <project_path>
 $ forever start nserver.js

🔧 Troubleshooting:

The "forever" binary file location: /opt/nodejs/bin/forever In order to be globally available the following "EXPORT" line has to be added in ".bashrc":

$ nano /root/.bashrc
	
    export PATH=$PATH:/opt/nodejs/bin

$ exec bash

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

References

The following is a list of useful references used for the development of the application:

About

Raspberry Pi's "camera module" based Web application for MJPG-Streaming.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published