btidey
Posts: 1635
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Sat Nov 26, 2016 11:18 am

quavoce wrote:I've updated my post to indicate that cam.jpg should be removed if implementing this new login process.
I'll look into incorporating this as an option in the install. There are quite a few manual steps at the moment which makes it a bit more complicated. It might make it easier if one could have a predefined database to load.

quavoce
Posts: 109
Joined: Fri Nov 27, 2015 9:11 am

Re: RPi Cam Web Interface

Sat Nov 26, 2016 3:44 pm

btidey wrote:
quavoce wrote:I've updated my post to indicate that cam.jpg should be removed if implementing this new login process.
I'll look into incorporating this as an option in the install. There are quite a few manual steps at the moment which makes it a bit more complicated. It might make it easier if one could have a predefined database to load.
I had hoped a MySQL query could generate a password hash that matches the method PHP uses, but I don't think this is possible after searching around for a bit.

An alternative method could be to create an initial setup webpage where things like user/pass, mysql database password (the one set by the user during install, unless that can be bypassed and only configured on this welcome page), video size (1080p vs Full FOV), live streaming size, etc, are configured on first run. Then once successful that welcome page could be disabled somehow to prevent it being run again?

For me I would only use this once the IP Cam Pro developer has confirmed that the new user/pass method can be used because I use this app all the time to quickly view all cameras in one place (I'm in contact with him now so hopefully won't be long).

Gary Littlemore
Posts: 327
Joined: Thu Oct 11, 2012 11:52 am
Location: Cheshire, UK

Re: RPi Cam Web Interface

Sun Nov 27, 2016 10:38 am

quavoce wrote:I'm in contact with him now so hopefully won't be long).
This is awesome, taking it to the next level :-)
3b+, 2b, b+, b, Zero & Zero-W

John Public
Posts: 90
Joined: Thu Jan 16, 2014 2:16 pm

Re: RPi Cam Web Interface

Mon Nov 28, 2016 7:58 pm

I installed the RPi cam interface system. Worked like a charm. Wow!
After testing it became a two day operation on how to uninstall it (bummer!), mainly due to problems on uninstalling Apache. Finally I had to reformat the SD card.
I'd like to try it again but is there a "lite" version that does not require installation of a lot of other programs and lots of files all over the place. If possible just a few files. Currently raspistill+mjpeg-streamer+1 html file does about the same thing albeit slower.

btidey
Posts: 1635
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Tue Nov 29, 2016 9:45 am

John Public wrote:I installed the RPi cam interface system. Worked like a charm. Wow!
After testing it became a two day operation on how to uninstall it (bummer!), mainly due to problems on uninstalling Apache. Finally I had to reformat the SD card.
I'd like to try it again but is there a "lite" version that does not require installation of a lot of other programs and lots of files all over the place. If possible just a few files. Currently raspistill+mjpeg-streamer+1 html file does about the same thing albeit slower.
You can install this on Jessie Lite to keep the overall footprint down. You just need to install git first as explained in wiki.

The main installer puts in following packages for an Apache install (around line 319 in install.sh)

sudo apt-get install -y apache2 php5 php5-cli libapache2-mod-php5 gpac motion zip libav-tools gstreamer1.0-tools

apache, php are needed for the base web server functionality, gpac and zip provide format / conversion.

One could leave out motion if using the internal motion detection and one could leave out gstreamer1.0-tools if not doing time lapse converion to video

quavoce
Posts: 109
Joined: Fri Nov 27, 2015 9:11 am

Re: RPi Cam Web Interface

Tue Nov 29, 2016 11:27 am

Hi Robert,

Is there a way to change the annotation text/font size that overlays the video at the top please?

Reason being is I want to reduce the file size of recorded videos to help with playback on slow mobile networks. The best way I've found to do this is reduce the "Video res:" to either 1024x768 or 800x600 to maintain full FOV. This issue with this though is that the annotation text ends up too large, so I'm hoping there's a way to perhaps change the font size?

Thanks.

btidey
Posts: 1635
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Tue Nov 29, 2016 11:57 am

