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

Re: Best (and easiest) way to start\stop recording with external means.

Sat Oct 28, 2017 9:02 am

budman1758 wrote:
Fri Oct 27, 2017 5:51 pm
First off... Great software here!! Kudos to the folks who make it possible!! I searched a while and my answer is probably somewhere in these 4000+ posts but it still eludes me.

I am looking for the easiest way to trigger recording with either a command sent via http from another computer or using a gpio on the camera unit itself. I am wanting to record at night using infrared floodlights. I'm using the noir camera boards in a dummy camera housing and making my own surveillance system . I need to be able to start and stop the recording externally so the camera will see what caused the pir sensor to trigger (using the circular buffer). I have external pir sensors that control ir floodlights. I just need a simple solution for this.

My programming skills are pretty much zero so hopefully there is a not too difficult way to make this work. Thanks for any help.
The key to using this software from other systems is the command PIPE that the web software uses to send commands to the underlying raspimjpeg process.

The PIPE looks just like a file to be written to and is called FIFO in the folder where the web software is installed (e.g. /var/www/html/FIFO).

The commands are documented in the wiki and there is a summary in the scheduler settings web page.

For your purposes you will want the ca command (capture video). One can either start video with ca 1 and stop it with ca 0 or one can do a timed recording of a number of seconds by using an extra parameter. E.g. ca 1 30 would do a 30 second recording.

These commands can be sent from any other process. To try it out you can send them easily from a command line. Open up a terminal window and

Code: Select all

echo 'ca 1 30' >/var/www/html/FIFO
which should result in a 30 second video recording.

If you want to trigger this from a GPIO then you will need a little program or script that senses the change in GPIO and then sends this command in. This can either be in a bash command line script or a little python program.

I am not quite sure what you want when you say http from another machine. If you mean from say a web page with a capture button on it then the simplest way would be to just use the same type of scheme as used on the current web page. If you mean you want to make a http request then doing something like

Code: Select all

http://ipaddress/html/cmd_pipe.php?cmd=ca%201%2030
should work. Where html needs to be the subfolder where the software is installed or missed out if you installed directly in /var/www

budman1758
Posts: 9
Joined: Mon Dec 19, 2016 8:44 pm

Re: RPi Cam Web Interface

Sun Oct 29, 2017 5:58 pm

Code: Select all

http://ipaddress/html/cmd_pipe.php?cmd=ca%201%2030
should work. Where html needs to be the subfolder where the software is installed or missed out if you installed directly in /var/www
That works for my purpose. Thanks. :D

nolivas
Posts: 1
Joined: Wed Nov 01, 2017 5:32 pm

Re: RPi Cam Web Interface

Wed Nov 01, 2017 5:36 pm

Hello,
How does one fix the memory leak on this otherwise awesome work?
Thank you.

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

Re: RPi Cam Web Interface

Wed Nov 01, 2017 9:51 pm

Hi All,

At the request of some colleagues new to RPI Cam and the Pi in general, I created a newbie guide to using this excellent software. Please review and let me know if any changes or updates need to be made. Thanks!

How to Make a £59 Fully Featured Raspberry Pi Home Security Camera – Newbie Guide
https://quavoce.wordpress.com/2017/10/2 ... bie-guide/

jokkemoose
Posts: 5
Joined: Mon Jan 30, 2017 8:37 pm

Re: RPi Cam Web Interface

Sun Nov 05, 2017 12:27 pm

Hi All,

Installed the software on the PI Zero W, but it seems the preview of images isn't working. Even though I select 'images and video', I only see the videos.
Folder shows :

