itsmedoofer
Posts: 356
Joined: Wed Sep 25, 2013 8:43 am

Re: RPi Cam Web Interface

Fri Feb 07, 2014 8:38 am

Hi,

No worries, glad its working......

Try this..... Navigate to /var/www

rename index.html to something else and then....

sudo nano index.html

And copy this in

Code: Select all

    <!DOCTYPE html>
    <html>
      <head>
        <title>Tankerton Slopes</title>
        <script src="script_basic.js"></script>
      </head>
      <body onload="setTimeout('init();', 100);">
        <center>
          <h1>Tankerton Slopes - Live</h1>
          <div><img id="mjpeg_dest"></div>
      </body>
    </html>
Replace Tankerton Slopes with your own text...

Then,

sudo nano script_basic.js

and copy this in

Code: Select all

//
// MJPEG
//
var mjpeg_img;
var halted = 0;

function reload_img () {
  if(!halted) mjpeg_img.src = "cam_pic.php?time=" + new Date().getTime();
  else setTimeout("reload_img()", 500);
}

function error_img () {
  setTimeout("mjpeg_img.src = 'cam_pic.php?time=' + new Date().getTime();", 100);
}

//
// Ajax Status
//
var ajax_status;

if(window.XMLHttpRequest) {
  ajax_status = new XMLHttpRequest();
}
else {
  ajax_status = new ActiveXObject("Microsoft.XMLHTTP");
}


function reload_ajax (last) {
  ajax_status.open("GET","status_mjpeg.php?last=" + last,true);
  ajax_status.send();
}


//
// Ajax Commands
//
var ajax_cmd;

if(window.XMLHttpRequest) {
  ajax_cmd = new XMLHttpRequest();
}
else {
  ajax_cmd = new ActiveXObject("Microsoft.XMLHTTP");
}

function send_cmd (cmd) {
  ajax_cmd.open("GET","cmd_pipe.php?cmd=" + cmd,true);
  ajax_cmd.send();
}

//
// Init
//
function init() {

  // mjpeg
  mjpeg_img = document.getElementById("mjpeg_dest");
  mjpeg_img.onload = reload_img;
  mjpeg_img.onerror = error_img;
  reload_img();
  // status
  reload_ajax("");

}
This is all the work of other far more clever people here, I've just cut and shut it to suit our needs..... Cheers guys !!!!

User avatar
acombs1793
Posts: 17
Joined: Sun Feb 02, 2014 7:13 am

Re: RPi Cam Web Interface

Fri Feb 07, 2014 12:40 pm

Hey thanks for the responses, I really appreciate you help over the last couple of days. Im hoping I will be able to try this tonight after work. Can you briefly describe what you posted, will do? Will I still be able to access the controls on my part but be able to send out a link to the standalone feed separately? Just wanted to know, again thanks for your time.

HeikoG
Posts: 12
Joined: Wed Oct 16, 2013 11:53 am

Re: RPi Cam Web Interface

Sat Feb 08, 2014 1:50 pm

Maybe someone can help me. I have done a fresh installation and see the RPI Webcam. But motion doesn't work.
In syslog i see:

Feb 8 13:46:30 raspberrypi motion: [1] Failed to open camera - check your config and that netcamera is online
Feb 8 13:46:30 raspberrypi motion: [1] Failed to read first camera header - giving up for now

Any ideas?

PS: I found the reason: when you run httpd on a different port for security reason you have to change motion.conf. Example:

netcam_url http://localhost:88/cam_pic.php

reeds
Posts: 3
Joined: Sat Feb 08, 2014 2:46 pm
Location: Germany

Re: RPi Cam Web Interface

Sat Feb 08, 2014 11:30 pm

Hello all together

my highest respect and thanks to the developer and all volunteers involved this project. For days I spend almost every evening with this project and until now had great fun with it. Thanks to this great forum I was able to eliminate almost all of the problems that I encountered as a beginner. However, 3 (probably small ) issues have been left open:

