User avatar
James Pannell
Posts: 11
Joined: Sun Oct 01, 2017 11:10 am

Re: RPi Cam Web Interface

Tue Dec 26, 2017 4:09 pm

Hello, I have the interface running and it is excellent, and currently I have a username and password authentication for security. I am currently wondering if there are any additional security measures that could be employed? One thought was to access the browser by ssh. Does anybody have any suggestions? Thank you.

Berto
Posts: 1
Joined: Fri Dec 29, 2017 12:37 am

Re: RPi Cam Web Interface

Fri Dec 29, 2017 12:42 am

Hi,
Have searched for previous posts regarding the pgm mask file, but it hasn't helped.
I'm hoping someone will be able to test my mask file (attached) as I don't seem to be able to get it to work and confirm if I created it correctly?
I'm using 1296x972 video resolution.

Thanks very much in advance.

Berto
camx3.pgm.zip
(671 Bytes) Downloaded 42 times

sonnaps
Posts: 4
Joined: Wed Jan 18, 2017 6:56 pm

Re: RPi Cam Web Interface

Wed Jan 03, 2018 5:11 pm

Hi All,

No matter what I do I can't seem to password protect the webpage. The raspicam.conf file already had the following so I didn't need to edit this I don't think:

AllowOveride All
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all

Also, if I try to set a rotation of 180 degrees in the web interface nothing seems to happen.

L_i_v_e
Posts: 32
Joined: Sun Nov 29, 2015 3:51 pm

Re: RPi Cam Web Interface

Wed Jan 03, 2018 8:52 pm

Ok, the echo to take a picture works, but mie how do i rename It?
I have a doorphone too ;) wanted to implement VoIP video call but i had no luck, always crashy.
Anyway, right now when the button is pressed It does a lot of stuffs, one of those is to take a picture (right now i take the low res preview from the camera stream) and send It via telegram to my home group.
Since i want It to be full res i'd love to be able to save It always with the same name, so i can easily send It via telegram.
How to make this end_img macro work?
Thanks and sorry for this months late answer
btidey wrote:
Wed Sep 20, 2017 10:00 pm
L_i_v_e wrote:
Wed Sep 20, 2017 9:37 am
Hi guys, i need help to configure the camera.
I have a python script that runs 24/7 and i want RPi Cam Web Interface to save a picture when a button (GPIO connected) is pressed. Every time the button is pressed the picture has to be saved with the same name, deleting the old one. After the picture is taken i will send it to a server via the python script.
So, how can i order RPi Cam Web Interface to save a picture always with the same name, in a script?
It can be shell, python or whatever, i'll integrate it later in my code.
Thanks
There are a few options here but it also depends on what type of image you want.

The software is continuously generating the image that is used for the preview. The resolution of this is set by the 'width' camera setting. It defaults to 512 pixels but can be increased. If this resolution image is Ok for your purposes then you can just grab the latest copy from /dev/shm/mjpeg/cam.jpg

If you want a full resolution image as defined by the camera settings then you can grab this by sending the 'im' command to command pipe in the web folder. This takes a picture and creates the image jpg file and a thumbnail image in the media folder.

Sending the command from a shell file is a simple as echo 'im' > /var/www/html/FIFO (adjust folder if different). For python you just need to open the pipe like a file, print the 'im' command and close the file.

The captured image file will normally be given a unique name so for your purpose you need to rename it and copy / move it to where you want it. This could be done by either waiting in the same program that did the im command for say 1 second, or you could just use the end_img macro to do it separately. The macro will be fed the image file name as captured so the macro isjust a shell mv to the folder/name you want.

Also if you are not using the web interface for anything you could change the image_path definition in the config file in /etc/raspimjpeg

Normally this is something like
image_path /var/www/html/media/im_%i_%Y%M%D_%h%m%s.jpg

where the %variables are what define the unique captured image name. So if that was made
image_path /var/www/media/myimage.jpg
all captured images would have the same name

As an aside I do something similar to support a doorbell notification operation. When my doorbell is pushed I get a IFTTT phone notification plus web access command is made to the RPi camera software camera by the door to grab the latest image. It keeps the last 4 images on the same webserver and a html page shows these images which I can view on my phone. If that is of any interest I can point to further details,

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

Re: RPi Cam Web Interface

Mon Jan 08, 2018 9:14 am