quavoce wrote:Hi Robert,

Is there a way to change the annotation text/font size that overlays the video at the top please?

Reason being is I want to reduce the file size of recorded videos to help with playback on slow mobile networks. The best way I've found to do this is reduce the "Video res:" to either 1024x768 or 800x600 to maintain full FOV. This issue with this though is that the annotation text ends up too large, so I'm hoping there's a way to perhaps change the font size?

Thanks.
Annotation Size under camera settings

quavoce
Posts: 109
Joined: Fri Nov 27, 2015 9:11 am

Re: RPi Cam Web Interface

Tue Nov 29, 2016 1:25 pm

btidey wrote:
quavoce wrote:Hi Robert,

Is there a way to change the annotation text/font size that overlays the video at the top please?

Reason being is I want to reduce the file size of recorded videos to help with playback on slow mobile networks. The best way I've found to do this is reduce the "Video res:" to either 1024x768 or 800x600 to maintain full FOV. This issue with this though is that the annotation text ends up too large, so I'm hoping there's a way to perhaps change the font size?

Thanks.
Annotation Size under camera settings
argh, so simple! I had searched the wiki for an answer before posting too! I'll update the wiki FAQ section with this in case it helps others.
Could a future update move the Annotation Size row to just below the Annotation row so that it's easier to spot please?

John Public
Posts: 90
Joined: Thu Jan 16, 2014 2:16 pm

Re: RPi Cam Web Interface

Tue Nov 29, 2016 3:39 pm

btidey wrote:
John Public wrote:I installed the RPi cam interface system. Worked like a charm. Wow!
After testing it became a two day operation on how to uninstall it (bummer!), mainly due to problems on uninstalling Apache. Finally I had to reformat the SD card.
I'd like to try it again but is there a "lite" version that does not require installation of a lot of other programs and lots of files all over the place. If possible just a few files. Currently raspistill+mjpeg-streamer+1 html file does about the same thing albeit slower.
You can install this on Jessie Lite to keep the overall footprint down. You just need to install git first as explained in wiki.
The main installer puts in following packages for an Apache install (around line 319 in install.sh)
sudo apt-get install -y apache2 php5 php5-cli libapache2-mod-php5 gpac motion zip libav-tools gstreamer1.0-tools
apache, php are needed for the base web server functionality, gpac and zip provide format / conversion.
One could leave out motion if using the internal motion detection and one could leave out gstreamer1.0-tools if not doing time lapse converion to video
Thank for your post.
What I am trying to achieve is cut down complexity to bare minimum. If I put the system running 24/7 and after a few days something locks up the system then trying to zero in on what caused it even with full source is very difficult. A very simple http server is maybe max 100-200 lines of C code. That would supplant PHP and Apache which are huge and very, very difficult to debug.

quavoce
Posts: 109
Joined: Fri Nov 27, 2015 9:11 am

Re: RPi Cam Web Interface

Tue Nov 29, 2016 7:07 pm

Gary Littlemore wrote:
quavoce wrote:I'm in contact with him now so hopefully won't be long).
This is awesome, taking it to the next level :-)
Hi Robert,

The IP Cam Pro developer replied with the following along with a bug report that I'm hoping you can look into please?


"ok, wait for the next update.

after the next update, the "RPi Cam Web Interface" camera type will auto-detect if form login is required so no new camera type is required.

---
now, I have a bug to report to you. it exists in the older versions and your 6.2.19 demo version as well.

If you use the "RPi Cam Web v6" camera type instead, the detail view's video will break up and connection is lost.
The detail view uses "/cam_pic_new.php" for mjpeg.
The reason is the that the mjpeg content-length returned by the rpi server is WRONG (too short).
Why does this happen on this driver? see below:

The "RPi Cam Web Interface" requests HTTP 1.0 so mjpeg content-length is correct.
The "RPi Cam Web v6" requests HTTP 1.1 but ***without*** content chunking.
The reason it works in browsers is because they accept content chunking.

