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

Re: RPi Cam Web Interface

Sat May 06, 2017 9:51 am

btidey wrote:
quavoce wrote:
Hmm, something's not quite right here as I left it running with video split at 10 mins (motion detection off), but around 30 mins ago it stopped for some reason. (button on website back to "Record Video Start"

This is a fresh RPi v3 Jessie install with v6.3.4
I'm doing some more testing on this. So far it seemed OK for me.

The presence of a h264 file means that something has prevented the Mp4Box operation from converting it to mp4.

The scheduler log should gives some clues as to what is going on.
Note that this problem is different to my previous one. :)
After doing some more testing on this one I can see that scheduleLog.txt gives the following error:

Code: Select all

{2017/05/05 21:11:25} Restarting next split of 600 seconds
{2017/05/05 21:11:25} Capturing started
{2017/05/05 21:11:26} Start boxing /var/www/html/media/vi_0084_20170505_210125.mp4.h264 to /var/www/html/media/vi_0084_20170505_210125.mp4 Queue pos 21
{2017/05/05 21:13:22} Finished boxing /var/www/html/media/vi_0084_20170505_210125.mp4 from Box Queue at pos 21
{2017/05/05 21:13:22} Removed item from Box Queue
{2017/05/05 21:21:25} Stopping video from timer
{2017/05/05 21:21:25} Capturing stopped
{2017/05/05 21:21:25} Add /var/www/html/media/vi_0085_20170505_211125.mp4 to Box Queue at pos 22
{2017/05/05 21:21:25} Restarting next split of 600 seconds
{2017/05/05 21:21:26} Capturing started
{2017/05/05 21:21:27} Start boxing /var/www/html/media/vi_0085_20170505_211125.mp4.h264 to /var/www/html/media/vi_0085_20170505_211125.mp4 Queue pos 22
{2017/05/05 21:22:30} Error: Could not write all bytes h264
[2017/05/05 21:30:27] Scheduled management tasks. Next at 1494023427
[2017/05/05 21:30:27] Purged 62 Files
{2017/05/05 21:31:25} Stopping video from timer
{2017/05/05 21:31:25} Capturing stopped
{2017/05/05 21:31:25} Add /var/www/html/media/vi_0086_20170505_212126.mp4 to Box Queue at pos 23
{2017/05/05 21:31:25} Restarting next split of 600 seconds
{2017/05/05 21:31:25} Capturing started
{2017/05/05 21:41:25} Stopping video from timer
{2017/05/05 21:41:25} Capturing stopped
{2017/05/05 21:41:25} Add /var/www/html/media/vi_0087_20170505_213125.mp4 to Box Queue at pos 24
{2017/05/05 21:41:25} Restarting next split of 600 seconds
{2017/05/05 21:41:25} Capturing started
To me, the message "Error: Could not write all bytes h264" indicates there isn't enough space left on the memory card, but at the time there was 1.7GB free, and the video files were only taking up around 330MB.
My next test will be to try purging space with 30% min free instead of the 15% I had before to give it more space just in case.

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G   13G  1.7G  88% /
devtmpfs        426M     0  426M   0% /dev
tmpfs           430M   40K  430M   1% /dev/shm
tmpfs           430M  6.0M  425M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           430M     0  430M   0% /sys/fs/cgroup
/dev/mmcblk0p1   63M   21M   42M  34% /boot
tmpfs            86M     0   86M   0% /run/user/33
tmpfs            86M     0   86M   0% /run/user/1000

Code: Select all

-rw-r--r-- 1 www-data www-data 346M May  5 21:03 vi_0083_20170505_205125.mp4
-rw-r--r-- 1 www-data www-data  18K May  5 20:51 vi_0083_20170505_205125.mp4.v0083.th.jpg
-rw-r--r-- 1 www-data www-data 348M May  5 21:13 vi_0084_20170505_210125.mp4
-rw-r--r-- 1 www-data www-data  20K May  5 21:01 vi_0084_20170505_210125.mp4.v0084.th.jpg
-rw-r--r-- 1 www-data www-data 146M May  5 21:22 vi_0085_20170505_211125.mp4
-rw-r--r-- 1 www-data www-data 330M May  5 21:21 vi_0085_20170505_211125.mp4.h264
-rw-r--r-- 1 www-data www-data  19K May  5 21:11 vi_0085_20170505_211125.mp4.v0085.th.jpg
-rw-r--r-- 1 www-data www-data 336M May  5 21:31 vi_0086_20170505_212126.mp4.h264
-rw-r--r-- 1 www-data www-data  19K May  5 21:21 vi_0086_20170505_212126.mp4.v0086.th.jpg
-rw-r--r-- 1 www-data www-data 370M May  5 21:41 vi_0087_20170505_213125.mp4.h264
-rw-r--r-- 1 www-data www-data  19K May  5 21:31 vi_0087_20170505_213125.mp4.v0087.th.jpg
-rw-r--r-- 1 www-data www-data 290M May  5 21:49 vi_0088_20170505_214125.mp4.h264
-rw-r--r-- 1 www-data www-data  20K May  5 21:41 vi_0088_20170505_214125.mp4.v0088.th.jpg

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

Re: RPi Cam Web Interface

Sun May 07, 2017 8:38 am

quavoce wrote: Note that this problem is different to my previous one. :)
After doing some more testing on this one I can see that scheduleLog.txt gives the following error:

Code: Select all