L_i_v_e wrote:
Wed Jan 03, 2018 8:52 pm
Ok, the echo to take a picture works, but mie how do i rename It?
I have a doorphone too ;) wanted to implement VoIP video call but i had no luck, always crashy.
Anyway, right now when the button is pressed It does a lot of stuffs, one of those is to take a picture (right now i take the low res preview from the camera stream) and send It via telegram to my home group.
Since i want It to be full res i'd love to be able to save It always with the same name, so i can easily send It via telegram.
How to make this end_img macro work?
Thanks and sorry for this months late answer
In macro folder I created a new macro file end_img.sh
1. move to macro folder e.g. cd /var/www/html/macros
2. sudo nano end_img.sh
3. enter code

Code: Select all

#!/bin/bash
cp $1 /var/www/html/media/fixed.jpg
where you change the path and name to be what you want it to be
4. Save and exit nano
5. Change ownership of end_img.sh to www-data

Code: Select all

sudo chown www-data:www-data end_img.sh
6. Change permissions of end_img.sh to allow execution.

Code: Select all

sudo chmod 744 end_img.sh

vin100
Posts: 11
Joined: Tue Jan 24, 2017 10:58 pm

Re: RPi Cam Web Interface

Mon Jan 08, 2018 5:09 pm

Hello,

how to compile the photos of a time lapse?
When I do start convert I have no success, I have the thumbnail in "busy"
I have my photos (1558 photos), and a file in .zip
I use jessie lite.

Thanks

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

Re: RPi Cam Web Interface

Mon Jan 08, 2018 6:09 pm

vin100 wrote:
Mon Jan 08, 2018 5:09 pm
Hello,

how to compile the photos of a time lapse?
When I do start convert I have no success, I have the thumbnail in "busy"
I have my photos (1558 photos), and a file in .zip
I use jessie lite.

Thanks
Jessie Lite does not have by default the full gstreamer package installed which is used to compile the time lapse into a video. It is possible to add this in, but my preferred solution is to start with full Jessie and remove most of the unwanted software. This reduces the memory footprint down to nearer Jessie Lite but does have all of the gstreamer package ready to go.

This is described in the wiki.

For your current zip it might be easier just to do the time lapse conversion on a PC. There is several easy free solutions for this.

Note that currently there is a problem with the use of gstreamer to do the conversion under the stretch OS which seems to be a generic problem. I have been checking into this but haven't found a resolution yet.

bdd_vn_96
Posts: 2
Joined: Tue Jan 09, 2018 7:43 am

Re: RPi Cam Web Interface

Tue Jan 09, 2018 1:44 pm

I'm trying to add another funtion for this web interface. For ex. I want to design 4 buttons to control my brushless motors. So what i should do now?

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

Re: RPi Cam Web Interface

Tue Jan 09, 2018 5:00 pm

bdd_vn_96 wrote:
Tue Jan 09, 2018 1:44 pm
I'm trying to add another funtion for this web interface. For ex. I want to design 4 buttons to control my brushless motors. So what i should do now?
The simple way is to use the built in facility for up to 6 user buttons. The wiki Additions and Tricks section 4.16 describes how to do this. Pressing a button then fires a macro script you have to add to perform whatever action you want.

The more complex way is to build in some specific buttons into the index.php web interface file, and add on any required javascript and server side support. If you look at the stuff in there for the servo or pipan controls that would be a good starting point.

joaquinx
Posts: 1
Joined: Tue Jan 09, 2018 7:45 pm

Re: RPi Cam Web Interface

Tue Jan 09, 2018 7:56 pm

Hellcube wrote:
Thu Jul 09, 2015 1:09 pm
I realy love this project so i wish to help out a little as i can. I made a new interface. All CSS (no images used) so it will be easier to make any color scheme as You like. It's only HTML not properly coded into php files.

http://zzpgnigcentrala.pl/camera/

I wish to know if you are interested?

Hi there! I'm interested to know if work on graphical interface proposed by Hellcube has advanced.
We are using RPi Cam for an solar sculptures/ balloon project > www.aerocene.org
It would be fantastic if we could collaboratively work in making the web interface mode streamlined and end-user friendly.
Thanks!
Joaquin

User avatar
James Pannell
Posts: 11
Joined: Sun Oct 01, 2017 11:10 am