So, I believe the mjpeg content-length is wrong when chunking is not accepted (because rpi server code assumes chunking somewhere)..."

quavoce
Posts: 109
Joined: Fri Nov 27, 2015 9:11 am

Re: RPi Cam Web Interface

Wed Nov 30, 2016 8:53 am

The following is from the app developer too. A bit worrying really as not sure why it's bypassing login?

"The paths used by the app are:
/login/checklogin.php (for login)
/cam_pic_new.php (for mjpeg)
/cam_pic.php (for jpeg)

Also, there's another bug. If you make a request to the above jpeg/mjpeg feeds without a form login, then it'll return 302 status (redirect to login page), however, the actual image content is still being sent! So, I could just ignore the 302 status and keep fetching video!"

btidey
Posts: 1635
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Wed Nov 30, 2016 10:05 am

quavoce wrote:
btidey wrote:
quavoce wrote:Hi Robert,

Is there a way to change the annotation text/font size that overlays the video at the top please?

Reason being is I want to reduce the file size of recorded videos to help with playback on slow mobile networks. The best way I've found to do this is reduce the "Video res:" to either 1024x768 or 800x600 to maintain full FOV. This issue with this though is that the annotation text ends up too large, so I'm hoping there's a way to perhaps change the font size?

Thanks.
Annotation Size under camera settings
argh, so simple! I had searched the wiki for an answer before posting too! I'll update the wiki FAQ section with this in case it helps others.
Could a future update move the Annotation Size row to just below the Annotation row so that it's easier to spot please?
I have moved size and 2 other controls of annotation appearance to be under the text setting. 6.2.21

btidey
Posts: 1635
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Wed Nov 30, 2016 10:21 am

John Public wrote:
btidey wrote:
John Public wrote:I installed the RPi cam interface system. Worked like a charm. Wow!
After testing it became a two day operation on how to uninstall it (bummer!), mainly due to problems on uninstalling Apache. Finally I had to reformat the SD card.
I'd like to try it again but is there a "lite" version that does not require installation of a lot of other programs and lots of files all over the place. If possible just a few files. Currently raspistill+mjpeg-streamer+1 html file does about the same thing albeit slower.
You can install this on Jessie Lite to keep the overall footprint down. You just need to install git first as explained in wiki.
The main installer puts in following packages for an Apache install (around line 319 in install.sh)
sudo apt-get install -y apache2 php5 php5-cli libapache2-mod-php5 gpac motion zip libav-tools gstreamer1.0-tools
apache, php are needed for the base web server functionality, gpac and zip provide format / conversion.
One could leave out motion if using the internal motion detection and one could leave out gstreamer1.0-tools if not doing time lapse converion to video
Thank for your post.
What I am trying to achieve is cut down complexity to bare minimum. If I put the system running 24/7 and after a few days something locks up the system then trying to zero in on what caused it even with full source is very difficult. A very simple http server is maybe max 100-200 lines of C code. That would supplant PHP and Apache which are huge and very, very difficult to debug.
Most of the functionality relies on Ajax and php support. If one wants just the streaming preview then that may be achievable with a simple http that just activates the mjpeg stream.

I doubt whether your unreliability is anything to do with the Apache / PHP side. I have lots of cameras which run very reliably. One has now been going continuously for over a year 24/7 with zero problems and only the occasional software update.

So I would focus more on where your unreliability is. First things to check are the hardware side. Power supply and USB cable used for power connection are very important. The camera takes a bit more current and if the voltage at the Pi is marginal then that can cause unreliable operation. The cable is sometimes overlooked here, but many cables have a higher than expected resistance and cause a significant voltage drop between the supply and the board.

Once that has been eliminated as an issue the next thing would be the networking connection. If using wifi then sometimes they can go into sleep and not recover. There are threads on how to disable power management of the wifi if that is a problem.

Next would be checking the scheduler log to see if that contains any clues on what was happening leading up to a lock up.

btidey
Posts: 1635
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Wed Nov 30, 2016 10:25 am

quavoce wrote:
Hi Robert,

The IP Cam Pro developer replied with the following along with a bug report that I'm hoping you can look into please?