1. How can I change the file names of images and videos to a format such as year-month-day_hour-minute-seconds.jpg/mp4 without the consecutive numbering?

2. Motion works for me not with "netcam_url http://localhost/cam_pic.php" but only with "netcam_url file:///dev/shm/mjpeg/cam.jpg". Is this a comprehensible way or should I look for a fault here?

3. Sometimes the video is not converted to mp4 and remains as a h264 file . What could be wrong?

For all tips, especially at point 1, I would be very grateful!

Best Regards
Reeds

PS : This text was created with Google Translate. Please forgive me for my bad English.

jussi24
Posts: 64
Joined: Fri Jul 26, 2013 11:30 am

Re: RPi Cam Web Interface

Sun Feb 09, 2014 12:55 pm

Hi, two questions:

1.) when changing the resolution in raspimjpeg it seems only to scale the image itself but doesn't extend the viewing area as it is known when using raspivid. I need the full viewing area and I'm wondering how to tell raspimjpeg to widen the viewing angle.
What I really want is using the full camera sensor's active area. Is there a way to get this with raspimjpeg?

2.) Is there a way to get the original h264 data stream out of the raspi with raspimjpeg? Since bandwith is a limited ressource this could be the most ressource saving way to get a smooth full quality video stream from one raspi to some other viewers. Think this makes sense when h264 more and more gets the mainstream format in surveillance/entertainment business.

Sorry if this is written somwhere in this thread but I think reading 280 messages is not the most efficient way to get information. Is there a homepage for this project where one can get all such information?
Thanks!

reeds
Posts: 3
Joined: Sat Feb 08, 2014 2:46 pm
Location: Germany

Re: RPi Cam Web Interface

Sun Feb 09, 2014 2:15 pm

jussi24 wrote:Hi, two questions:

1.) when changing the resolution in raspimjpeg it seems only to scale the image itself but doesn't extend the viewing area as it is known when using raspivid. I need the full viewing area and I'm wondering how to tell raspimjpeg to widen the viewing angle.
What I really want is using the full camera sensor's active area. Is there a way to get this with raspimjpeg?

2.) Is there a way to get the original h264 data stream out of the raspi with raspimjpeg? Since bandwith is a limited ressource this could be the most ressource saving way to get a smooth full quality video stream from one raspi to some other viewers. Think this makes sense when h264 more and more gets the mainstream format in surveillance/entertainment business.

Sorry if this is written somwhere in this thread but I think reading 280 messages is not the most efficient way to get information. Is there a homepage for this project where one can get all such information?
Thanks!

Hi jussi24,

unfortunately, I can not help you directly - I'm still a beginner myself - sorry. But maybe you can do that too even if you realize that just below this post a search with the title "Search This Topic" exists. With which I could find in the last days "almost" all the answers to my questions easily. And everything that is not to be found in this topic, maybe could then be found using the search function at the top right of this page. Here you can query the entire forum.

If I understand it correctly, then raspimjpeg has a different purpose. But maybe this topic gives answer to one of your questions
Streaming Raspberry Pi Camera H264 into HTML over RTMP
http://www.raspberrypi.org/phpBB3/viewt ... 43&t=45368

Good Luck!
Reeds

P.S.: This text was created with Google Translate. Please forgive me for my bad English.

nolman
Posts: 32
Joined: Sat Mar 30, 2013 9:33 am

Re: RPi Cam Web Interface

Sun Feb 09, 2014 3:17 pm

I have all this working, with a page only showing the camera image in chromium on raspberries.
I would like to know how i can automatically scale the camera image to maximum size inside chromium (centered,max width and keep ratio) independantly from the resolution i chose with raspivid.

I suppose i should do this in the css file.
But need some help with coding and syntax.

anybody an idea?

edit: i figured it out. reply if anyone needs the code.
Last edited by nolman on Sun Feb 23, 2014 10:54 am, edited 2 times in total.