Re: RPi Cam Web Interface

Tue Jan 09, 2018 11:10 pm

I have the interface up and running it's excellent, the only problem is that clicking the motion detection start button and then triggering the PIR sensor does start the video recording. However, this does not switch off and simply continues to record video indefinitely. Does anybody know how to fix this issue? I thought it would perhaps turn off once there is no more motion detected.

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

Re: RPi Cam Web Interface

Wed Jan 10, 2018 9:12 am

James Pannell wrote:
Tue Jan 09, 2018 11:10 pm
I have the interface up and running it's excellent, the only problem is that clicking the motion detection start button and then triggering the PIR sensor does start the video recording. However, this does not switch off and simply continues to record video indefinitely. Does anybody know how to fix this issue? I thought it would perhaps turn off once there is no more motion detected.
Do you mean PIR sensor? Do you have this as an extra sensor that you wish to control video recording?

As standard the software supports motion detection by analysing the video data either by using the external 'motion' program or by using the internal detection algorithms which use change data produced by the camera system. I refer to use the internal method as it works well and uses less resources. You choose between the two methods under camera settings.

Some people have also chosen to do motion detection separately with a PIR sensor which involves leaving the software motion detection off and sending video start and video stop commands to the software when the PIR fires.

Assuming you are using the built in motion detection I would first start by reading the trouble shooting section of the wiki which gives various things to check.

If detection is starting a recording but not stopping it, then it is most likely that either the detection set up is not seeing the video as getting sufficiently stationary to generate a stop (adjust motion settings) or a stop is being detected but not being acted upon because the scheduler set is not configured to send a video stop when this happens.

User avatar
James Pannell
Posts: 11
Joined: Sun Oct 01, 2017 11:10 am

Re: RPi Cam Web Interface

Wed Jan 10, 2018 1:31 pm

Hello, yes I did mean the PIR sensor...thank you for your clarification I did not think that motion detection could be achieved without this piece of hardware. Okay now I will need to find a way to send the video start and stop commands when the PIR fires, if anybody has any pointers it would be appreciated. I have already configured the PIR sensor to send an email when motion is detected but am unsure about how to get it to interact with the RPI cam web interface. Thanks.

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

Re: RPi Cam Web Interface

Wed Jan 10, 2018 3:16 pm

James Pannell wrote:
Wed Jan 10, 2018 1:31 pm
Hello, yes I did mean the PIR sensor...thank you for your clarification I did not think that motion detection could be achieved without this piece of hardware. Okay now I will need to find a way to send the video start and stop commands when the PIR fires, if anybody has any pointers it would be appreciated. I have already configured the PIR sensor to send an email when motion is detected but am unsure about how to get it to interact with the RPI cam web interface. Thanks.
So with the PIR you need to leave the motion detection inactive.

Commands are sent to the system by writing to the command FIFO which is in the install web location e.g. /var/www/html/FIFO

Commands consist of a two letter command followed by parameters where required. The wiki details all the commands and there is a reference guide on the scheduler page. For example ca 1 starts a video recording and ca 0 stops it.

You can experiment with commands from the command line

e.g.

Code: Select all

echo 'ca 1' >/var/www/html/FIFO
to start a capture and

Code: Select all

echo 'ca 0' >/var/www/html/FIFO
to stop it

This can also be simply done from with a program like python.

User avatar
James Pannell
Posts: 11
Joined: Sun Oct 01, 2017 11:10 am

Re: RPi Cam Web Interface

Wed Jan 10, 2018 3:29 pm

Thank you for your help I will try this out now. :D

CharlyDelta
Posts: 97
Joined: Thu Jul 18, 2013 4:04 am
Location: Montreal

Re: RPi Cam Web Interface

Thu Jan 11, 2018 11:50 am

Hello..

Has someone already run a RPI3 and RPI Cam web without an internet connection and without the help of an external access point?

An idea how I could configure this ?

Thanks for your help.

CD

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

Re: RPi Cam Web Interface

Thu Jan 11, 2018 10:22 pm

CharlyDelta wrote:
Thu Jan 11, 2018 11:50 am
Hello..

Has someone already run a RPI3 and RPI Cam web without an internet connection and without the help of an external access point?

An idea how I could configure this ?

Thanks for your help.

