Difference between revisions of "RPi-Cam-Web-Interface"

From eLinux.org
Jump to: navigation, search
(Add description to embed life-preview in homepage)
Line 51: Line 51:
 
* Press Test
 
* Press Test
 
* If it works, press Save
 
* If it works, press Save
 +
 +
== Embed live-preview in own homepage ==
 +
 +
- Navigate to /var/www
 +
- Remove all files except cam_pic.php, script_min.js and FIFO
 +
- Copy your own homepage into /var/www
 +
- Change your index.html/php: Add script_min.js (<script src="script_min.js"></script> in header)
 +
- Change your index.html/php: Add [i]onload="setTimeout('init();', 100);"[/i] to body
 +
- Change your index.html/php: Add <img id="mjpeg_dest"> at the place where you want the live-preview.
 +
The size can be changed either as parameter in /etc/rc.local or with CSS. To add further features (change settings, record images/videos), study the existing homepage.

Revision as of 12:07, 13 March 2014

A space for user contributed ideas and code for the excellent RPi Cam Web Interface found here: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=43&t=63276

Startup Commands

Assuming the camera starts on boot, to have the camera image automatically rotate after rebooting the Pi, enter the following command in /etc/rc.local after the raspimjpeg command:

echo 'ro 270' > /var/www/FIFO

This startup command will change the stream to Image Mode:

echo 'pm' > /var/www/FIFO

If you wish to issue more than one command at startup, you'll need to put the sleep command in-between them:

echo 'pm' > /var/www/FIFO

sleep 1

echo 'ro 270' > /var/www/FIFO

Remote access to website with User/Pass and changing port

http://www.raspberrypi.org/phpBB3/viewtopic.php?p=500460#p500460

Configure Timelapse

Please note - a time-lapse feature will soon be built into RaspiMJPEG itself so the web-interface doesn't need to be running while capturing images. Therefore use the instructions in this link with caution.

http://www.raspberrypi.org/phpBB3/viewtopic.php?p=514289#p514289

Use nginx web server instead of Apache

This could cause difficulties when silvanmelchior releases an update because it would try to install Apache again

http://www.raspberrypi.org/phpBB3/viewtopic.php?p=515259#p515259

View video stream on an iDevice / Smartphone

Credit goes to Oke for the original post. A few more tweaks added for iPhone app. http://www.raspberrypi.org/phpBB3/viewtopic.php?p=507756#p507756

  • On the Pi, run:

ln -s /run/shm/mjpeg/cam.jpg /var/www/cam.jpg

  • Download "IP Cam View Pro" (I used IP Cam View Lite on the iPhone - can upgrade to Pro)
  • Select the menu icon
  • Press Manage Cameras
  • Select Add Camera then Generic URL
  • Give your cam a name
  • For Type choose Generic Video URL
  • Enter your URL, e.g. http://192.168.0.1:80/cam.jpg
  • Press Test
  • If it works, press Save

Embed live-preview in own homepage

- Navigate to /var/www - Remove all files except cam_pic.php, script_min.js and FIFO - Copy your own homepage into /var/www - Change your index.html/php: Add script_min.js (<script src="script_min.js"></script> in header) - Change your index.html/php: Add [i]onload="setTimeout('init();', 100);"[/i] to body - Change your index.html/php: Add <img id="mjpeg_dest"> at the place where you want the live-preview.

The size can be changed either as parameter in /etc/rc.local or with CSS. To add further features (change settings, record images/videos), study the existing homepage.