flo850
Posts: 1
Joined: Sun Feb 09, 2014 4:30 pm

Re: RPi Cam Web Interface

Sun Feb 09, 2014 4:58 pm

Hello,

Thank you sylvan for this awesome library.

Since my raspberry will drive a car with nodejs , I put a little work to try to free some ressources from the camera. It turns out nginx can be very helpfull : it can serve 512*288 image @50 fps , while driving the car. Apache was @24 in the same condition, and a pure nodejs solution @ 18. Event better I have a good fps at a higher resolution, like 700*393 @30 fps

Code: Select all

sudo apt-get install nginx
Then ,
[*] in /etc/nginx/nginx.conf : disable log and gzip : put a # before "gzip on;" and "access_log /var/log/nginx/access.log"
[*] /etc/nginx/sites-available/default : modify root and port

Code: Select all

root /dev/shm/mjpeg/;  
listen   8001;
You 'll juste have to change the image url from "cam_pic.php?time=" + new Date().getTime() to "http://IP_OF_YOUR_PI:8001/cam.jpg?time=" + new Date().getTime()


Florent

nolman
Posts: 32
Joined: Sat Mar 30, 2013 9:33 am

Re: RPi Cam Web Interface

Mon Feb 10, 2014 10:26 am

when i try to display the webpage on another pi on wired LAN in midori or chromium it seems the raspberry is only able to display like 2 frames per second and cpu is at 100%.
On the laptop the stream displays fine.

Is there any way to improve the fps on the second raspberry?

gpu has 256mb
overclock is at turbo
/usr/bin/X :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch -
is taking 75% cpu, is this normal?

BleepandBooster
Posts: 4
Joined: Mon Feb 10, 2014 1:42 pm

Re: RPi Cam Web Interface

Mon Feb 10, 2014 1:50 pm

Hello,

Firstly thanks for the software, it is a work of Genius! We have spent a fair bit of time trying to stream with MPlayer, VLC, Motion etc with varying success but this is exactly what we have been looking for.

The plan is to set up the RPi and camera in a nest box, which means the SD card will not be easily accessible. I note from previous posts that it should be possible to set up file saving to a network drive. Can anybody walk us through this step by step please?

Also we can't get VLC to receive the stream although it runs in Firefox with no problems.

Thanks.

pistoi0
Posts: 9
Joined: Sat Sep 01, 2012 4:50 pm

Re: RPi Cam Web Interface

Tue Feb 11, 2014 2:55 am

I have been trying for three days to get this wonderful program working. I have followed the instructions carefully, tried two separate pi, one connected by eth0 another by a usb dongle. Raspbian boots straight to the desktop, then after a split second delay and a brief flash of the camera LED, the desktop screen is perfectly usable. But there is no sign of camera function. I've started over and over again with a fresh download on an 8 gig SD. I am using NOOBS Raspbian. What am I missing?

nolman
Posts: 32
Joined: Sat Mar 30, 2013 9:33 am

Re: RPi Cam Web Interface

Tue Feb 11, 2014 7:25 am

pistoi0 wrote:I have been trying for three days to get this wonderful program working. I have followed the instructions carefully, tried two separate pi, one connected by eth0 another by a usb dongle. Raspbian boots straight to the desktop, then after a split second delay and a brief flash of the camera LED, the desktop screen is perfectly usable. But there is no sign of camera function. I've started over and over again with a fresh download on an 8 gig SD. I am using NOOBS Raspbian. What am I missing?

What do you mean by : " there is no sign of camera function" ? how have you tested this ?

reeds
Posts: 3
Joined: Sat Feb 08, 2014 2:46 pm
Location: Germany

Re: RPi Cam Web Interface

Tue Feb 11, 2014 11:30 am

