silvanmelchior
Posts: 76
Joined: Mon Nov 25, 2013 5:56 pm

RPi Cam Web Interface

Fri Dec 13, 2013 4:14 pm

Installation instructions and all other information is now here:

http://elinux.org/RPi-Cam-Web-Interface
Last edited by silvanmelchior on Fri Apr 17, 2015 12:59 pm, edited 40 times in total.

User avatar
jbeale
Posts: 4003
Joined: Tue Nov 22, 2011 11:51 pm

Re: RPi Cam Web Interface

Fri Dec 13, 2013 7:02 pm

Very impressive work! I'm hoping this can be developed even further, but already I think something like this belongs as an option in the standard Raspbian distribution because it "just works" and so many alternatives just don't, at least for me.

I followed the steps in your post and it took about an hour to do all the updates, upgrades and install. The mjpeg streaming does work better than any other streaming option I have tried. On my system here it is sometimes smooth and sometimes a little choppy, I presume due to my wifi link. No doubt wired ethernet would work better. When it is smooth, it looks just as good as the youtube demo on the other thread. The latency remains fairly low at about 0.4 seconds based on comparing an onscreen timer and the video image of it. This better than the various h264 format streaming that I have tried, where the latency sometimes starts low but then stretches out to 10s of seconds. When you click on the "record image" button, there is about 0.8 seconds delay before the actual image is captured, I presume the time it takes to switch the camera into full-frame mode. Since it is a full-frame still, it shows a wider field of view than the MJPEG preview which shows only the video area. I also see about that much delay between "record video start" and actual recording start. During a recording, the MJPEG preview sometimes freezes for about a second, but the actual mp4 video as saved is smooth without any glitches.

While remotely viewing the 640x360 mjpeg image, the R-Pi reports 38% CPU for raspimjpeg and 16% for apache2. My R-Pi is not overclocked. While viewing MJPG, windows task manager says I am using 25% of my 54 Mbps wifi link, so that is a data rate of 13.5 Mbps.

It's really nice to have the control panel with the control options to save stills and full-res mp4 file, I think many people are going to be using this!

Note, in the secondary "preview.php" page under the "Download Videos and Images" link , I can view a preview of the JPEG stills fine, but the preview window for the mp4 video shows a grey rectangle with the text "No video with supported format and MIME type found". However I can still download the mp4 file and play it locally on my WinXP box, that part works OK.
Also, if you change a setting and then navigate away from the setting page, then back the settings appear to return to their default (although the actual setting in effect does not reset change). Not a big deal, just a result of the javascript (?) not maintaining the current state in between page loads.

Here's what the main page looks like (this particular camera has a closeup lens, so everything looks blurry)

Image
Last edited by jbeale on Fri Dec 13, 2013 9:54 pm, edited 3 times in total.

Honsolgen
Posts: 20
Joined: Mon Nov 25, 2013 8:35 am
Location: Honsolgen - Germany

Re: RPi Cam Web Interface

Fri Dec 13, 2013 8:39 pm

after installing it raspistill is not working anymore
how to remove it? Or at least stopping the exclusive access of the cam?
raspistill -ex night -ISO 500 -ss 1000000 -t 10000 -w 1600 -h 1200 -q 75 -o current.jpg
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

User avatar
jbeale
Posts: 4003
Joined: Tue Nov 22, 2011 11:51 pm

Re: RPi Cam Web Interface

Fri Dec 13, 2013 9:07 pm

if you install as described in the first post, raspimjpeg will be running continuously, forever. To do anything else with the camera like raspistill or raspivid, you would first have to stop the process. Look for the PID of the 'raspimjpeg' process and kill it. If you do 'top' it will probably be the first one listed.

I guess the point of this program is that you don't need raspistill/vid anymore, you can capture stills or video directly from the browser. Probably it is possible to add a button to the control window to stop and start the raspimjpeg process, for convenience.

Honsolgen
Posts: 20
Joined: Mon Nov 25, 2013 8:35 am
Location: Honsolgen - Germany