{2017/05/05 21:11:25} Restarting next split of 600 seconds
{2017/05/05 21:11:25} Capturing started
{2017/05/05 21:11:26} Start boxing /var/www/html/media/vi_0084_20170505_210125.mp4.h264 to /var/www/html/media/vi_0084_20170505_210125.mp4 Queue pos 21
{2017/05/05 21:13:22} Finished boxing /var/www/html/media/vi_0084_20170505_210125.mp4 from Box Queue at pos 21
{2017/05/05 21:13:22} Removed item from Box Queue
{2017/05/05 21:21:25} Stopping video from timer
{2017/05/05 21:21:25} Capturing stopped
{2017/05/05 21:21:25} Add /var/www/html/media/vi_0085_20170505_211125.mp4 to Box Queue at pos 22
{2017/05/05 21:21:25} Restarting next split of 600 seconds
{2017/05/05 21:21:26} Capturing started
{2017/05/05 21:21:27} Start boxing /var/www/html/media/vi_0085_20170505_211125.mp4.h264 to /var/www/html/media/vi_0085_20170505_211125.mp4 Queue pos 22
{2017/05/05 21:22:30} Error: Could not write all bytes h264
[2017/05/05 21:30:27] Scheduled management tasks. Next at 1494023427
[2017/05/05 21:30:27] Purged 62 Files
{2017/05/05 21:31:25} Stopping video from timer
{2017/05/05 21:31:25} Capturing stopped
{2017/05/05 21:31:25} Add /var/www/html/media/vi_0086_20170505_212126.mp4 to Box Queue at pos 23
{2017/05/05 21:31:25} Restarting next split of 600 seconds
{2017/05/05 21:31:25} Capturing started
{2017/05/05 21:41:25} Stopping video from timer
{2017/05/05 21:41:25} Capturing stopped
{2017/05/05 21:41:25} Add /var/www/html/media/vi_0087_20170505_213125.mp4 to Box Queue at pos 24
{2017/05/05 21:41:25} Restarting next split of 600 seconds
{2017/05/05 21:41:25} Capturing started
To me, the message "Error: Could not write all bytes h264" indicates there isn't enough space left on the memory card, but at the time there was 1.7GB free, and the video files were only taking up around 330MB.
My next test will be to try purging space with 30% min free instead of the 15% I had before to give it more space just in case.

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        15G   13G  1.7G  88% /
devtmpfs        426M     0  426M   0% /dev
tmpfs           430M   40K  430M   1% /dev/shm
tmpfs           430M  6.0M  425M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           430M     0  430M   0% /sys/fs/cgroup
/dev/mmcblk0p1   63M   21M   42M  34% /boot
tmpfs            86M     0   86M   0% /run/user/33
tmpfs            86M     0   86M   0% /run/user/1000

Code: Select all

-rw-r--r-- 1 www-data www-data 346M May  5 21:03 vi_0083_20170505_205125.mp4
-rw-r--r-- 1 www-data www-data  18K May  5 20:51 vi_0083_20170505_205125.mp4.v0083.th.jpg
-rw-r--r-- 1 www-data www-data 348M May  5 21:13 vi_0084_20170505_210125.mp4
-rw-r--r-- 1 www-data www-data  20K May  5 21:01 vi_0084_20170505_210125.mp4.v0084.th.jpg
-rw-r--r-- 1 www-data www-data 146M May  5 21:22 vi_0085_20170505_211125.mp4
-rw-r--r-- 1 www-data www-data 330M May  5 21:21 vi_0085_20170505_211125.mp4.h264
-rw-r--r-- 1 www-data www-data  19K May  5 21:11 vi_0085_20170505_211125.mp4.v0085.th.jpg
-rw-r--r-- 1 www-data www-data 336M May  5 21:31 vi_0086_20170505_212126.mp4.h264
-rw-r--r-- 1 www-data www-data  19K May  5 21:21 vi_0086_20170505_212126.mp4.v0086.th.jpg
-rw-r--r-- 1 www-data www-data 370M May  5 21:41 vi_0087_20170505_213125.mp4.h264
-rw-r--r-- 1 www-data www-data  19K May  5 21:31 vi_0087_20170505_213125.mp4.v0087.th.jpg
-rw-r--r-- 1 www-data www-data 290M May  5 21:49 vi_0088_20170505_214125.mp4.h264
-rw-r--r-- 1 www-data www-data  20K May  5 21:41 vi_0088_20170505_214125.mp4.v0088.th.jpg
It looks like this was space related - by increasing minimum space % to 30 it seems to have lasted longer (until a watchdog reset occurred). :(

On that note, would it possible to somehow continue what was running before a watchdog reset occurred by any chance please?

For example, I had "Record Video" running, but after the reset this stopped and it left a .h264 file unconverted.

Could a status file record what was running such as motion detection on, video recording, etc, and then start this again dependant on the schedule settings? Could the watchdog process also look for any .h264 files and try mp4box them again please?

My scheduleLog.txt looked like this at the time of the reset. As you can see, and mp4box queue started but never finished.

Code: Select all

{2017/05/07 05:31:18} Capturing started
{2017/05/07 05:31:19} Start boxing /var/www/html/media/vi_0206_20170507_052118.mp4.h264 to /var/www/html/media/vi_0206_20170507_052118.mp4 Queue pos 13
{2017/05/07 05:35:13} Finished boxing /var/www/html/media/vi_0206_20170507_052118.mp4 from Box Queue at pos 13
{2017/05/07 05:35:13} Removed item from Box Queue
{2017/05/07 05:41:18} Stopping video from timer
{2017/05/07 05:41:18} Capturing stopped
{2017/05/07 05:41:18} Add /var/www/html/media/vi_0207_20170507_053118.mp4 to Box Queue at pos 14
{2017/05/07 05:41:18} Restarting next split of 600 seconds
{2017/05/07 05:41:18} Capturing started
{2017/05/07 05:41:19} Start boxing /var/www/html/media/vi_0207_20170507_053118.mp4.h264 to /var/www/html/media/vi_0207_20170507_053118.mp4 Queue pos 14
{2017/05/07 05:45:30} Watchdog detected problem. Stopping{2017/05/07 05:45:31} SIGINT/SIGTERM received, stopping
{2017/05/07 05:45:31} Capturing stopped
{2017/05/07 05:45:31} Add /var/www/html/media/vi_0208_20170507_054118.mp4 to Box Queue at pos 15
{2017/05/07 05:45:37} RaspiMJPEG Version 5.8.02
{2017/05/07 05:45:37} recommended video buffer size 65536
{2017/05/07 05:45:37} h264 size set to 131072
{2017/05/07 05:45:37} recommended video buffers 1
{2017/05/07 05:45:37} h264 buffers set to recommended 1
{2017/05/07 05:45:37} Set up internal detect width=82 height=61
{2017/05/07 05:45:37} Opening FIFO 0 /var/www/html/FIFO 7
{2017/05/07 05:45:37} Opening FIFO 1 /var/www/html/FIFO11 8
{2017/05/07 05:45:37} MJPEG streaming, ready to receive commands
{2017/05/07 05:45:37} send smd 9
{2017/05/07 05:45:37} Starting command loop
[2017/05/07 05:45:37] Reload parameters command requested
[2017/05/07 05:45:37] Scheduler loop is started
[2017/05/07 05:45:38] New period detected 0
[2017/05/07 05:45:38] Scheduled management tasks. Next at 1494139538
[2017/05/07 05:45:38] Purged 4 Files

Code: Select all

-rw-r--r-- 1 www-data www-data 562M May  7 05:45 vi_0207_20170507_053118.mp4
-rw-r--r-- 1 www-data www-data  46K May  7 05:31 vi_0207_20170507_053118.mp4.v0207.th.jpg
-rw-r--r-- 1 www-data www-data 223M May  7 05:45 vi_0208_20170507_054118.mp4.h264
-rw-r--r-- 1 www-data www-data  48K May  7 05:41 vi_0208_20170507_054118.mp4.v0208.th.jpg
Thank you!

BaGRoS
Posts: 6
Joined: Tue Feb 12, 2013 8:14 pm

Re: RPi Cam Web Interface

Sun May 07, 2017 10:10 am

Hi
I install with lighttpd, directory /html/
But this config don't used /html/ ok this is no problem
Biggest problem is working without password prompt?!

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

Re: RPi Cam Web Interface

Tue May 16, 2017 1:28 pm

Couple of small improvements to the purging process.

1) Any .h264 files are removed when their related video is purged or deleted.