Could someone PLEASE tell me what needs to be changed in rc.local or wherever
to get out of this
%04d_%04d%02d%02d_%02d%02d%02d.mp4
a structure such as this
year-month-day_hour-minute-seconds.mp4
for the naming of files without the numbering at the beginning!?

Since days now I read documentations and google - but can not find a hint.

from where comes %d?
how can you skip one of %d?
according to which subject I should look for in order to understand?

Thanks!
Best Regards
Reeds

pistoi0
Posts: 9
Joined: Sat Sep 01, 2012 4:50 pm

Re: RPi Cam Web Interface

Tue Feb 11, 2014 6:00 pm

pistoi0 wrote:I have been trying for three days to get this wonderful program working. I have followed the instructions carefully, tried two separate pi, one connected by eth0 another by a usb dongle. Raspbian boots straight to the desktop, then after a split second delay and a brief flash of the camera LED, the desktop screen is perfectly usable. But there is no sign of camera function. I've started over and over again with a fresh download on an 8 gig SD. I am using NOOBS Raspbian. What am I missing?

What do you mean by : " there is no sign of camera function" ? how have you tested this ?

@nolman, thank you for your response. What I mean is that there is no video of any kind to indicate that the camera is functioning. I know that something is working because the camera LED flashes briefly and there is an equally brief black screen before the Raspberry desktop appears. It seems that the camera function is triggered and then is halted immediately. I have tested on two Model B RPis, using two different monitors. In both cases the camera was aimed at well-lighted sources. I have been using linux for 10 years, but I am still prone to silly mistakes. Thanks again.

ShorTie
Posts: 92
Joined: Sun May 12, 2013 3:54 pm

Re: RPi Cam Web Interface

Thu Feb 13, 2014 8:11 am

Thank you Mr. silvanmelchior for all your hard work.

And many Thankz goes out to jbeale for all he's testing and help.