Re: RPi Cam Web Interface

Fri Dec 13, 2013 9:30 pm

thanks,
uncomment it in rc.local stopped the exclusive access

I´m testing the PiCam as webcam, because the image quailty is surprisingly very good
http://adr.dyndns.org:81/webcam/raspcam/

so I need raspistill working in a shell script

User avatar
jbeale
Posts: 4003
Joined: Tue Nov 22, 2011 11:51 pm

Re: RPi Cam Web Interface

Sat Dec 14, 2013 12:05 am

Honsolgen wrote:I´m testing the PiCam as webcam, because the image quailty is surprisingly very good
http://adr.dyndns.org:81/webcam/raspcam/
so I need raspistill working in a shell script
Well done website, by the way! Those are very nice images.

I've now tried the RPi Cam Web Interface with raspimjpeg with browsers on my phone, a WinXP desktop, and a Lenovo 20326 Windows 8 tablet. Everything works OK with Firefox on desktop & tablet, and Opera Mobile on the Android phone. Chrome on both the tablet and desktop works for several minutes, then runs out of memory and crashes ("Aw, Snap! Something went wrong while displaying this webpage.") MS Internet Explorer doesn't really work at all on either device (gives flickering image, then goes blank, or freezes). I don't normally use Chrome or MSIE so maybe that's just how these browsers support, or don't support MJPEG.

With Chrome 32.0.1700.41 it is either a memory leak or a garbage collector problem or similar. Looking at the task manager, the memory taken by one of the two "chrome.exe" tasks while the MJPEG page is open simply continues to grow at a steady rate, until it exceeds available memory and crashes around 2 GB. Looks like it is saving every single JPEG image displayed in process memory, forever. Firefox 25.0.1 actually starts out growing too, but then levels off around 500 MB.

Update: here is a sample video, the 1080p version which was capture by the R-Pi showing the browser on a tablet displaying the MJPEG stream via the wifi link. You can get an idea of the lag, due to the video feedback effect.
http://www.youtube.com/watch?v=RQHKQPZgEVU

andlinux
Posts: 18
Joined: Fri Dec 13, 2013 12:08 pm
Location: Belgium

Re: RPi Cam Web Interface

Sat Dec 14, 2013 2:40 pm

This looks very promising but is it possible to use the images the camera makes on a custom webpage, like with mjpg-streamer or something else ?
I've got a spare RPi here and maybe I'm gonna test it on that one.

User avatar
jbeale
Posts: 4003
Joined: Tue Nov 22, 2011 11:51 pm

Re: RPi Cam Web Interface

Sat Dec 14, 2013 3:44 pm

andlinux wrote:This looks very promising but is it possible to use the images the camera makes on a custom webpage, like with mjpg-streamer or something else ?
I've got a spare RPi here and maybe I'm gonna test it on that one.
Of course you could modify the existing index.html to look like whatever you like, the code seems pretty easy to read. There is a fairly simple javascript file that does both the MJPEG loading every 40 milliseconds, plus handles the control interface. You could whittle it down to just the MJPEG part if you wanted.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: RPi Cam Web Interface

Sat Dec 14, 2013 4:12 pm

This is impressive, well done. I have the same experiences as jbeale with Chrome and IE. Works OK on the Android stock browser, although I only used it for a short while.

My idea is also to add start/stop buttons, the --roi option and a possibility to use the full manual shutterspeed/ISO option without any of the default exposure modes.

silvanmelchior
Posts: 76
Joined: Mon Nov 25, 2013 5:56 pm

Re: RPi Cam Web Interface

Sat Dec 14, 2013 6:08 pm

@jbeale: Thanks a lot for your testing! I updated the installer and now the memory for chrome shouldn't grow anymore. Internet Explorer still doesn't really work because usually a plugin for MJPEG in IE is needed, so if someone want's to do the work, feel free and please post here, but I work with Linux so I don't have IE. If you can see a preview of the video in the browser depends on the video-formats that the used browser supports. It should work with Firefox 21 or higher on Win 7 or higher, with Chrome and with Safari. If you want to update your installed web interface, run the following commands:

Code: Select all

cd /var/www
sudo wget http://grustu.ch/share/rpi_cam/www.tar.gz
sudo tar -xvzf www.tar.gz -C .
sudo rm www.tar.gz
sudo chown www-data:www-data media
@Honsolgen: If you want to free the camera just temporarily, run "sudo killall raspimjpeg" and to restart the service, run "sudo /etc/rc.local".

Thank's a lot for all your great ideas on how to improve the web interface and add more features. Unfortunately I won't have the time at the moment to implement them, because I created this interface for my next project: I want to add the RPi with cam to my quadcopter and record a lot of beautiful images and videos, controled from my smartphone browser. But if one of you finds the time, I would be grateful if you post your solution here!
Last edited by silvanmelchior on Sun Dec 15, 2013 1:22 pm, edited 1 time in total.

User avatar
jbeale
Posts: 4003
Joined: Tue Nov 22, 2011 11:51 pm

Re: RPi Cam Web Interface

Sat Dec 14, 2013 9:19 pm

Thanks for the update! Installed on a new system and Chrome is working just fine now, and its memory footprint remains small. And sure enough, on this machine I have the right codec and the video preview works also. On a wired network, looks like live-to-displayed image delay is just about 300 msec. I haven't done this kind of www javascript stuff before, but the code seems pretty self explanatory, if I get some time I'll see if I can't develop it a little bit more. -John

User avatar
micksulley
Posts: 257
Joined: Sat Mar 03, 2012 11:48 am
Location: Melton Mowbray, England

Re: RPi Cam Web Interface

Sat Dec 14, 2013 9:53 pm

Brilliant!!! Thank you. I have been playing around with the Pi camera for a few days now, tried stuff from several sites, all with some success but never quite working as expected, but yours just works.

Iceweasle 17.0.9 the video preview doesn't work but everything else is fine, Chromium Version 29.0.1547.57 Built on Debian 7.1, running on Debian 7.2 (217859) it all works, but it seems rather jerkier (is that a word?) than in Iceweasle.

You asked for feedback, so here is my wishlist -
Motion detection to start video recording while motion is detected plus a short time afterwards.
Videos recorded to a new file each time, with either a sequential file name or time/date based name.
Time/date embedded into the video picture.

With that I could set it up at the front of my house and in addition to the current live feed I could look at the video files and review the activity while I have been away.

Great work - well done!
Mick

User avatar
CopterRichie
Posts: 131
Joined: Tue Mar 26, 2013 3:14 am
Location: Los Angeles CA.

Re: RPi Cam Web Interface

Sat Dec 14, 2013 10:56 pm

Wow, this is a huge step for RPI-mankind. This noob was able to get this working without a hitch. Tested on Mac-OSX 10.8.5 and Firfox 25.0.1

User avatar
CopterRichie
Posts: 131
Joined: Tue Mar 26, 2013 3:14 am
Location: Los Angeles CA.

Re: RPi Cam Web Interface

Sun Dec 15, 2013 12:13 am

Suggestion for future revision. How about a shutdown button.

Thank you.

AforAlex
Posts: 85
Joined: Thu May 31, 2012 7:56 pm

Re: RPi Cam Web Interface

Sun Dec 15, 2013 12:18 am

This is awesome, you are awesome. Thank you for making and sharing this. Its exactly what I need to finish off my big track web controlled car. Thank you

User avatar
micksulley
Posts: 257
Joined: Sat Mar 03, 2012 11:48 am
Location: Melton Mowbray, England

Re: RPi Cam Web Interface

Sun Dec 15, 2013 12:25 am

Where can I find the source code for this?


Sniffers
Posts: 2
Joined: Sun Dec 15, 2013 1:35 pm

Re: RPi Cam Web Interface

Sun Dec 15, 2013 1:43 pm