CD
You certainly don't need an 'internet' connection for RPiCam, but you need to clarify what you are trying to do.

1. The RpiCam background software runs independently of the web server and can be used just as a process to obey commands like capture video just by sending them into its command FIFO without worrying about web control or display.

2. The RPiCam could be run on a single raspberry with the web browser on the same machine giving a local display. The lo loopback connection needs to be active so that the browser can coonect to the same machine (e.g. 127.0.0.1)

3.The raspberry could be set up as a local wifi access point as well as running RPiCam so that external devices (phones, tablets, other computers) could aconnect to that access point and browse to RPiCam. There are various guides / posts on how to set up the access point.

4. The normal case is where the raspberry itself connects to a router and thus becomes available to be accessed by other devices. As I said it is not necessary that this has internet connectivity.

CharlyDelta
Posts: 97
Joined: Thu Jul 18, 2013 4:04 am
Location: Montreal

Re: RPi Cam Web Interface

Fri Jan 12, 2018 3:18 am

btidey wrote:
Thu Jan 11, 2018 10:22 pm
CharlyDelta wrote:
Thu Jan 11, 2018 11:50 am
Hello..

Has someone already run a RPI3 and RPI Cam web without an internet connection and without the help of an external access point?


3.The raspberry could be set up as a local wifi access point as well as running RPiCam so that external devices (phones, tablets, other computers) could aconnect to that access point and browse to RPiCam. There are various guides / posts on how to set up the access point.

Thank you, btidey, that's exactly what I wanted to know !

ohiojoe
Posts: 13
Joined: Wed Aug 20, 2014 6:48 am
Location: Benicia, CA

Re: RPi Cam Web Interface

Mon Jan 15, 2018 2:09 pm

I have a bit of python code that will delete files in the /var/www/media directory. But this only works from the command line if I use sudo and supply the sys.argv[1] sys.argv[2]
sudo python remove_video.py vi_0073_20180114_203220.mp4 vi_0073_20180114_203220.mp4.v0073.th.jpg

Code: Select all

#writes file names to mine.txt
file = sys.argv[1]  #sys.argv[2] = thumbnails
file2 = sys.argv[2]
f = open( '/home/pi/mine.txt', 'a')
f.write(file + "\n")
f.write(file2 + "\n")
f.close()

# to delete files from /var/www/media
os.chdir('/var/www/media')
os.remove(file)
os.remove(file2)
permissions: -rwxr-xr-x 1 www-data www-data 894 Jan 14 16:34 remove_video.py

remove_video.py is called from the macro end_box.sh The first part of the code "#writes file names to mine.txt" works as expected from end_box.sh. But the "# to delete files from /var/www/media" section does not work.

permissions: -rwxr-xr-x 1 www-data www-data 522 Jan 15 21:57 end_box.sh
end_box.sh:

Code: Select all

#!/bin/bash
list=( $1*.th.jpg )
thumb="${list[-1]}"
python /home/pi/./email_video.py $1
python /home/pi/./remove_video.py $1, $thumb
date >/var/www/uploadtest.txt  # to test if working 
ls -l /var/www/
drwxr-xr-x 2 www-data www-data 4096 Jan 15 21:58 macros
drwxr-xr-x 2 www-data www-data 81920 Jan 15 22:02 media

ls -l /var/www/media/
-rw-rw-r-- 1 www-data www-data 14640 Jan 14 13:49 vi_0034_20180114_134929.mp4.v0034.th.jpg
-rw-rw-r-- 1 www-data www-data 240674 Jan 14 13:49 vi_0035_20180114_134936.mp4

I know there is this option:
PurgeSpace_ModeEx Select Mode PurgeSpace_Level

But I wanted to see if I could get this bit of code to work.

Thanks

Oliver2526
Posts: 12
Joined: Mon Jan 15, 2018 10:40 pm

Re: RPi Cam Web Interface

Mon Jan 15, 2018 11:12 pm

Hello,

I have a camera where you can switch an infrared filter on or off by changing a GPIO pin status (the GPIO pin is connected to the camera). Now, I have written a python script that determines the local sunrise and sunset time in order to check whether it is dark outside or not and then switches the GPIO status if necessary. The python script is called from the shell command ''test.sh" containing:

Code: Select all