2) Any orphaned zip files are removed if they are older than the video purge hours limit.

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

Re: RPi Cam Web Interface

Sat May 20, 2017 8:23 am

btidey wrote:
Gary Littlemore wrote:Robert, my Jessie Lite still isn't updating using the ./update.sh I've just gone from 6.3.3 tried to ./update.sh first and then had to remove the /RPi_Cam_Web_Interface/ folder and re-git clone to get the 6.3.4 update.
What sort of error did you get? DId it fetch OK and run the installer or did it fail to fetch the update?

Previously there was a problem with the git pull method but that was changed to fetch
I've just tried ./update.sh to get to 6.3.5 and it never updated again. I noticed when the update was running an error, see screen capture below.

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

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

Re: RPi Cam Web Interface

Sat May 20, 2017 9:50 am

Gary Littlemore wrote: I've just tried ./update.sh to get to 6.3.5 and it never updated again. I noticed when the update was running an error, see screen capture below.
The error you are getting is in an install script command where it is getting the boardrev number in order to check whether it is a module that can handle 2 camera interfaces.

To do this it gets the system cmdline and extracts the boardrev from that.

For some reason your cmdline doesn't appear to have a boardrev parameter and so the extraction returns an empty string and the comparison fails.

You can check your cmdline by

Code: Select all

cat /proc/cmdline
I have improved the install script so that it doesn't throw this error even if boardrev is not present

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

Re: RPi Cam Web Interface

Sat May 20, 2017 10:36 am

quavoce wrote:
quavoce wrote: Hi Robert, I think there's a bug with Monitor mode and the Video Split feature. If I enable Monitor mode and set Video Split to say 120, then press Record Video Start, the recording stops at the end of the first split. If I then change the mode back to Internal and start recording again, the video splits as expected and continues to record.
I've been able to repeat the above problem on a new Pi with a fresh Jessie install and camera, but this time I have some error messages for you. :)

As I hadn't logged out of the ssh window after installing RPi Web Cam, the error messages appeared on standard out as soon as the 120 seconds were up:

Code: Select all

mmal: mmal_vc_port_info_set: failed to set port info (2:0): EINVAL
mmal: mmal_vc_port_set_format: mmal_vc_port_info_set failed 0x1df8ba0 (EINVAL)
mmal: mmal_connection_create: format not set on input port
mmal: mmal_connection_destroy_internal: connection vc.ril.camera:out:1/vc.ril.video_encode:in:0 could not be cleared
The scheduleLog.txt shows:

Code: Select all

{2017/05/05 14:21:31} RaspiMJPEG Version 5.8.02
{2017/05/05 14:21:31} recommended video buffer size 65536
{2017/05/05 14:21:31} h264 size set to 131072
{2017/05/05 14:21:31} recommended video buffers 1
{2017/05/05 14:21:31} h264 buffers set to recommended 1
{2017/05/05 14:21:31} Opening FIFO 0 /var/www/html/FIFO 6
{2017/05/05 14:21:31} Opening FIFO 1 /var/www/html/FIFO11 7
{2017/05/05 14:21:31} MJPEG streaming, ready to receive commands
{2017/05/05 14:21:31} send smd 9
[2017/05/05 14:21:32] RaspiCam support started
[2017/05/05 14:21:32] Capture Pipe already exists /var/www/html/FIFO1
[2017/05/05 14:21:32] Scheduler loop is started
{2017/05/05 14:21:32} Starting command loop
[2017/05/05 14:21:32] Reload parameters command requested
[2017/05/05 14:21:32] Scheduler loop is started
[2017/05/05 14:21:33] New period detected 0
[2017/05/05 14:21:33] Scheduled management tasks. Next at 1493997693
{2017/05/05 14:22:07} Change: rotation = 180
{2017/05/05 14:22:22} Change: video_width = 1296
{2017/05/05 14:22:22} Change: video_height = 972
{2017/05/05 14:22:22} Change: video_fps = 25
{2017/05/05 14:22:22} Change: MP4Box_fps = 25
{2017/05/05 14:22:22} Change: image_width = 2592
{2017/05/05 14:22:22} Change: image_height = 1944
{2017/05/05 14:22:22} recommended video buffer size 65536
{2017/05/05 14:22:22} h264 size set to 131072
{2017/05/05 14:22:22} recommended video buffers 1
{2017/05/05 14:22:22} h264 buffers set to recommended 1
{2017/05/05 14:22:35} Change: quality = 10
{2017/05/05 14:22:35} Change: width = 800
{2017/05/05 14:22:35} Change: divider = 1
{2017/05/05 14:22:35} recommended video buffer size 65536
{2017/05/05 14:22:35} h264 size set to 131072
{2017/05/05 14:22:35} recommended video buffers 1
{2017/05/05 14:22:35} h264 buffers set to recommended 1
{2017/05/05 14:22:52} Change: rotation = 0
{2017/05/05 15:09:30} Change: motion_external = 2
{2017/05/05 15:09:59} Change: annotation = RPi Cam %Y.%M.%D_%h:%m:%s %c %f
{2017/05/05 15:10:35} Change: video_split = 120
{2017/05/05 15:11:33} Capturing with split of 120 seconds
{2017/05/05 15:11:33} Capturing started
{2017/05/05 15:13:33} Stopping video from timer
{2017/05/05 15:13:33} Capturing stopped
{2017/05/05 15:13:33} Add /var/www/html/media/vi_0000_20170505_151133.mp4 to Box Queue at pos 0
{2017/05/05 15:13:33} Restarting next split of 120 seconds
{2017/05/05 15:13:33} Error: Could not create connection camera -> video converter
{2017/05/05 15:13:34} Start boxing /var/www/html/media/vi_0000_20170505_151133.mp4.h264 to /var/www/html/media/vi_0000_20170505_151133.mp4 Queue pos 0
{2017/05/05 15:13:39} Finished boxing /var/www/html/media/vi_0000_20170505_151133.mp4 from Box Queue at pos 0
{2017/05/05 15:13:41} Removed item from Box Queue
{2017/05/05 15:13:44} Watchdog detected problem. Stopping{2017/05/05 15:13:45} SIGINT/SIGTERM received, stopping
{2017/05/05 15:13:50} RaspiMJPEG Version 5.8.02
{2017/05/05 15:13:50} recommended video buffer size 65536
{2017/05/05 15:13:50} h264 size set to 131072
{2017/05/05 15:13:50} recommended video buffers 1
{2017/05/05 15:13:50} h264 buffers set to recommended 1
{2017/05/05 15:13:50} Set up internal detect width=82 height=61
{2017/05/05 15:13:50} Opening FIFO 0 /var/www/html/FIFO 7
{2017/05/05 15:13:50} Opening FIFO 1 /var/www/html/FIFO11 8
{2017/05/05 15:13:50} MJPEG streaming, ready to receive commands
{2017/05/05 15:13:50} send smd 9
{2017/05/05 15:13:50} Starting command loop
[2017/05/05 15:13:50] Reload parameters command requested
[2017/05/05 15:13:50] Scheduler loop is started
[2017/05/05 15:13:51] New period detected 0
[2017/05/05 15:13:51] Scheduled management tasks. Next at 1494000831
Thanks.
Hi Robert,