I'm trying to setup a security system for the farm and was wondering if this could be used as a front end for zoneminder? I've tried a few feeble attempts with no luck so far :( .

@ pistoi0, I would suggest dumping NOOBS and just loading the raspbian image directly to the card.
It seems to cause more problems then it is worth at times.
I also find that running the install is better done as root, so 'sudo su' may be inorder before the install lines.

shuckle
Posts: 565
Joined: Sun Aug 26, 2012 11:49 am
Location: Finland

Re: RPi Cam Web Interface

Thu Feb 13, 2014 9:06 am

ShorTie wrote: I'm trying to setup a security system for the farm and was wondering if this could be used as a front end for zoneminder? I've tried a few feeble attempts with no luck so far :( .
I am just using mjpg_streamer as shown in
http://www.raspberrypi.org/forum/viewto ... 41&t=61787

ShorTie
Posts: 92
Joined: Sun May 12, 2013 3:54 pm

Re: RPi Cam Web Interface

Thu Feb 13, 2014 12:03 pm

hmmm, ok, I have seen that but have not tried it yet.
But today is nothing but cold, windy and snowy, so a good day to try.

I guess I'm just confused as to why this seems like a mjep streamer in it's self,
Why zoneminder would have a hard time picking it up :? .

kerbys
Posts: 3
Joined: Thu Nov 21, 2013 9:12 am

Re: RPi Cam Web Interface

Thu Feb 13, 2014 5:33 pm

Ive mapped a network drive to the pi and I have changed in motion.conf to change the target base directory to my network drive. I can see the drive when I use ssh and it will list folders on that drive.


When the pi records video it still shows the recorded video on the download video and images?

Is there anouther config file i should be editing?

hystrix
Posts: 56
Joined: Mon Jan 07, 2013 12:44 pm

Re: RPi Cam Web Interface

Fri Feb 14, 2014 2:42 pm

I would like to have a button on the web interface to reboot my Pi (to restart RaspiMJPEG in case it has crashed for some reason). Is this possible?

I would be grateful if someone could give me an indication about how to do this.

Many thanks.

JonesThePi
Posts: 21
Joined: Tue Oct 23, 2012 1:08 pm

Re: RPi Cam Web Interface

Fri Feb 14, 2014 3:02 pm

After going down the same route as kerbys I eventually mapped a network drive to /var/www/media. This meant that after checking folder permissions no further configuration was necessary.

I am still having problems getting all the pipe commands working. I have now tested all the possible pipe commands from a python script and can only get the ones that take a numeric argument to work, i.e. echo 'ro 180' > /var/www/FIFO works but echo 'em night' > /var/www/FIFO will not. Running these commands from the command line gives the same results.

Can anyone confirm that this works for them and if so where I may be going wrong...

User avatar
Trixster
Posts: 261
Joined: Sat Jul 07, 2012 3:53 pm

Re: RPi Cam Web Interface

Fri Feb 14, 2014 6:59 pm

Would it be possible to get an option to upload video captured by the motion detection (either manually or automatically at a certain time) to either google drive or dropbox? That would be superb.

pistoi0
Posts: 9
Joined: Sat Sep 01, 2012 4:50 pm

Re: RPi Cam Web Interface

Fri Feb 14, 2014 7:08 pm

@ pistoi0, I would suggest dumping NOOBS and just loading the raspbian image directly to the card.
It seems to cause more problems then it is worth at times.
I also find that running the install is better done as root, so 'sudo su' may be inorder before the install lines.
Thanks @ShorTie. I will give both suggestions a try when I have time again to doso.

jussi24
Posts: 64
Joined: Fri Jul 26, 2013 11:30 am

Re: RPi Cam Web Interface

Sun Feb 16, 2014 4:23 pm

RPiCAMWebInterface is _nerarly_ a perfect thing. But I cannot imagine that I'm the only one missing the full sensor's area for capturing/streaming. There's a extremly interesting article here
http://picamera.readthedocs.org/en/rele ... resolution
(you know this of course).
Is there a possibility to set the resolution to MAX, making the video/capture stream using the full sensor's area, and resize the output of the cam to some lower resolution (1024x768 e.g.) to limit the data to stream...
Or there ist a totally different solution for the problem...
Is there a way you can imagine?

oke
Posts: 2
Joined: Thu Jan 30, 2014 7:14 pm
Location: Finland

Re: RPi Cam Web Interface

Tue Feb 18, 2014 7:50 pm

Dear jussi24,

You can change the picture size in following places and see what happens:
1. (sudo nano) RPI_Cam_Browser_Control_Installer.sh
2. (sudo nano) /etc/rc.local
3. (sudo nano) /var/www/index.html
- limit width and height for browser like: <img id="mjpeg_dest" width="960" height="540">

If You add this link (by hand), You can use IP Cam Viewer Pro (by Robert Chou) on tablet or phone
- ln -s /run/shm/mjpeg/cam.jpg /var/www/cam.jpg
- You can see the bigger picture by browser with no refresh too

IP Cam Viewer Pro settings are as follows:
- Generic URL, URL: http://my.raspberry.pi:80/cam.jpg
- Max size here is 1920 x 1080
- Tested with Nexus 4, Nexus 7 and Jolla

I have 4 cameras in use now and 3 of them with ethernet cable connection
keep on working. One camera has Wi-Fi connction and that connection
freezes at least once a week. I suggest a timer for daily power reset.
This is normal behavior with allmost all surveillance cameras.
Mozilla browser is used by me to record the max. resolution image.

If You get vc.ril.camera error message, check and push back the yellow connector on camera.

Set of different lenses is available from Verkkokauppa.com for 30€ (Item 10207).


Regards,

Oke

DHadmin
Posts: 1
Joined: Wed Feb 19, 2014 2:40 pm

Re: RPi Cam Web Interface

Wed Feb 19, 2014 2:47 pm

Hallo,

wow this product is cool!
is it also possible to disable the scale option in the web interface?

Return to “Camera board”