"ok, wait for the next update.

after the next update, the "RPi Cam Web Interface" camera type will auto-detect if form login is required so no new camera type is required.

---
now, I have a bug to report to you. it exists in the older versions and your 6.2.19 demo version as well.

If you use the "RPi Cam Web v6" camera type instead, the detail view's video will break up and connection is lost.
The detail view uses "/cam_pic_new.php" for mjpeg.
The reason is the that the mjpeg content-length returned by the rpi server is WRONG (too short).
Why does this happen on this driver? see below:

The "RPi Cam Web Interface" requests HTTP 1.0 so mjpeg content-length is correct.
The "RPi Cam Web v6" requests HTTP 1.1 but ***without*** content chunking.
The reason it works in browsers is because they accept content chunking.

So, I believe the mjpeg content-length is wrong when chunking is not accepted (because rpi server code assumes chunking somewhere)..."
Can you give me more details on the "RPi Cam Web v6" part that you are using with the alternate login?

quavoce
Posts: 109
Joined: Fri Nov 27, 2015 9:11 am

Re: RPi Cam Web Interface

Wed Nov 30, 2016 6:52 pm

btidey wrote:
quavoce wrote:
Hi Robert,

The IP Cam Pro developer replied with the following along with a bug report that I'm hoping you can look into please?


"ok, wait for the next update.

after the next update, the "RPi Cam Web Interface" camera type will auto-detect if form login is required so no new camera type is required.

---
now, I have a bug to report to you. it exists in the older versions and your 6.2.19 demo version as well.

If you use the "RPi Cam Web v6" camera type instead, the detail view's video will break up and connection is lost.
The detail view uses "/cam_pic_new.php" for mjpeg.
The reason is the that the mjpeg content-length returned by the rpi server is WRONG (too short).
Why does this happen on this driver? see below:

The "RPi Cam Web Interface" requests HTTP 1.0 so mjpeg content-length is correct.
The "RPi Cam Web v6" requests HTTP 1.1 but ***without*** content chunking.
The reason it works in browsers is because they accept content chunking.

So, I believe the mjpeg content-length is wrong when chunking is not accepted (because rpi server code assumes chunking somewhere)..."
Can you give me more details on the "RPi Cam Web v6" part that you are using with the alternate login?
I believe there are two issues here, one is as quoted above which just concerns the existing setup and build, and has nothing to do with the alternate login method. From my understanding of the developers reply, it seems that there may be an issue with the way cam_pic_new.php sends the mjpeg feed when the client uses HTTP 1.1? I'm no web developer so I don't understand why it's doing this (never heard of content-chunking till now!), and if this doesn't mean much to you either we can just ask the developer to remove "RPi Cam Web v6" and not use the mjpeg stream.

The other issue is that the alternate login method appears to be insecure. Normal web browsers detect the login redirect with no issues, but it seems the IP Cam Pro app can still fetch video without logging in. I'll see if I can find out more about this and whether it can be replicated outside of the app.

btidey
Posts: 1635
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Wed Nov 30, 2016 9:20 pm

quavoce wrote:
I believe there are two issues here, one is as quoted above which just concerns the existing setup and build, and has nothing to do with the alternate login method. From my understanding of the developers reply, it seems that there may be an issue with the way cam_pic_new.php sends the mjpeg feed when the client uses HTTP 1.1? I'm no web developer so I don't understand why it's doing this (never heard of content-chunking till now!), and if this doesn't mean much to you either we can just ask the developer to remove "RPi Cam Web v6" and not use the mjpeg stream.

The other issue is that the alternate login method appears to be insecure. Normal web browsers detect the login redirect with no issues, but it seems the IP Cam Pro app can still fetch video without logging in. I'll see if I can find out more about this and whether it can be replicated outside of the app.
OK. I understand a bit more about the first issue now. Normally an app / browser using 1.1 is supposed to support chunking. Putting a length in for a continuous stream is not possible. I think one solution is to force Apache at the camera server end to use a 1.0 response even if the request is 1.1. I think this can be achieved by a mod to the apache conf file.