Sorry to chase, I really think this feature will be very useful once fully working. The bug seems to be repeatable as it's doing the same on a Pi Zero too. I hope this is something that can be fixed because this excellent feature is so tantalisingly close. :)

As an example, I use the cams to keep an eye on our dog during the day too, and having the ability to constantly record video and have a log showing when movement is detected would have really helped the other day. She basically ended up chewing something but because there was very little movement, my still frames to stop count expired at 2000 and so couldn't see what else she got up to till she properly moved again. :)

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

Re: RPi Cam Web Interface

Sat May 20, 2017 4:56 pm

quavoce wrote: Hi Robert,

Sorry to chase, I really think this feature will be very useful once fully working. The bug seems to be repeatable as it's doing the same on a Pi Zero too. I hope this is something that can be fixed because this excellent feature is so tantalisingly close. :)

As an example, I use the cams to keep an eye on our dog during the day too, and having the ability to constantly record video and have a log showing when movement is detected would have really helped the other day. She basically ended up chewing something but because there was very little movement, my still frames to stop count expired at 2000 and so couldn't see what else she got up to till she properly moved again. :)
I am checking into this and have set up a test environment.

This is on a Pi3, with monitor mode on and video split set to 20 seconds.

So far it has been running for nearly two hours without problems.

I may need to change things around to try to get it to fail in same way. So a few question /requests.

1) Can you attach a zip with your uconfig so I can try to replicate the exact set up?

2) My test set up has monitoring on but there won't be much movement activity. It is possible that it is not just the monitor but real movement / logging that is a precursor for failure. The motionLog.txt file should have the entries for the monitored detections. Can you see if there is any correlation in there with time of failure? E.g. post section of log around point of failure.

3) I may have to try on a Pi Zero if you think that might be a factor in causing the failures.

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

Re: RPi Cam Web Interface

Sat May 20, 2017 7:26 pm

btidey wrote:
I am checking into this and have set up a test environment.

This is on a Pi3, with monitor mode on and video split set to 20 seconds.

So far it has been running for nearly two hours without problems.

I may need to change things around to try to get it to fail in same way. So a few question /requests.

1) Can you attach a zip with your uconfig so I can try to replicate the exact set up?

2) My test set up has monitoring on but there won't be much movement activity. It is possible that it is not just the monitor but real movement / logging that is a precursor for failure. The motionLog.txt file should have the entries for the monitored detections. Can you see if there is any correlation in there with time of failure? E.g. post section of log around point of failure.

3) I may have to try on a Pi Zero if you think that might be a factor in causing the failures.
Hi Robert,

Thank you for looking into this!

Ok, so I've just written a fresh Jessie Lite image with a clean install of RPi Web Cam on a Pi 3 (different Pi 3 and camera to previous ones just in case hardware related) and the error occurred again.

Code: Select all

pi@raspberrypi:/var/www/html $ tail -f scheduleLog.txt
{2017/05/20 19:14:33} RaspiMJPEG Version 5.8.02
{2017/05/20 19:14:33} recommended video buffer size 65536
{2017/05/20 19:14:33} h264 size set to 131072
{2017/05/20 19:14:33} recommended video buffers 1
{2017/05/20 19:14:33} h264 buffers set to recommended 1
{2017/05/20 19:14:33} Opening FIFO 0 /var/www/html/FIFO 6
{2017/05/20 19:14:33} Opening FIFO 1 /var/www/html/FIFO11 7
{2017/05/20 19:14:33} MJPEG streaming, ready to receive commands
{2017/05/20 19:14:33} send smd 9
[2017/05/20 19:14:34] RaspiCam support started
[2017/05/20 19:14:34] Capture Pipe already exists /var/www/html/FIFO1
[2017/05/20 19:14:34] Scheduler loop is started
{2017/05/20 19:14:34} Starting command loop
[2017/05/20 19:14:34] Reload parameters command requested
[2017/05/20 19:14:34] Scheduler loop is started
[2017/05/20 19:14:35] New period detected 0
[2017/05/20 19:14:35] Scheduled management tasks. Next at 1495311275
{2017/05/20 19:14:59} Change: video_width = 1296
{2017/05/20 19:14:59} Change: video_height = 972
{2017/05/20 19:14:59} Change: video_fps = 25
{2017/05/20 19:14:59} Change: MP4Box_fps = 25
{2017/05/20 19:14:59} Change: image_width = 2592
{2017/05/20 19:14:59} Change: image_height = 1944
{2017/05/20 19:14:59} recommended video buffer size 65536
{2017/05/20 19:14:59} h264 size set to 131072
{2017/05/20 19:14:59} recommended video buffers 1
{2017/05/20 19:14:59} h264 buffers set to recommended 1
{2017/05/20 19:15:05} Change: quality = 10
{2017/05/20 19:15:05} Change: width = 800
{2017/05/20 19:15:05} Change: divider = 1
{2017/05/20 19:15:06} recommended video buffer size 65536
{2017/05/20 19:15:06} h264 size set to 131072
{2017/05/20 19:15:06} recommended video buffers 1
{2017/05/20 19:15:06} h264 buffers set to recommended 1
{2017/05/20 19:15:15} Change: video_split = 120
{2017/05/20 19:15:22} Change: motion_external = 2
{2017/05/20 19:15:48} Capturing with split of 120 seconds
{2017/05/20 19:15:48} Capturing started