Honsolgen wrote:thanks,
uncomment it in rc.local stopped the exclusive access

I´m testing the PiCam as webcam, because the image quailty is surprisingly very good
http://adr.dyndns.org:81/webcam/raspcam/

so I need raspistill working in a shell script
I link this project very much, is there a chance that you'll share the code or give a manual to install all off this?

User avatar
jbeale
Posts: 4003
Joined: Tue Nov 22, 2011 11:51 pm

Re: RPi Cam Web Interface

Sun Dec 15, 2013 3:16 pm

Sniffers wrote:I link this project very much, is there a chance that you'll share the code or give a manual to install all off this?
This is the install guide, pretty easy: http://www.raspberrypi.org/phpBB3/viewt ... 76#p468491
This is the source code for RaspiMJPEG: https://github.com/silvanmelchior/userl ... s/raspicam
This is the instructions for building RaspiMJPEG from source: http://www.raspberrypi.org/phpBB3/viewt ... 43&t=61771

The rest of it for the web interface (html, php and js source) is in plain text files in your /var/www directory after you follow the install guide instructions in the first link.

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand

Re: RPi Cam Web Interface

Sun Dec 15, 2013 4:44 pm

very good tool. i love it,
but i lost more than a day to try to get it running from berryboot SD
have this ENOSYS error with raspistill after rpi-update.
only with noobs (light) install ... ( just now finished ) it works.
( error is not related to this project! )
any ideas?

silvanmelchior
Posts: 76
Joined: Mon Nov 25, 2013 5:56 pm

Re: RPi Cam Web Interface

Sun Dec 15, 2013 5:21 pm

Update: It's now possible to halt and restart the process from the website. So you can release the camera temporarily for raspistill/raspivid. To get the update, just run the installer again.

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: RPi Cam Web Interface

Sun Dec 15, 2013 5:26 pm

Great news!

Just FYI, Chrome now dumps the accumulated memory (runs up to about 4GB on my system), but in the end still crashes as it seems to go higher than a certain point. I made a screen dump of the memory usage, at the far right is where it crashed:
ChromeCrash.jpg
ChromeCrash.jpg (61.67 KiB) Viewed 492914 times

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: RPi Cam Web Interface

Sun Dec 15, 2013 5:39 pm

After running the installer again Chrome doesn't use excessive memory any more, so that problem seems to be solved. I earlier followed the instructions with the tar archive, but that didn't help.

I see the "release camera" button, but in Chrome (W7 64) it doesn't work, does nothing. Neither on my Android phone.

silvanmelchior
Posts: 76
Joined: Mon Nov 25, 2013 5:56 pm

Re: RPi Cam Web Interface

Sun Dec 15, 2013 5:45 pm

Sorry, I forgot to update the installer itself so that it is able to replace the old files, if you download and run the installer now, it should work:

Code: Select all

rm RPi_Cam_Browser_Control_Installer.sh
wget http://grustu.ch/share/rpi_cam/RPi_Cam_Browser_Control_Installer.sh
chmod u+x RPi_Cam_Browser_Control_Installer.sh
./RPi_Cam_Browser_Control_Installer.sh

andlinux
Posts: 18
Joined: Fri Dec 13, 2013 12:08 pm
Location: Belgium

Re: RPi Cam Web Interface

Sun Dec 15, 2013 6:28 pm

It's installed and by the way it's very easy to install it. ;)
I tried different options like changing ISO, exposure etc. but I don't see any difference ?


I also need to find a way to get those image feed on my webpage (in LAN),
can this also write the images to /run/shm (ramdisk) ?
Or what jbeale said in previous post about getting the html code but where can I find that page ?

See link for screenshot: http://www.wuala.com/andlinux/Share/RPiCamControl.jpg/

EDIT: Now I see a difference when I change some options, I also found where the page is stored,
in /var/www (default apache2). Still looking to implement this on my other webpage.
Last edited by andlinux on Mon Dec 16, 2013 4:37 pm, edited 1 time in total.

Return to “Camera board”