See 2nd answer in http://serverfault.com/questions/155558 ... -responses

Muskoka
Posts: 4
Joined: Sat Apr 13, 2013 1:36 am

Re: RPi Cam Web Interface

Thu Dec 01, 2016 1:07 am

Not having any luck getting the mjpeg stream to work in any other viewers. Works fine in Chrome and Firefox, but does not work with Blue Iris which can accept a generic mjpeg stream, vlc, or ispy.

I'm using the suggested stream "http://<IP>/cam_pic_new.php?" with the ip address of the pi of course. What "exactly" needs to be entered as the url for the stream? I'm obviously doing something wrong. I have a bunch of Foscam and Dahua cameras up and running in Blue Iris, and would like to add a pi noir, and a few others.

Thanks for any help.

quavoce
Posts: 109
Joined: Fri Nov 27, 2015 9:11 am

Re: RPi Cam Web Interface

Thu Dec 01, 2016 9:47 am

btidey wrote:
quavoce wrote:
I believe there are two issues here, one is as quoted above which just concerns the existing setup and build, and has nothing to do with the alternate login method. From my understanding of the developers reply, it seems that there may be an issue with the way cam_pic_new.php sends the mjpeg feed when the client uses HTTP 1.1? I'm no web developer so I don't understand why it's doing this (never heard of content-chunking till now!), and if this doesn't mean much to you either we can just ask the developer to remove "RPi Cam Web v6" and not use the mjpeg stream.

The other issue is that the alternate login method appears to be insecure. Normal web browsers detect the login redirect with no issues, but it seems the IP Cam Pro app can still fetch video without logging in. I'll see if I can find out more about this and whether it can be replicated outside of the app.
OK. I understand a bit more about the first issue now. Normally an app / browser using 1.1 is supposed to support chunking. Putting a length in for a continuous stream is not possible. I think one solution is to force Apache at the camera server end to use a 1.0 response even if the request is 1.1. I think this can be achieved by a mod to the apache conf file.

See 2nd answer in http://serverfault.com/questions/155558 ... -responses
Nice, thanks! I'll have a play with those settings later today.

Regarding the alternate login method security bug where video could still be accessed, I've managed to fix this by reducing one redirect and including the feed in an if-then-else statement.

For example, the original method required us to just include <?php require "login/loginheader.php"; ?> at the top of the page, as shown below, but this left the rest of the code exposed.

Code: Select all

<?php require "login/loginheader.php"; ?>
<?php
 header("Content-Type: image/jpeg");
  if (isset($_GET["pDelay"]))
  {
     $preview_delay = $_GET["pDelay"];
  } else {
     $preview_delay = 10000;
  }
  usleep($preview_delay);
  readfile("/dev/shm/mjpeg/cam.jpg");
?>
I've solved this by using code from login/loginheader.php and wrapping it in an if-then-else statement, as shown below:

Code: Select all

<?php
  session_start();
  if (!isset($_SESSION['username'])) {
    header("location:login/main_login.php");
  } else {
    header("Content-Type: image/jpeg");
    if (isset($_GET["pDelay"]))
    {
      $preview_delay = $_GET["pDelay"];
    } else {
      $preview_delay = 10000;
    }
    usleep($preview_delay);
    readfile("/dev/shm/mjpeg/cam.jpg");
 }
?>
The developer has confirmed that the video feed is no longer accessible via cam_pic.php.

I'll do something similar for the other files and will update my original instructions. However one thing worth nothing is that the PHP-Login developer is working on a massive update to the code, so it may be worth waiting till this has finished before fully integrating it into RPi Web Cam. For example, one useful feature will be a "remember me" option which is missing at the moment.

btidey
Posts: 1635
Joined: Sun Feb 17, 2013 6:51 pm

Re: RPi Cam Web Interface

Thu Dec 01, 2016 11:07 am

Muskoka wrote:Not having any luck getting the mjpeg stream to work in any other viewers. Works fine in Chrome and Firefox, but does not work with Blue Iris which can accept a generic mjpeg stream, vlc, or ispy.