{2017/05/20 19:17:48} Stopping video from timer
{2017/05/20 19:17:48} Capturing stopped
{2017/05/20 19:17:48} Add /var/www/html/media/vi_0000_20170520_191548.mp4 to Box Queue at pos 0
{2017/05/20 19:17:48} Restarting next split of 120 seconds
mmal: mmal_vc_port_info_set: failed to set port info (2:0): EINVAL
mmal: mmal_vc_port_set_format: mmal_vc_port_info_set failed 0x18a3ba0 (EINVAL)
mmal: mmal_connection_create: format not set on input port
mmal: mmal_connection_destroy_internal: connection vc.ril.camera:out:1/vc.ril.video_encode:in:0 could not be cleared
{2017/05/20 19:17:48} Error: Could not create connection camera -> video converter
{2017/05/20 19:17:49} Start boxing /var/www/html/media/vi_0000_20170520_191548.mp4.h264 to /var/www/html/media/vi_0000_20170520_191548.mp4 Queue pos 0
{2017/05/20 19:17:54} Finished boxing /var/www/html/media/vi_0000_20170520_191548.mp4 from Box Queue at pos 0
{2017/05/20 19:17:56} Removed item from Box Queue
{2017/05/20 19:18:01} Watchdog detected problem. Stopping{2017/05/20 19:18:02} SIGINT/SIGTERM received, stopping
{2017/05/20 19:18:07} RaspiMJPEG Version 5.8.02
{2017/05/20 19:18:07} recommended video buffer size 65536
{2017/05/20 19:18:07} h264 size set to 131072
{2017/05/20 19:18:07} recommended video buffers 1
{2017/05/20 19:18:07} h264 buffers set to recommended 1
{2017/05/20 19:18:07} Set up internal detect width=82 height=61
{2017/05/20 19:18:07} Opening FIFO 0 /var/www/html/FIFO 7
{2017/05/20 19:18:07} Opening FIFO 1 /var/www/html/FIFO11 8
{2017/05/20 19:18:07} MJPEG streaming, ready to receive commands
{2017/05/20 19:18:07} send smd 9
{2017/05/20 19:18:07} Starting command loop
[2017/05/20 19:18:07] Reload parameters command requested
[2017/05/20 19:18:07] Scheduler loop is started
[2017/05/20 19:18:08] New period detected 0
[2017/05/20 19:18:08] Scheduled management tasks. Next at 1495311488
1. My uconfig file just has the following entries:

Code: Select all

width 800
video_width 1296
video_height 972
video_split 120
motion_external 2
2. My test cam wasn't pointed at anything so no motion was detected during the 120 second interval.
3. The issue occurs on both my Pi 3 and Pi Zero.

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

Re: RPi Cam Web Interface

Sat May 20, 2017 8:03 pm

quavoce wrote: Hi Robert,

Thank you for looking into this!

Ok, so I've just written a fresh Jessie Lite image with a clean install of RPi Web Cam on a Pi 3 (different Pi 3 and camera to previous ones just in case hardware related) and the error occurred again.

Code: Select all

pi@raspberrypi:/var/www/html $ tail -f scheduleLog.txt
{2017/05/20 19:14:33} RaspiMJPEG Version 5.8.02
{2017/05/20 19:14:33} recommended video buffer size 65536
{2017/05/20 19:14:33} h264 size set to 131072
{2017/05/20 19:14:33} recommended video buffers 1
{2017/05/20 19:14:33} h264 buffers set to recommended 1
{2017/05/20 19:14:33} Opening FIFO 0 /var/www/html/FIFO 6
{2017/05/20 19:14:33} Opening FIFO 1 /var/www/html/FIFO11 7
{2017/05/20 19:14:33} MJPEG streaming, ready to receive commands
{2017/05/20 19:14:33} send smd 9
[2017/05/20 19:14:34] RaspiCam support started
[2017/05/20 19:14:34] Capture Pipe already exists /var/www/html/FIFO1
[2017/05/20 19:14:34] Scheduler loop is started
{2017/05/20 19:14:34} Starting command loop
[2017/05/20 19:14:34] Reload parameters command requested
[2017/05/20 19:14:34] Scheduler loop is started
[2017/05/20 19:14:35] New period detected 0
[2017/05/20 19:14:35] Scheduled management tasks. Next at 1495311275
{2017/05/20 19:14:59} Change: video_width = 1296
{2017/05/20 19:14:59} Change: video_height = 972
{2017/05/20 19:14:59} Change: video_fps = 25
{2017/05/20 19:14:59} Change: MP4Box_fps = 25
{2017/05/20 19:14:59} Change: image_width = 2592
{2017/05/20 19:14:59} Change: image_height = 1944
{2017/05/20 19:14:59} recommended video buffer size 65536
{2017/05/20 19:14:59} h264 size set to 131072
{2017/05/20 19:14:59} recommended video buffers 1
{2017/05/20 19:14:59} h264 buffers set to recommended 1
{2017/05/20 19:15:05} Change: quality = 10
{2017/05/20 19:15:05} Change: width = 800
{2017/05/20 19:15:05} Change: divider = 1
{2017/05/20 19:15:06} recommended video buffer size 65536
{2017/05/20 19:15:06} h264 size set to 131072
{2017/05/20 19:15:06} recommended video buffers 1
{2017/05/20 19:15:06} h264 buffers set to recommended 1
{2017/05/20 19:15:15} Change: video_split = 120
{2017/05/20 19:15:22} Change: motion_external = 2
{2017/05/20 19:15:48} Capturing with split of 120 seconds
{2017/05/20 19:15:48} Capturing started

