Difference between revisions of "RPi-Cam-Web-Interface"
(→Startup Commands) |
(→Startup Commands) |
||
Line 23: | Line 23: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == | + | == The Config File == |
− | + | Thanks to the amazing hard work by Silvan Melchior, RaspiMJPEG now uses a config file to set various parameters on starting the RPi Can Web Interface. | |
− | + | The release update which includes an example of the config file can be found here: | |
+ | http://www.raspberrypi.org/phpBB3/viewtopic.php?p=524707#p524707 | ||
+ | A few examples on how to set variables can be found below. | ||
− | + | === Changing the Field of View === | |
+ | There are three different preview modes available which are set by changing the resolution of the '''video_width''' and '''video_height''' options in the '''# Video Options''' section. | ||
− | + | The view along with resolution is shown below: | |
− | |||
− | |||
− | |||
− | + | <view name> - <video_width> x <video_height> | |
− | < | + | Std FOV - 1920 x 1080 |
− | + | 16:9 wide FOV - 1296 x 730 | |
− | + | 4:3 full FOV - 1296 x 976 | |
− | + | e.g. to set 4:3 full FOV: | |
+ | # | ||
+ | # Video Options | ||
+ | # | ||
+ | video_width 1296 | ||
+ | video_height 976 | ||
== Remote access to website with User/Pass and changing port== | == Remote access to website with User/Pass and changing port== |
Revision as of 14:46, 24 March 2014
This is the wiki 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
Source code also available on GitHub:
- https://github.com/silvanmelchior/RPi_Cam_Web_Interface
- https://github.com/silvanmelchior/userland/tree/master/host_applications/linux/apps/raspicam
Remember, anyone can create an account on here and add to this wiki.
Contents
- 1 Updating to the latest version
- 2 The Config File
- 3 Remote access to website with User/Pass and changing port
- 4 Configure Timelapse
- 5 Use nginx web server instead of Apache
- 6 View video stream on an iDevice / Smartphone
- 7 Embed live-preview in own homepage
- 8 Save an image upon motion detection
- 9 Move saved images and videos to another folder
- 10 Change video size/resolution displayed on the website
- 11 Scale camera window correctly in Chrome on Android
- 12 Button on web interface to reboot the Pi
- 13 Rotation not working?
- 14 Slow video stream?
Updating to the latest version
First, update your firmware because RaspiMJPEG will utilise the latest camera firmware:
sudo apt-get update
sudo apt-get dist-upgrade
sudo rpi-update
sudo reboot
Then update the code (git pull and stop raspimjpeg are now run when using the install option):
./RPi_Cam_Web_Interface_Installer.sh install
./RPi_Cam_Web_Interface_Installer.sh start
The Config File
Thanks to the amazing hard work by Silvan Melchior, RaspiMJPEG now uses a config file to set various parameters on starting the RPi Can Web Interface.
The release update which includes an example of the config file can be found here: http://www.raspberrypi.org/phpBB3/viewtopic.php?p=524707#p524707
A few examples on how to set variables can be found below.
Changing the Field of View
There are three different preview modes available which are set by changing the resolution of the video_width and video_height options in the # Video Options section.
The view along with resolution is shown below:
<view name> - <video_width> x <video_height> Std FOV - 1920 x 1080 16:9 wide FOV - 1296 x 730 4:3 full FOV - 1296 x 976
e.g. to set 4:3 full FOV:
- Video Options
video_width 1296 video_height 976
Remote access to website with User/Pass and changing port
http://www.raspberrypi.org/phpBB3/viewtopic.php?p=500460#p500460
Configure Timelapse
Timelapse is now built into RaspiMJPEG
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.
Save an image upon motion detection
http://www.raspberrypi.org/forum/viewtopic.php?f=43&t=63276&start=175#p491013
Move saved images and videos to another folder
You could map a network drive to /var/www/media (check folder permissions are set to www-data).
When to do the move - http://www.raspberrypi.org/forum/viewtopic.php?p=515967#p515967
Mounting a share - http://www.raspberrypi.org/phpBB3/viewtopic.php?p=513781#p513781
Mounting a Windows Share - http://www.stuffaboutcode.com/2012/05/raspberry-pi-connect-nas-windows-share.html
Change video size/resolution displayed on the website
At the expense of fps (and reported problems with motion), you can increase the size of the video stream in the website.
If you auto-start (default option) the video, you need to edit /etc/rc.local and change some options in the raspimjpeg command:
- Run the following command to edit the rc.lcoal file
sudo nano /etc/rc.local
- Find the raspimjpeg command
raspimjpeg -w 512 -h 288 -wp 512 -hp 384 -d 1 -q 25 -of /dev/shm/mjpeg/cam.jpg -cf /var/www/FIFO -sf /var/www/status_mjpeg.txt -vf /var/www/media/video_%04d_%04d%02d%02d_%02d%02d%02d.mp4 -if /var/www/media/image_%04d_%04d%02d%02d_%02d%02d%02d.jpg -p -ic $image -vc $video > /dev/null &
- If you are using Image Mode change the -wp and -hp options. Aspect ratio is 4:3 so resolutions such as 640 x 480, 800 x 600 will work.
- If you are using Video Mode change the -w and -h options. Aspect ratio is 16:9 so resolutions such as 640 x 360, 768 x 432, 1280 x 720 will work.
- Change the command to look like this (as an example):
sudo raspimjpeg -w 640 -h 360 -wp 640 -hp 480 -d 1 -q 25 -of /dev/shm/mjpeg/cam.jpg -cf /var/www/FIFO -sf /var/www/status_mjpeg.txt -vf /var/www/media/video_%04d_%04d%02d%02d_%02d%02d%02d.mp4 -if /var/www/media/image_%04d_%04d%02d%02d_%02d%02d%02d.jpg -p -ic $image -vc $video > /dev/null
Scale camera window correctly in Chrome on Android
http://www.raspberrypi.org/phpBB3/viewtopic.php?p=515786#p515786
Button on web interface to reboot the Pi
http://www.raspberrypi.org/phpBB3/viewtopic.php?p=515504#p515504
Rotation not working?
Try a different browser - http://www.raspberrypi.org/forum/viewtopic.php?p=513705#p513705
Internet Explorer isn't supported, Opera and Firefox <21 can't show the preview of recorded videos.
Slow video stream?
http://www.raspberrypi.org/forum/viewtopic.php?p=513162#p513162