I'm using the suggested stream "http://<IP>/cam_pic_new.php?" with the ip address of the pi of course. What "exactly" needs to be entered as the url for the stream? I'm obviously doing something wrong. I have a bunch of Foscam and Dahua cameras up and running in Blue Iris, and would like to add a pi noir, and a few others.

Thanks for any help.
The normal client when set to mjpeg stream mode issues the url

http://IP/cam_pic_new.php?time=14805901 ... elay=40000

where the first parameter is current time in unix time and the second is a preview delay in microseconds which sets the frame rate of the stream (in this case it is 40 mSec or 25fps)

Muskoka
Posts: 4
Joined: Sat Apr 13, 2013 1:36 am

Re: RPi Cam Web Interface

Thu Dec 01, 2016 12:13 pm

btidey wrote:
Muskoka wrote:Not having any luck getting the mjpeg stream to work in any other viewers. Works fine in Chrome and Firefox, but does not work with Blue Iris which can accept a generic mjpeg stream, vlc, or ispy.

I'm using the suggested stream "http://<IP>/cam_pic_new.php?" with the ip address of the pi of course. What "exactly" needs to be entered as the url for the stream? I'm obviously doing something wrong. I have a bunch of Foscam and Dahua cameras up and running in Blue Iris, and would like to add a pi noir, and a few others.

Thanks for any help.
The normal client when set to mjpeg stream mode issues the url

http://IP/cam_pic_new.php?time=14805901 ... elay=40000

where the first parameter is current time in unix time and the second is a preview delay in microseconds which sets the frame rate of the stream (in this case it is 40 mSec or 25fps)
Still not able to see the stream in vlc. If I copy the url you posted, and insert my ip address, all it says is "Your input can't be opened". Still works fine through all browsers.

Muskoka
Posts: 4
Joined: Sat Apr 13, 2013 1:36 am

Re: RPi Cam Web Interface

Fri Dec 02, 2016 1:24 pm

Ok, got it to work in both vlc and Blue Iris. Was pretty simple actually, just took me a while to sort it out, still learning. The stream that worked was http://"your ip address"/html/cam_pic_new.php

MyNameWolfgangS
Posts: 12
Joined: Wed Oct 01, 2014 4:15 pm

Re: RPi Cam Web Interface

Mon Dec 05, 2016 11:50 am

Hi everybody,

I am looking for the PID of raspimjpeg. Is there any chance to get this as a PID file? Background is that I would like to use the hardware watchdog to make sure, raspimjpeg is up and running.
I am not using motion.

Thanks Wolfgang

bikeadventure
Posts: 3
Joined: Tue Dec 06, 2016 1:09 am

Re: RPi Cam Web Interface

Tue Dec 06, 2016 1:12 am

Hi,

great package, worked right away on my Pi3.

Any chance to add audio to the video?

Regards

Peter

User avatar
DougieLawson
Posts: 37507
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: RPi Cam Web Interface

Tue Dec 06, 2016 6:59 am

Run it with a systemd service file and you can get systemd to make sure it gets restarted if it crashes.

Create a file sudo nano /etc/systemd/system/myservice.service

Code: Select all

[Unit]
Description=raspmjpeg server

[Service]
ExecStart=/home/pi/mypythonprogram.py
User=pi
Restart=always
RestartSec=15min
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=raspmjpeg

[Install]
WantedBy=multi-user.target
Enable that with sudo systemctl enable myservice
Start it with sudo systemctl start myservice

No hardware changes, no hardware watchdog needed.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Gary Littlemore
Posts: 327
Joined: Thu Oct 11, 2012 11:52 am
Location: Cheshire, UK

Re: RPi Cam Web Interface

Tue Dec 06, 2016 4:14 pm

Audio from where? none of my setups have any microphones.
bikeadventure wrote:Hi,

great package, worked right away on my Pi3.

Any chance to add audio to the video?

Regards

Peter
3b+, 2b, b+, b, Zero & Zero-W

Return to “Camera board”