{2017/05/20 19:17:48} Stopping video from timer
{2017/05/20 19:17:48} Capturing stopped
{2017/05/20 19:17:48} Add /var/www/html/media/vi_0000_20170520_191548.mp4 to Box Queue at pos 0
{2017/05/20 19:17:48} Restarting next split of 120 seconds
mmal: mmal_vc_port_info_set: failed to set port info (2:0): EINVAL
mmal: mmal_vc_port_set_format: mmal_vc_port_info_set failed 0x18a3ba0 (EINVAL)
mmal: mmal_connection_create: format not set on input port
mmal: mmal_connection_destroy_internal: connection vc.ril.camera:out:1/vc.ril.video_encode:in:0 could not be cleared
{2017/05/20 19:17:48} Error: Could not create connection camera -> video converter
{2017/05/20 19:17:49} Start boxing /var/www/html/media/vi_0000_20170520_191548.mp4.h264 to /var/www/html/media/vi_0000_20170520_191548.mp4 Queue pos 0
{2017/05/20 19:17:54} Finished boxing /var/www/html/media/vi_0000_20170520_191548.mp4 from Box Queue at pos 0
{2017/05/20 19:17:56} Removed item from Box Queue
{2017/05/20 19:18:01} Watchdog detected problem. Stopping{2017/05/20 19:18:02} SIGINT/SIGTERM received, stopping
{2017/05/20 19:18:07} RaspiMJPEG Version 5.8.02
{2017/05/20 19:18:07} recommended video buffer size 65536
{2017/05/20 19:18:07} h264 size set to 131072
{2017/05/20 19:18:07} recommended video buffers 1
{2017/05/20 19:18:07} h264 buffers set to recommended 1
{2017/05/20 19:18:07} Set up internal detect width=82 height=61
{2017/05/20 19:18:07} Opening FIFO 0 /var/www/html/FIFO 7
{2017/05/20 19:18:07} Opening FIFO 1 /var/www/html/FIFO11 8
{2017/05/20 19:18:07} MJPEG streaming, ready to receive commands
{2017/05/20 19:18:07} send smd 9
{2017/05/20 19:18:07} Starting command loop
[2017/05/20 19:18:07] Reload parameters command requested
[2017/05/20 19:18:07] Scheduler loop is started
[2017/05/20 19:18:08] New period detected 0
[2017/05/20 19:18:08] Scheduled management tasks. Next at 1495311488
1. My uconfig file just has the following entries:

Code: Select all

width 800
video_width 1296
video_height 972
video_split 120
motion_external 2
2. My test cam wasn't pointed at anything so no motion was detected during the 120 second interval.
3. The issue occurs on both my Pi 3 and Pi Zero.
Thanks for the settings. I'll change over to those. The differences are I am using a faster split period in attempt to stress it more and a smaller width. The other difference is that my test was on a full Jessie, although I doubt whether that is significant. I'll prepare another SD card with latest Jessie Lite in case it does make a difference or the latest kernel makes a difference.

My test with the previous settings has now done 900 20 second splits

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

Re: RPi Cam Web Interface

Sun May 21, 2017 7:30 am

btidey wrote:
Thanks for the settings. I'll change over to those. The differences are I am using a faster split period in attempt to stress it more and a smaller width. The other difference is that my test was on a full Jessie, although I doubt whether that is significant. I'll prepare another SD card with latest Jessie Lite in case it does make a difference or the latest kernel makes a difference.