#!/bin/bash
sudo python /home/pi/irFilterSwitch.py
The file is located in "var/www/html/macros". I have changed the ownership to www-data and gave read-write-execute permission for both the python and the shell script to all users. If a run the script "test.sh" from the ssh line, the filter switches as expected.

Now, I want this script to be executed every 10 minutes. So, I set in the scheduler of the the RPi_Cam_Web_Interface:
Management_Interval: 600
Management_Command: test.sh

But nothing happens! :cry:

Here is the log:
[
2018/01/15 23:38:10] Scheduled management tasks. Next at 1516055950
[2018/01/15 23:38:10] exec_macro: test.sh
[2018/01/15 23:38:10] Send sy test.sh
{2018/01/15 23:38:10} Executing macro /var/www/html/macros/test.sh &
So, the macro seems to be executed correctly.

My hypotheses was that there is a problem with permissions, so I checked the groups of user Pi and added user www-data to the same groups including the gpio group (by the way, is this a security risk??). But still no success.

Can anyone please help me?

Best regards,
Oliver

ohiojoe
Posts: 13
Joined: Wed Aug 20, 2014 6:48 am
Location: Benicia, CA

Re: RPi Cam Web Interface

Tue Jan 16, 2018 12:33 am

James Pannell wrote:
Wed Jan 10, 2018 3:29 pm
Thank you for your help I will try this out now. :D
This is the python program I use:

Code: Select all

#!/usr/bin/env python
#https://raspberrypi.stackexchange.com/questions/46457/recording-a-video-with-picamera/46462
import subprocess
from gpiozero import MotionSensor
from signal import pause


#Physical pin 7 = MotionSensor(4)
pir = MotionSensor(4)

def record_video():
	subprocess.call ("echo 'ca 1' > /var/www/FIFO", shell=True)
def finish_video():
	subprocess.call ("echo 'ca 0' > /var/www/FIFO", shell=True)

#pir.when_motion = record_video
def pir.wait_for_motion():
	pir.when_motion = record_video
#pir.when_no_motion = finish_video
#pir.when_no_motion = finish_video
def pir.wait_for_no_motion():
	pir.when_no_motion = finish_video
pause()

User avatar
Halvhjearne
Posts: 2
Joined: Thu Jan 18, 2018 12:53 pm

Re: RPi Cam Web Interface

Thu Jan 18, 2018 1:03 pm

for some reason when i use "Pre-Event Motion Capture Buffer", the buffer is about 10xtimes as large as it is supposed to be.
example: i set the buffer to 3000 (supposedly 3sec?) and start a recording and would expect recording lenght + ~3sec, but for some reason it adds atlest ~30sec istead of the intended 3.
can anyone tell me if this is a bug or if i am doing something wrong? ... maybe i need to set something else for this to work?
everything else seems to work just fine and if i set the buffer to 0, the video is the lenght it is supposed to be.

ruder
Posts: 8
Joined: Sat Nov 18, 2017 3:48 pm
Location: Rajkot,Gujarat,India.
Contact: Facebook Twitter

Re: RPi Cam Web Interface

Sat Jan 20, 2018 3:17 pm

Hii all,

can we use GoPro 3/4 camera with Auvidea B101 (HDMI to CSI-2 Bridge -15 pin FPC) to get the high resolution? Has anyone tried GoPro?

nospam
Posts: 45
Joined: Sun Jun 14, 2015 10:38 pm

Re: RPi Cam Web Interface

Sat Jan 20, 2018 10:17 pm

Is it possible to have multiple text overlays on the video?

I'm currently using %a to display the inside temperature and I want to add more thermocouples. Ideally I would like to display multiple temperature readings on a different part of the screen i.e. I want to display the time at top center and inside + outside temperatures at bottom right.

Oliver2526
Posts: 12
Joined: Mon Jan 15, 2018 10:40 pm

Re: RPi Cam Web Interface

Sun Jan 21, 2018 10:52 pm

Halvhjearne wrote:
Thu Jan 18, 2018 1:03 pm
can anyone tell me if this is a bug or if i am doing something wrong?
I use internal motion detection have set the camera buffer in the camera settings to 3000. As described the added amout of time is ~3 sec. So it seems to work....

P.S.: i wonder if it makes sense that everybody posts his questions into the same thread. It is a total mess...

Return to “Camera board”

Who is online

Users browsing this forum: No registered users and 10 guests