picamera@raspberrypi:~ $ ls -ltra /var/www/html/media/*1322*.*
-rw-r--r-- 1 www-data www-data 25803 Nov 5 13:22 /var/www/html/media/vi_0010_20171105_132201.mp4.v0010.th.jpg
-rw-r--r-- 1 www-data www-data 26954 Nov 5 13:22 /var/www/html/media/02-20171105132200-00.jpg
-rw-r--r-- 1 www-data www-data 27023 Nov 5 13:22 /var/www/html/media/02-20171105132200-01.jpg
-rw-r--r-- 1 www-data www-data 27003 Nov 5 13:22 /var/www/html/media/02-20171105132201-00.jpg
-rw-r--r-- 1 www-data www-data 26920 Nov 5 13:22 /var/www/html/media/02-20171105132201-01.jpg
-rw-r--r-- 1 www-data www-data 27026 Nov 5 13:22 /var/www/html/media/02-20171105132202-00.jpg
-rw-r--r-- 1 www-data www-data 26896 Nov 5 13:22 /var/www/html/media/02-20171105132202-01.jpg
-rw-r--r-- 1 www-data www-data 27223 Nov 5 13:22 /var/www/html/media/02-20171105132203-00.jpg
-rw-r--r-- 1 www-data www-data 27206 Nov 5 13:22 /var/www/html/media/02-20171105132203-01.jpg
-rw-r--r-- 1 www-data www-data 26719 Nov 5 13:22 /var/www/html/media/02-20171105132204-00.jpg
-rw-r--r-- 1 www-data www-data 26701 Nov 5 13:22 /var/www/html/media/02-20171105132204-01.jpg
-rw-r--r-- 1 www-data www-data 26728 Nov 5 13:22 /var/www/html/media/02-20171105132205-00.jpg
-rw-r--r-- 1 www-data www-data 26753 Nov 5 13:22 /var/www/html/media/02-20171105132205-01.jpg
-rw-r--r-- 1 www-data www-data 26960 Nov 5 13:22 /var/www/html/media/02-20171105132206-00.jpg
-rw-r--r-- 1 www-data www-data 6667402 Nov 5 13:22 /var/www/html/media/vi_0010_20171105_132201.mp4

so as you can see, I do see jpg files.
Tried renaming jpg to JPG or even jpeg, but no luck.

Since I didn't change the original code, I guess other people should have noticed this as well?

Rgds,
J.

llucis
Posts: 1
Joined: Mon Jun 06, 2016 2:15 pm

pre-trigger buffer concatenation issue?

Mon Nov 06, 2017 3:26 am

Thanks a lot for this great work, I am running a slightly modded version of this system on a headless Pi Zero (using a usb to ethernet adapter) mounted within a dummy security camera housing outdoors, with a PIR motion sensor and a DHT22 sensor attached. I adjusted the php code to my needs - primarily to offload most of the web interface to another nginx+php server which also provides the (nfs-mounted) storage for the recordings. Boxing the h264 recordings to mp4 is also delegated to the linux server, through ssh. It all works great, I have this running smothly with both jessie and then upgraded to stretch with php 7. Not a single freeze or any bandwidth issue (running it with a v2 camera with HD video recordings at max view 972p, 25fps).

There is only one issue I'm having with the motion-triggered video recordings (which in my case are triggered either from the RPi Cam's internal motion vector analysis and/or the PIR sensor by sending the appropriate command through the raspimjpeg FIFO): I am using a pre-trigger video buffer of 5 seconds (value 5000) but unfortunately I see many video recordings where the h264 stream seems corrupted, as if there is a missing or misplaced I-frame; it seems to me (but I might be wrong) that the missing I-frame could be at the point where the circular buffer is being prepended to the actual recording, somehow -- is it possible? I haven't checked the source code (and cross-compilation seems iffy), but is it possible that this concatenation of the pre-roll buffer with the actual video recording is not properly checking for the consistency of I-frames? Here it is an example of the video corruption that I am experiencing: https://youtu.be/OfPwvQHtZcM
(the video is trimmed at the end there as it continued for a few more seconds, but the beginning is left intact). The relevant log around that timecode:

Code: Select all

[2017/11/05 15:28:25] Start capture requested from Pipe
[2017/11/05 15:28:25] Send ca 1
{2017/11/05 15:28:25} Capturing started
[2017/11/05 15:28:30] Start capture requested from Pipe
[2017/11/05 15:28:30] Send ca 1
{2017/11/05 15:28:30} Already capturing. Ignore
[2017/11/05 15:28:59] Stop capture requested
[2017/11/05 15:28:59] Send ca 0
{2017/11/05 15:29:00} DEBUG 3
{2017/11/05 15:29:02} Capturing stopped
As you can see the capture is triggered twice (once by the motion vector functionality, the second by the PIR sensor -- or the other way around, I am not sure about the order because in both cases the log message is the same ("Start capture requested from Pipe"), which is not very useful for debugging in this case.. and anyway it shouldn't matter, the "Already capturing. Ignore" message suggests that a 2nd start capture command is in fact ignored.. so it shouldn't interfere with the recording process, right?
It's strange that it does NOT happen for all the recordings, I have some videos that are perfectly OK (cars are passing by/parking and everything seems fine), but some of them do look like the video recording was messed up by the pre-trigger buffer..

If it weren't for this apparent bug in the circular buffer processing (?or it's something else?), this software would be perfect for my setup here.. Anyone experienced it before? I could try to increase the pre-trigger buffer to more than 5s, but besides this using probably more memory (which is valuable on a Pi Zero), it would also needlessly increase the video file size etc. -- and I don't really need more than 5s before the motion trigger..

jfree23
Posts: 5
Joined: Tue Dec 29, 2015 8:48 pm

Re: RPi Cam Web Interface

Mon Nov 06, 2017 3:40 pm

Hello all,

I've been running this on several RPIs for quite a while, mostly works well, great project! Running 6.4.05 now.

Things seem to work, but I often see messages like this in the logs, and have for a long time. Any suggestions about what they mean, problems indicated, or how to troubleshoot? Where should I look and what should I look for in the "iframe list"?

{2017/11/04 16:09:57} DEBUG 2: 31394, 31401
{2017/11/04 16:09:57} Error: Error in iframe list
{2017/11/04 16:09:57} DEBUG 2: 31395, 31401
{2017/11/04 16:09:57} Error: Error in iframe list
{2017/11/04 16:09:57} DEBUG 2: 31396, 31401
{2017/11/04 16:09:57} Error: Error in iframe list
{2017/11/04 16:09:57} DEBUG 2: 31397, 31402
{2017/11/04 16:09:57} Error: Error in iframe list
{2017/11/04 16:09:57} DEBUG 2: 31398, 31402
{2017/11/04 16:09:57} Error: Error in iframe list
{2017/11/04 16:09:58} DEBUG 2: 31399, 31402
{2017/11/04 16:09:58} Error: Error in iframe list
{2017/11/04 16:09:58} DEBUG 2: 31400, 31403
{2017/11/04 16:09:58} Error: Error in iframe list

(secondary question - update.sh never works for me, due to problems with commits for the install.sh, update.sh, other *.sh in the RPI directory. I am not a big git user and I don't know how to do the commits so that the update can work. One suggestion was to replace "git fetch origin master" with "git pull" but that did not work for me, so I ended up doing another full install. Am I missing a simple trick here to make update.sh work?)

Thanks!

Archer322
Posts: 8
Joined: Wed Jan 11, 2017 4:54 pm

Re: RPi Cam Web Interface

Mon Nov 06, 2017 4:33 pm

How might I go about having a time lapse occur only while motion is being detected? I'm looking to record myself working in my shop. So I want an image capture every 20 seconds but only while I'm in my shop and then continue for X amount of minutes after so as to not time out while I'm sitting or something. Thoughts?

antondubek
Posts: 2
Joined: Mon Sep 11, 2017 2:39 pm

Re: RPi Cam Web Interface

Tue Nov 07, 2017 5:31 pm

Wondering if anyone can help me. I have had this software running perfectly for a while now however after some updating it seems to have stopped functioning.

I am getting no video stream when in the web browser. The loading text pops up and then disappears leaving nothing. At times I am left with a tiny blue box with a question mark in it.

Running it on a raspberrypi3.

What I have tried:
Uninstalling and reinstalling numerous times.
Reboots.
Tried it autostarting
Tried manually starting
Different ports and folders to stream from
Different browsers
Different devices

What I have found is the below text in the log repeating itself on each occassion:

{2017/11/07 17:14:33} RaspiMJPEG Version 5.8.06
{2017/11/07 17:14:33} recommended video buffer size 65536
{2017/11/07 17:14:33} h264 size set to 131072
{2017/11/07 17:14:33} recommended video buffers 1
{2017/11/07 17:14:33} h264 buffers set to recommended 1
{2017/11/07 17:14:33} Opening FIFO 0 /var/www/FIFO 6
{2017/11/07 17:14:33} Opening FIFO 1 /var/www/FIFO11 7
{2017/11/07 17:14:33} MJPEG streaming, ready to receive commands
{2017/11/07 17:14:33} send smd 9
{2017/11/07 17:14:33} Starting command loop
[2017/11/07 17:14:33] Reload parameters command requested
[2017/11/07 17:14:33] Scheduler loop is started
[2017/11/07 17:14:34] New period detected 0
[2017/11/07 17:14:34] Scheduled management tasks. Next at 1510078474
{2017/11/07 17:14:42} Watchdog detected problem. Stopping{2017/11/07 17:14:42} SIGINT/SIGTERM received, stopping

I have tried to look into the watchdog and whats happening but can't find much information on it.

Checking the processes I can see two raspimjpeg running when the camera is running and only 1 after the watchdog restarts the camera. The LED on the camera starts and stops in timing with the watchdog reset if that matters at all.

Any help or insight would be greatly appreciated!

conoral11
Posts: 2
Joined: Thu Nov 09, 2017 1:33 pm

Re: RPi Cam Web Interface

Thu Nov 09, 2017 1:41 pm

I'm trying to get the multiview page working with two pi cameras, however I'm not having much luck.

Both Pis can see each other, and both can be viewed from the internet, and both cameras are working as expected.

The internal IP address for the PIs are 192.168.1.195 and 192.168.1.196.

My multiview.json file looks like:

Code: Select all

{"hosts":["http://192.168.1.195","http://192.168.1.196/"],"delays":[40000,40000]}
However I see nothing when I go to 192.168.1.195/multiview.html

I've added a <h1> tag to the file and can verify that the web page is being served up.

Both RPIcam systems have a username and password associated with them, could this be whats causing the images to not be displayed in multiview.htm?

Best Wishes

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

Re: pre-trigger buffer concatenation issue?

Fri Nov 10, 2017 8:54 am

llucis wrote:
Mon Nov 06, 2017 3:26 am

There is only one issue I'm having with the motion-triggered video recordings (which in my case are triggered either from the RPi Cam's internal motion vector analysis and/or the PIR sensor by sending the appropriate command through the raspimjpeg FIFO): I am using a pre-trigger video buffer of 5 seconds (value 5000) but unfortunately I see many video recordings where the h264 stream seems corrupted, as if there is a missing or misplaced I-frame; it seems to me (but I might be wrong) that the missing I-frame could be at the point where the circular buffer is being prepended to the actual recording, somehow -- is it possible? I haven't checked the source code (and cross-compilation seems iffy), but is it possible that this concatenation of the pre-roll buffer with the actual video recording is not properly checking for the consistency of I-frames? Here it is an example of the video corruption that I am experiencing: https://youtu.be/OfPwvQHtZcM
(the video is trimmed at the end there as it continued for a few more seconds, but the beginning is left intact). The relevant log around that timecode:

Code: Select all

[2017/11/05 15:28:25] Start capture requested from Pipe
[2017/11/05 15:28:25] Send ca 1
{2017/11/05 15:28:25} Capturing started
[2017/11/05 15:28:30] Start capture requested from Pipe
[2017/11/05 15:28:30] Send ca 1
{2017/11/05 15:28:30} Already capturing. Ignore
[2017/11/05 15:28:59] Stop capture requested
[2017/11/05 15:28:59] Send ca 0
{2017/11/05 15:29:00} DEBUG 3
{2017/11/05 15:29:02} Capturing stopped
As you can see the capture is triggered twice (once by the motion vector functionality, the second by the PIR sensor -- or the other way around, I am not sure about the order because in both cases the log message is the same ("Start capture requested from Pipe"), which is not very useful for debugging in this case.. and anyway it shouldn't matter, the "Already capturing. Ignore" message suggests that a 2nd start capture command is in fact ignored.. so it shouldn't interfere with the recording process, right?
It's strange that it does NOT happen for all the recordings, I have some videos that are perfectly OK (cars are passing by/parking and everything seems fine), but some of them do look like the video recording was messed up by the pre-trigger buffer..

If it weren't for this apparent bug in the circular buffer processing (?or it's something else?), this software would be perfect for my setup here.. Anyone experienced it before? I could try to increase the pre-trigger buffer to more than 5s, but besides this using probably more memory (which is valuable on a Pi Zero), it would also needlessly increase the video file size etc. -- and I don't really need more than 5s before the motion trigger..
I haven't seen any issues with circular recording prepend myself. The code does keep track of iframe pointers in the circular buffer and prepends accordingly. It is of course possible there is a bug in there that is being triggered by your particular circumstances.

The extra trigger should be ignored as it is already capturing by then, but it is possible that it might effect things. Have you tried using just single trigger to see if it is associated with that?

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

Re: RPi Cam Web Interface

Fri Nov 10, 2017 9:10 am

jfree23 wrote:
Mon Nov 06, 2017 3:40 pm
Hello all,

I've been running this on several RPIs for quite a while, mostly works well, great project! Running 6.4.05 now.

Things seem to work, but I often see messages like this in the logs, and have for a long time. Any suggestions about what they mean, problems indicated, or how to troubleshoot? Where should I look and what should I look for in the "iframe list"?

{2017/11/04 16:09:57} DEBUG 2: 31394, 31401


(secondary question - update.sh never works for me, due to problems with commits for the install.sh, update.sh, other *.sh in the RPI directory. I am not a big git user and I don't know how to do the commits so that the update can work. One suggestion was to replace "git fetch origin master" with "git pull" but that did not work for me, so I ended up doing another full install. Am I missing a simple trick here to make update.sh work?)

Thanks!
The error in iframe_list can occur when video buffering is used. The iframe list is a list of pointers into the circular buffer where iframes start. After each entry of data into the buffer a sanity check is performed on the pointers and if that fails it tries to recover and prints the error message. The check could fail if the video stream corrupts for some reason, so it might be worth checking that powering is good and the camera cable is solid. I'll look further into the check code to see if there could be other causes.

update has always proved a bit problematic as one is trying to merge git when local changes have been made during install. The latest version of fetch followed by an origin reset should work. Note that there is no real difference between an update and a full install other than the convenience of not having to do the extra steps.

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

Re: RPi Cam Web Interface

Fri Nov 10, 2017 9:42 am

Archer322 wrote:
Mon Nov 06, 2017 4:33 pm
How might I go about having a time lapse occur only while motion is being detected? I'm looking to record myself working in my shop. So I want an image capture every 20 seconds but only while I'm in my shop and then continue for X amount of minutes after so as to not time out while I'm sitting or something. Thoughts?
I think you can achieve this by a simple macro.

You want the macro to start the time lapse, wait for X minutes then stop the time lapse.

You then kick off the macro when a motion start trigger is detected by putting say sy timedlapse.sh in the motion start field.

timedlapse.sh needs to be created, put in the macros folder and given ownership www-data and execution permissions.

Code: Select all

#!/bin/bash
# macro to do time lapse for a fixed period

fifo=/var/www/FIFO
period=300
echo 'tl 1' >$fifo
sleep $period
echo 'tl 0' >$fifo
change period to number of seconds required; change fifo to where the web install was done

cd to macros folder
To change ownership

Code: Select all

sudo chown www-data:www-data timedlapse.sh
To set permissions

Code: Select all

sudo chmod 744 timedlapse.sh

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

Re: RPi Cam Web Interface

Fri Nov 10, 2017 9:49 am

antondubek wrote:
Tue Nov 07, 2017 5:31 pm
Wondering if anyone can help me. I have had this software running perfectly for a while now however after some updating it seems to have stopped functioning.

I am getting no video stream when in the web browser. The loading text pops up and then disappears leaving nothing. At times I am left with a tiny blue box with a question mark in it.

Running it on a raspberrypi3.

What I have tried:
Uninstalling and reinstalling numerous times.
Reboots.
Tried it autostarting
Tried manually starting
Different ports and folders to stream from
Different browsers
Different devices

I have tried to look into the watchdog and whats happening but can't find much information on it.

Checking the processes I can see two raspimjpeg running when the camera is running and only 1 after the watchdog restarts the camera. The LED on the camera starts and stops in timing with the watchdog reset if that matters at all.

Any help or insight would be greatly appreciated!
It is normal r 2 raspimjpeg to be running. When the first starts it spawns a copy of itself and one acts as a watchdog. The watchdog is looking for the cam.jpg file in the /dev/shm/mjpeg folder to be regularly updated. This is the preview file which forms the stream. If this does not update for more than the watchdog period then the main process kills itself and the watchdog process starts a separate copy.

As your watchdog is kicking in before it gets going then this would indicate that the camera process is not producing anything right from the start.

I would check first that camera system is working normally by using raspistill

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

Re: RPi Cam Web Interface

Fri Nov 10, 2017 9:56 am

conoral11 wrote:
Thu Nov 09, 2017 1:41 pm
I'm trying to get the multiview page working with two pi cameras, however I'm not having much luck.

Both Pis can see each other, and both can be viewed from the internet, and both cameras are working as expected.

The internal IP address for the PIs are 192.168.1.195 and 192.168.1.196.

My multiview.json file looks like:

Code: Select all

{"hosts":["http://192.168.1.195","http://192.168.1.196/"],"delays":[40000,40000]}
However I see nothing when I go to 192.168.1.195/multiview.html

I've added a <h1> tag to the file and can verify that the web page is being served up.

Both RPIcam systems have a username and password associated with them, could this be whats causing the images to not be displayed in multiview.htm?

Best Wishes
Yes, I think the user password could cause a problem. You could embed these in the url of the hosts file, or if you logged on separately in tabs of the browser to the 2 sites then that might work as well.

tk1
Posts: 12
Joined: Sat Apr 06, 2013 3:46 pm

Re: RPi Cam Web Interface

Sat Nov 11, 2017 9:48 pm

conoral11 wrote:
Thu Nov 09, 2017 1:41 pm
I'm trying to get the multiview page working with two pi cameras, however I'm not having much luck.

Both Pis can see each other, and both can be viewed from the internet, and both cameras are working as expected.

The internal IP address for the PIs are 192.168.1.195 and 192.168.1.196.

My multiview.json file looks like:

Code: Select all

{"hosts":["http://192.168.1.195","http://192.168.1.196/"],"delays":[40000,40000]}
However I see nothing when I go to 192.168.1.195/multiview.html

I've added a <h1> tag to the file and can verify that the web page is being served up.

Both RPIcam systems have a username and password associated with them, could this be whats causing the images to not be displayed in multiview.htm?

Best Wishes
I've also been trying to get the multiview to work, but haven't had success yet. One difference is that I do NOT have usernames and passwords yet. I just get the broken icon on the multiview page for each picam. My json file looks similar to the one above. Except for the usernames and passwords, I have the same results as conoral11.

Could it be something else?

Thanks,
tk1

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

Re: RPi Cam Web Interface

Sat Nov 11, 2017 11:15 pm

tk1 wrote:
Sat Nov 11, 2017 9:48 pm

I've also been trying to get the multiview to work, but haven't had success yet. One difference is that I do NOT have usernames and passwords yet. I just get the broken icon on the multiview page for each picam. My json file looks similar to the one above. Except for the usernames and passwords, I have the same results as conoral11.

Could it be something else?

Thanks,
tk1
I would build it up bit by bit so one can see where it is going wrong.

First use a multiview.json file like

Code: Select all

{"hosts":["http://192.168.0.02/"],"delays":[40000]}
where the host is just the local ip path through to the first local camera where the multiview.json is defined.

The path should include any subfolder if that has been used (e.g. http://192.168.0.02/html/

The multiview.json file should be owned by www-data and have rw permissions. (Use chown and chmod if required).

Browsing to the multiview.html file should now show one plain live preview screen.

If OK then add further hosts to the multiview.json file

chrono1975
Posts: 1
Joined: Sun Nov 12, 2017 5:15 pm

Re: RPi Cam Web Interface

Sun Nov 12, 2017 5:57 pm

Hello guys, I am a noob that just started with raspberry Pi recently. I need to access the live preview image on the RPi Cam server to do some image processings on it from a laptop. I installed RPi Cam on my Pi and it worked wonders. The problem is, I am not familiar with net working so I don't even know where to start. I am a noob in both python and java (I only have experience with C++ and C#). Can you guys please help me with some suggestions, like which book to read or which site to visit, or some related source codes? I already have some ideas about how to process the live image, but how do I access it in the first place? Already tried Googling but the results are only tutorials for installation and other unrelated stuffs. I use windows 10 on my laptop, Raspbian on my Raspberry Pi 3 model B, and a camera board version 2 (windows 10 is a must because that is one of the project's requirements).

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

Re: RPi Cam Web Interface

Sun Nov 12, 2017 10:02 pm

chrono1975 wrote:
Sun Nov 12, 2017 5:57 pm
Hello guys, I am a noob that just started with raspberry Pi recently. I need to access the live preview image on the RPi Cam server to do some image processings on it from a laptop. I installed RPi Cam on my Pi and it worked wonders. The problem is, I am not familiar with net working so I don't even know where to start. I am a noob in both python and java (I only have experience with C++ and C#). Can you guys please help me with some suggestions, like which book to read or which site to visit, or some related source codes? I already have some ideas about how to process the live image, but how do I access it in the first place? Already tried Googling but the results are only tutorials for installation and other unrelated stuffs. I use windows 10 on my laptop, Raspbian on my Raspberry Pi 3 model B, and a camera board version 2 (windows 10 is a must because that is one of the project's requirements).
The live preview image is generated from the camera interface as a jpeg image which updates at the video frame rate (or some sub-multiple of it. Assuming the video rate is 25 frames per second and the 'divider' is 1 then this jpeg image is updated 25 times per second. The live preview is formed in the browser either by just feeding it the jpegs in sequence or by forming them into a mjpeg stream.

In the raspberry where the camera is installed the jpeg image is stored in /dev/shm/mjpeg/cam.jpg. This is a RAM based part of the filing system but can be read just like a regular file. The install also links this to a position in the web folder so it can also be accessed as /var/www/html/cam.jpg (assuming software is installed in html subfolder. If you are going to access it for processing on the PC then you can either access it via URL (http://ipaddress/html/cam_pic.php) or by cross-mounting the file systems (e.g. by using SAMBA). These will give the latest jpeg.

GammaScorpii
Posts: 17
Joined: Wed Apr 13, 2016 1:25 pm

Re: RPi Cam Web Interface

Mon Nov 13, 2017 7:55 am

Has anyone successfully installed this onto the latest raspbian stretch lite with a Pi 3 model B?

The camera switches on, but I can't access the page on the network. Seems all the packages are missing? This is what I get after running ./install.sh

Code: Select all

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package php5-cli is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package libapache2-mod-php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php5' has no installation candidate
E: Package 'php5-cli' has no installation candidate
E: Package 'libapache2-mod-php5' has no installation candidate
cp: cannot create regular file 'etc/apache2/sites-available/raspicam.conf': Permission denied
awk: cannot open /etc/apache2/ports.conf (No such file or directory)
awk: cannot open /etc/apache2/ports.conf (No such file or directory)
awk: cannot open etc/apache2/sites-available/raspicam.conf (Permission denied)
mv: cannot move 'etc/apache2/sites-available/raspicam.conf' to '/etc/apache2/sites-available/raspicam.conf': No such file or directory
ln: failed to create symbolic link '/etc/apache2/sites-enabled/raspicam.conf': No such file or directory
sed: can't read /etc/apache2/conf.d/other-vhosts-access-log: No such file or directory
Failed to restart apache2.service: Unit apache2.service not found.
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
chown: invalid user: ‘motion:www-data’
chmod: cannot access '/etc/motion/motion.conf': No such file or directory
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package php5-cli is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package libapache2-mod-php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php5' has no installation candidate
E: Package 'php5-cli' has no installation candidate
E: Package 'libapache2-mod-php5' has no installation candidate
cp: cannot create regular file 'etc/apache2/sites-available/raspicam.conf': Permission denied
awk: cannot open /etc/apache2/ports.conf (No such file or directory)
awk: cannot open /etc/apache2/ports.conf (No such file or directory)
awk: cannot open etc/apache2/sites-available/raspicam.conf (Permission denied)
mv: cannot move 'etc/apache2/sites-available/raspicam.conf' to '/etc/apache2/sites-available/raspicam.conf': No such file or directory
ln: failed to create symbolic link '/etc/apache2/sites-enabled/raspicam.conf': No such file or directory
sed: can't read /etc/apache2/conf.d/other-vhosts-access-log: No such file or directory
Failed to restart apache2.service: Unit apache2.service not found.
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
sed: can't read /etc/motion/motion.conf: No such file or directory
chown: invalid user: ‘motion:www-data’
chmod: cannot access '/etc/motion/motion.conf': No such file or directory

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

Re: RPi Cam Web Interface

Mon Nov 13, 2017 8:50 am

GammaScorpii wrote:
Mon Nov 13, 2017 7:55 am
Has anyone successfully installed this onto the latest raspbian stretch lite with a Pi 3 model B?

The camera switches on, but I can't access the page on the network. Seems all the packages are missing? This is what I get after running ./install.sh
I have successfully installed on latest raspbian stretch (2017-09-07) but I haven't tried the lite version. Normally I use the full and remove all the large packages I don't want, as described in wiki.

Have you tried using php7 during the install? It is possible 5 has been removed from the repositories now.

GammaScorpii
Posts: 17
Joined: Wed Apr 13, 2016 1:25 pm

Re: RPi Cam Web Interface

Mon Nov 13, 2017 10:04 am

btidey wrote:
Mon Nov 13, 2017 8:50 am
GammaScorpii wrote:
Mon Nov 13, 2017 7:55 am
Has anyone successfully installed this onto the latest raspbian stretch lite with a Pi 3 model B?

The camera switches on, but I can't access the page on the network. Seems all the packages are missing? This is what I get after running ./install.sh
I have successfully installed on latest raspbian stretch (2017-09-07) but I haven't tried the lite version. Normally I use the full and remove all the large packages I don't want, as described in wiki.

Have you tried using php7 during the install? It is possible 5 has been removed from the repositories now.
Just tried on a fresh install of Stretch 4.9.41-v7+ full and I get pretty much the same thing:

Code: Select all

$ ./install.sh
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  dialog
0 upgraded, 1 newly installed, 0 to remove and 125 not upgraded.
Need to get 239 kB of archives.
After this operation, 978 kB of additional disk space will be used.
Get:1 http://raspbian.melbourneitmirror.net/raspbian stretch/main armhf dialog armhf 1.3-20160828-2 [239 kB]
Fetched 239 kB in 7s (34.0 kB/s)
Selecting previously unselected package dialog.
(Reading database ... 117768 files and directories currently installed.)
Preparing to unpack .../dialog_1.3-20160828-2_armhf.deb ...
Unpacking dialog (1.3-20160828-2) ...
Setting up dialog (1.3-20160828-2) ...
Processing triggers for man-db (2.7.6.1-2) ...
 Copyright (c) 2015, Bob Tidey. RPi Cam v6.4.05


Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package php5-cli is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package libapache2-mod-php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php5' has no installation candidate
E: Package 'php5-cli' has no installation candidate
E: Package 'libapache2-mod-php5' has no installation candidate
etc

How do I use php7?

Thanks for your help

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

Re: RPi Cam Web Interface

Mon Nov 13, 2017 12:03 pm

GammaScorpii wrote:
Mon Nov 13, 2017 10:04 am

Just tried on a fresh install of Stretch 4.9.41-v7+ full and I get pretty much the same thing:

How do I use php7?

Thanks for your help
When you run the install.sh there is an option called phpversion. Set that to 7 (should be by default).

If you don't see that option then you have an older version of install.sh

kazuko.nakamura
Posts: 58
Joined: Sun May 29, 2016 7:14 am

Re: RPi Cam Web Interface

Mon Nov 13, 2017 8:40 pm

Thank You for this GREAT software!!!

All working fine but i have question:
- I don't need to start camera after reboot. I would like to turn on (start camera) when I login to RPi webcam interface.

Is possible to set this?

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

Re: RPi Cam Web Interface

Mon Nov 13, 2017 10:49 pm

kazuko.nakamura wrote:
Mon Nov 13, 2017 8:40 pm
Thank You for this GREAT software!!!

All working fine but i have question:
- I don't need to start camera after reboot. I would like to turn on (start camera) when I login to RPi webcam interface.

Is possible to set this?
You will want the raspimjpeg process that interfaces with the camera to be running but inactive. So firstly you will want the raspimjpeg process to be running after a boot. So install it with the autostart option in the install set to yes. To make it inactive at start up you can use the config option in the /etc/raspimjpeg config file set to idle rather than standard.

Now when you login to the web interface you can use the button on the main screen to manually start the camera (or to stop it later).

There is also an option in the scheduler settings to automatically stop the camera after a time period if there are no browsers connected to the web camera interface and also start it as soon as a browser tries to access it. This is called AutoCamera_Interval. If this is non-zero then that is the delay in seconds after the last browser logs off before the camera shuts down. E.g. if you set it to 20 then it will wait for 20 seconds after the last client login is removed and then close the camera connection. Similarly when the first web client logs in again then the camera will be automatically restarted (without any delay).

Note that when camera is topped from the web interface that just means it is not used by this process. It can then be used by other camera software like raspivid.

Return to “Camera board”