My test with the previous settings has now done 900 20 second splits
It was the same issue on full fat Jessie unfortunately (thought I'd try lite in case that helped).

Just tried 20 seconds with the same settings but error still occurred.

Changed preview back down to 512 and video res to HD ready but still same.

Code: Select all

video_width 1280
video_height 0720
video_split 20
motion_external 2
I'm going to try a fresh full Jessie again (2017-04-10-raspbian-jessie.img) but this time I won't change any other settings other than video split (20 seconds) and monitor mode to see if I can make it work.

Thanks for your help with this Robert, I really appreciate it.

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

Re: RPi Cam Web Interface

Sun May 21, 2017 9:32 am

I've done some more testing with the following results:
  • Fresh install of full Jessie (2017-04-10-raspbian-jessie.img). apt-get update and dist-upgrade. Installed latest RPi Cam v6.3.6. Left all cam settings at default except for 20 sec video split and monitor mode. Failed with same error at the 20 sec split point.
  • Fresh install of Jessie Lite (2016-09-23-raspbian-jessie-lite.img). apt-get update but no software upgrade. Latest RPi Cam v6.3.6. Left all cam settings at default except for 20 sec video split and monitor mode. Failed with same error at the 20 sec split point.
  • I'll try to find an older version of Jessie and test that too.
  • Update - tried 2016-03-18-raspbian-jessie.img but no luck there either.

frankieforceps
Posts: 7
Joined: Tue Feb 28, 2017 5:07 am

Re: RPi Cam Web Interface

Mon May 22, 2017 6:08 am

Hi btidey,

First I have to commend you on your continued support for the RPI Web interface on this forum. Its really an amazing thing you have been providing free support for everybody, for so long. Good job and thankyou!

I have a question for you if you dont mind. I've been using the web interface to stream frames to another PC for a computer vision application. I'm capturing the frames using OpenCV on the PC. I'm using the web address http://<IP>/html/cam_pic_new.php to capture the mpeg stream. One thing I've noticed is that I'm receiving many duplicate images. Around 2-3 copies of each image. I think OpenCV is copying the posted image as fast as it can, and captures a new image once a new image is updated on the server. So far I've been annotating the images and removing duplicates using OCR on the frame captures.

I'm wondering if there is an easier way to detect when a new image is posted, to avoid processing duplicate images. Have any ideas?

Thanks so much!

pumpkinpi
Posts: 141
Joined: Fri Apr 18, 2014 7:11 pm

Re: RPi Cam Web Interface

Mon May 22, 2017 2:58 pm

Hi Folks,

Is there a way to intiate a timelapse image sequence at something like one every second using motion sensing? I am using this to record photos of birds. I tried setting the "Video fps" value in the "Resolutions" box to 1 fps and boxing to 1 fps but it seems to send the Pi into an unending death spiral (this is in a Pi Zero, so not surpising).

Also, using the timelapse feature takes an image every X seconds without regard for motion (which makes sense). Timelapse does work fine but I end up with thousands of images to wade through.

Suppose what I would love ideally is for it to take a full resolution image every 1 to 2 seconds during periods where there is motion sensed. Perhaps there is a way to pass a command to trigger timelapse images into the FIFO file when motion is detected?

Thanks!
PPi

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

Re: RPi Cam Web Interface

Tue May 23, 2017 8:11 am

quavoce wrote:I've done some more testing with the following results:
  • Fresh install of full Jessie (2017-04-10-raspbian-jessie.img). apt-get update and dist-upgrade. Installed latest RPi Cam v6.3.6. Left all cam settings at default except for 20 sec video split and monitor mode. Failed with same error at the 20 sec split point.
  • Fresh install of Jessie Lite (2016-09-23-raspbian-jessie-lite.img). apt-get update but no software upgrade. Latest RPi Cam v6.3.6. Left all cam settings at default except for 20 sec video split and monitor mode. Failed with same error at the 20 sec split point.
  • I'll try to find an older version of Jessie and test that too.
  • Update - tried 2016-03-18-raspbian-jessie.img but no luck there either.
Could you try setting Buffer to say 2000?

The error you report is when the split stops and starts the camera feeds up in quick succession. Having the buffer changes the timing somewhat.

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

Re: RPi Cam Web Interface

Tue May 23, 2017 8:18 am

pumpkinpi wrote:Hi Folks,

Is there a way to intiate a timelapse image sequence at something like one every second using motion sensing? I am using this to record photos of birds. I tried setting the "Video fps" value in the "Resolutions" box to 1 fps and boxing to 1 fps but it seems to send the Pi into an unending death spiral (this is in a Pi Zero, so not surpising).

Also, using the timelapse feature takes an image every X seconds without regard for motion (which makes sense). Timelapse does work fine but I end up with thousands of images to wade through.

Suppose what I would love ideally is for it to take a full resolution image every 1 to 2 seconds during periods where there is motion sensed. Perhaps there is a way to pass a command to trigger timelapse images into the FIFO file when motion is detected?

Thanks!
PPi
When motion is detected then it is the motion start and stop actions in the scheduler that determine what is done. So for video it is normally ca 1 to start the video and ca 0 to stop it at the end of motion.

You can put any action or sequence of actions for start and stop. For timelapse tl 1 will start a sequence and tl 0 will stop it. You can either set the time lapse period up separately or you can put it in the commands if you wanted different intervals at different times of the day. So tv 40;tl 1 would change period to 4 seconds and start a time lapse sequence.

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

Re: RPi Cam Web Interface

Tue May 23, 2017 8:28 am

frankieforceps wrote:Hi btidey,

First I have to commend you on your continued support for the RPI Web interface on this forum. Its really an amazing thing you have been providing free support for everybody, for so long. Good job and thankyou!

I have a question for you if you dont mind. I've been using the web interface to stream frames to another PC for a computer vision application. I'm capturing the frames using OpenCV on the PC. I'm using the web address http://<IP>/html/cam_pic_new.php to capture the mpeg stream. One thing I've noticed is that I'm receiving many duplicate images. Around 2-3 copies of each image. I think OpenCV is copying the posted image as fast as it can, and captures a new image once a new image is updated on the server. So far I've been annotating the images and removing duplicates using OCR on the frame captures.

I'm wondering if there is an easier way to detect when a new image is posted, to avoid processing duplicate images. Have any ideas?

Thanks so much!
The cam_pic_new.php produces the stream by adding in new data with a delay between each frame. The normal web interfaces adjusts the delay in order to adjust the overall preview frame rate (controlled by the preview divider ratio).

If you do not include a delay parameter in the call then it will use a delay of 10mSec which is why you get multiple frames.

To adjust the delay include it in the URL like

Code: Select all

 http://<IP>/html/cam_pic_new.php?pDelay=25000
to set the delay to 25mSec

The same principle applies when fetching single frames using cam_pic.php where pDelay enforces a delay on each fetch to control the rate.

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

Re: RPi Cam Web Interface

Wed May 24, 2017 7:41 pm

btidey wrote:
quavoce wrote:I've done some more testing with the following results:
  • Fresh install of full Jessie (2017-04-10-raspbian-jessie.img). apt-get update and dist-upgrade. Installed latest RPi Cam v6.3.6. Left all cam settings at default except for 20 sec video split and monitor mode. Failed with same error at the 20 sec split point.
  • Fresh install of Jessie Lite (2016-09-23-raspbian-jessie-lite.img). apt-get update but no software upgrade. Latest RPi Cam v6.3.6. Left all cam settings at default except for 20 sec video split and monitor mode. Failed with same error at the 20 sec split point.
  • I'll try to find an older version of Jessie and test that too.
  • Update - tried 2016-03-18-raspbian-jessie.img but no luck there either.
Could you try setting Buffer to say 2000?

The error you report is when the split stops and starts the camera feeds up in quick succession. Having the buffer changes the timing somewhat.
It works!!!! Super Amazing Stuff!! Thank you very much Robert!
I've been wanting to say thank you for all your hard work on this project and the support you give via a Donation for a while now, so please accept my thanks via the donation I've just sent your way.
(in case anyone else wishes to say thank you, the link is here: http://elinux.org/RPi-Cam-Web-Interface#Special_thanks)
When I get chance over the next few days, I'll write up instructions on how to use this continuous recording and motion detection feature on the Wiki. (for a quick reference see the original post here: viewtopic.php?p=1153590#p1153590)
Thanks again!!

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

Re: RPi Cam Web Interface

Wed May 24, 2017 8:08 pm

quavoce wrote: It works!!!! Super Amazing Stuff!! Thank you very much Robert!
I've been wanting to say thank you for all your hard work on this project and the support you give via a Donation for a while now, so please accept my thanks via the donation I've just sent your way.
(in case anyone else wishes to say thank you, the link is here: http://elinux.org/RPi-Cam-Web-Interface#Special_thanks)
When I get chance over the next few days, I'll write up instructions on how to use this continuous recording and motion detection feature on the Wiki. (for a quick reference see the original post here: viewtopic.php?p=1153590#p1153590)
Thanks again!!
Good to hear that. (Thanks very much for donation)

My theory is that closing and opening the camera interface very quickly during the split was causing the problem. It may be that the MMAL was still internally tidying up during the close.

Now I know what triggers it I'll play around a bit more to see if I can make it work even with buffer set to zero. One thought is just to put a short delay in between the close and the re-open when splitting.

KC3HUB
Posts: 8
Joined: Fri Apr 28, 2017 12:27 pm

Re: RPi Cam Web Interface

Sun May 28, 2017 9:18 pm

I'm wondering what the process would be to create a page that watches streams from two (or more) pi cameras running on the same wireless at-home router but in different locations.

Also really interested in installing one in my car like in Europe how they all seem to have dash cams that manage to capture rogue meteors! Is there a warning for me to consider when the car shuts down? I imagine that Splits are the way to go so footage is recorded and stored in transit but then what of the very final bit?

User avatar
jbeale
Posts: 3688
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: RPi Cam Web Interface

Sun May 28, 2017 11:30 pm

I've done a lot of R-Pi camera projects and building your own dashcam might be a fun project but if you don't have a considerable number of hours available, you're probably better off getting a "real" dashcam. See also: https://dashcamtalk.com/ Personally I like this one: https://dashcamtalk.com/mobius/ because the image quality is good, it is very compact, and you can exchange the lithium battery with a supercapacitor, so it won't quit after a few years in service like any non-capacitor dashcam eventually will.

KC3HUB
Posts: 8
Joined: Fri Apr 28, 2017 12:27 pm

Re: RPi Cam Web Interface

Sun May 28, 2017 11:45 pm

jbeale wrote:I've done a lot of R-Pi camera projects and building your own dashcam might be a fun project but if you don't have a considerable number of hours available, you're probably better off getting a "real" dashcam. See also: https://dashcamtalk.com/ Personally I like this one: https://dashcamtalk.com/mobius/ because the image quality is good, it is very compact, and you can exchange the lithium battery with a supercapacitor, so it won't quit after a few years in service like any non-capacitor dashcam eventually will.
Yeah, that is pretty hard to beat since it's got audio, a good image, is $85, etc. etc. Just thinking. I'm really enthusiastic about these RPi Cams and the Interface. Thanks for the tip. :) That must be quite a little board the Mobius has.

I think another piece of answer as to viewing multiple streams comes from a question up above too by Frankieforeceps with "using the web address http://<IP>/html/cam_pic_new.php to capture the mpeg stream." So I'll putter around with that too.

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

Re: RPi Cam Web Interface

Mon May 29, 2017 8:01 am

KC3HUB wrote:I'm wondering what the process would be to create a page that watches streams from two (or more) pi cameras running on the same wireless at-home router but in different locations.
I use IP Cam View Pro on my phone to watch multiple video streams at the same time: http://elinux.org/RPi-Cam-Web-Interface ... Smartphone

KC3HUB
Posts: 8
Joined: Fri Apr 28, 2017 12:27 pm

Re: RPi Cam Web Interface

Mon May 29, 2017 2:20 pm

Thanks quavoce! I should have known to keep reading that long install page! Incredible thing, CWI.

As an aside, I'm meeting with too many little hangups and issues on the Zero W without trimming settings way, way back. I figure on sticking with the 3b. Maybe if the Zero W gets more ram it will better juggle the features available.

bengray97
Posts: 1
Joined: Thu Jun 01, 2017 8:22 pm

Re: RPi Cam Web Interface

Thu Jun 01, 2017 8:41 pm

quavoce wrote:
quavoce wrote:I would like to enable HTTPS on each of my RPiCam's so that the username and password aren't transmitted in the clear. I have successfully done this using the instructions below but there's one problem I just can't figure out.

The problem is I can't play back recorded video on an iPhone/iPad when HTTPS is enabled... It works fine from a desktop, just not my mobile devices.

Could someone follow my instructions below to see if you see the same issue, either on Android or iPhone as well please?

Initial Setup
1. Fresh Jessie image (used 2016-09-23-raspbian-jessie.img)
2. Install RPi Cam:

Code: Select all

sudo apt-get update
sudo apt-get upgrade
git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.git
cd RPi_Cam_Web_Interface
chmod u+x *.sh
./install.sh
3. Configured using html as subfolder, Apache, Port 80, user/pass blank
4. Connected to RPi Cam from desktop and recorded a normal and motion detected video.
5. Connected to RPi Cam via iPhone/iPad and browsed to Download Video and Images, and verified I can play back recorded videos.

Configure HTTPS
1. Set up and configure self-signed certificate: (accept the defaults)

Code: Select all

sudo mkdir /etc/apache2/ssl
sudo openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -out /etc/apache2/ssl/server.crt -keyout /etc/apache2/ssl/server.key
2. Prep Apache to use SSL

Code: Select all

sudo a2enmod rewrite
sudo a2enmod ssl
3. Edit /etc/apache2/sites-available/raspicam.conf (use nano instead of vim if preferred)

Code: Select all

sudo vim /etc/apache2/sites-available/raspicam.conf
4. Change <VirtualHost *:80> to <VirtualHost *:443>
5. Add the following lines just before </VirtualHost>

Code: Select all

SSLEngine On
SSLCertificateFile    /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
It should look like this:

Code: Select all

<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www
        <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride All
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn

        SetEnvIf Request_URI "/cam_pic.php$|/status_mjpeg.php$" dontlog
        CustomLog ${APACHE_LOG_DIR}/access.log common env=!dontlog
        SSLEngine On
        SSLCertificateFile    /etc/apache2/ssl/server.crt
        SSLCertificateKeyFile /etc/apache2/ssl/server.key
</VirtualHost>
6. Restart Apache

Code: Select all

sudo service apache2 restart
7. Visit the RPi Cam webpage again, ensuring you start with https://
8. Try to play back the recorded videos on your mobile.

Does this work ok for anyone else?
Ok, so the issue turns out to be the iPhone/iPad being too zealous on the encryption being correct. It seems they just don't like self-signed certs. See here for more info: http://stackoverflow.com/questions/4660 ... -uiwebview

The solution then is to generate official Certificate Authority signed certs for your domain name. I found a free method to do this using https://letsencrypt.org/ and I can confirm video playback now works over HTTPS!

I now have an end-to-end solution involving a reverse proxy, https encryption, Dynamic DNS, and multiple RPi Cams. If anyone is interested in a full set of detailed instructions for the proxy and https config, let me know and I'll post them on here.

I'm also close to having a functioning PHP Userform Login for RPi Cam so that we don't have to use htaccess for login. Again, if there's interest let me know and I'll post what I have working so far. (I'm using pre-made PHP Login files from GitHub, but it creates an account via SMTP so want to avoid that if I can)
Quavoce,

Thank you for the good walk-through on how to set up a self-signed cert! Did you ever post a detailed account of setting an official authority cert for your domain as well as setting up the PHP Userform Login? If not I'd be very interested in one or if there is a good tutorial out there, let me know. I'd appreciate any direction. Thanks. :D

Return to “Camera board”