Bromley47
Posts: 15
Joined: Sat May 16, 2020 9:00 am

Re: RPi Cam Web Interface

Sun May 31, 2020 5:34 pm

I have tried quite a few times to follow the instructions to save images (media) to an external NAS without much success. I have followed the details in CIFS / Samba / Windows Share but when I get to

'Enter these lines, substituting msusername and mspassword with your Windows credentials.

username=msusername
password=mspassword'.

What does it mean by credentials? i have entered my username and password for the PC which I am using and then completed the rest of the instructions. After a reboot it still shows the SD card (32GB) in the Files section when you click on 'Download Videos and Images'.

The SD card is showing as 99.4 % full, even when I delete the videos and images recorded?

I have also tried my username and password for the WDMyCloud (NAS) as advised in GitHub 'Use SMB for saving files o #1492'

user=<your username on NAS>
password=<your password on the NAS>

This worked when I was using Motioneye but not with RPi Cam Web Interface.

But that could be down to my Nooby credentials....lol

Any help much appreciated.

nicolap8
Posts: 523
Joined: Mon Mar 13, 2017 9:45 pm

Re: RPi Cam Web Interface

Tue Jun 02, 2020 2:36 pm

@Bromley47 Here a possible solution.
1) stop camera, so it will not write new images

2) empty, if necessary, /var/www/html/media (it's the default folder, use appropriate folder)

3) launch "sudo raspi-config" and in "Boot Options" configure B2 Wait for Network at Boot to YES! This is necessary.

4.1) write a file named "/etc/nas" with the credentials (1):
username=WINDOWSUSER
password=WINDOWSPASSWORD

4.2) mount your remote folder (change the names in bold):
sudo mount.cifs //MYWINDOWSMACHINENAME/REMOTE FOLDER /var/www/html/media -o cred=/etc/nas,uid=www-data,gid=www-data

5) try to save an image (a single one is sufficient) using the web interface, if it's working (you see the image in the remote server...) you can proceed to nect point. If not... there is an error somewhere.

6) edit file "/etc/rc.local" and put the same command you used at pont 4.2 BEFORE the "#START RASPIMJPEG SECTION"

7) reboot :-)


(1) this is a security hole: create a new user only for this access and let that it can access only this share!

Bromley47
Posts: 15
Joined: Sat May 16, 2020 9:00 am

Re: RPi Cam Web Interface

Wed Jun 03, 2020 4:19 am

Many thanks for your message nicolaps8 but as I am nooby to linux and this camera would it be possible or you to show the code for what you suggest above?

It would be of great help - cheers

Bromley47
Posts: 15
Joined: Sat May 16, 2020 9:00 am

Re: RPi Cam Web Interface

Wed Jun 03, 2020 8:44 am

Do I mount the folder in /etc/fstab? once I have done that do I need to run 'mount -av' and do I need to do in raspberry root?

Bromley47
Posts: 15
Joined: Sat May 16, 2020 9:00 am

Re: RPi Cam Web Interface

Wed Jun 03, 2020 8:46 am

And do I need to put in the IP address for the WD Drive somewhere?

nicolap8
Posts: 523
Joined: Mon Mar 13, 2017 9:45 pm

Re: RPi Cam Web Interface

Wed Jun 03, 2020 8:48 am

Bromley47 wrote:
Wed Jun 03, 2020 8:44 am
Do I mount the folder in /etc/fstab? once I have done that do I need to run 'mount -av' and do I need to do in raspberry root?
You're really a noob!
Read my message, follow it... do not follow others in the middle!
N

Bromley47
Posts: 15
Joined: Sat May 16, 2020 9:00 am

Re: RPi Cam Web Interface

Wed Jun 03, 2020 9:40 am

Sorry for being a noob - we all have to start somewhere..!!

Your instructions:-

4.1) write a file named "/etc/nas" with the credentials (1): HOW DO I MAKE FILE ?
username=WINDOWSUSER
password=WINDOWSPASSWORD

4.2) mount your remote folder (change the names in bold):

HOW DO I MOUNT? JUST COPY AND PASTE INTO TERMINAL WINDOW? THEN SAYS NO SUCH FILE OR DIRECTORY? I ASSUME MYWINDOWSMACINE NAME IS NAME OF PC i AM USING? DO I LEAVE 'FOLDER' IN THE LINE OR IS THAT PART OF THE 'REMOTE' NAME?

sudo mount.cifs //MYWINDOWSMACHINENAME/REMOTE FOLDER /var/www/html/media -o cred=/etc/nas,uid=www-data,gid=www-data


5) try to save an image (a single one is sufficient) using the web interface, if it's working (you see the image in the remote server...) you can proceed to nect point. If not... there is an error somewhere.

6) edit file "/etc/rc.local" and put the same command you used at pont 4.2 BEFORE the "#START RASPIMJPEG SECTION"

7) reboot :-)

Again my apologies for troubling you but I have been working on this for most of the lockdown..!!

nicolap8
Posts: 523
Joined: Mon Mar 13, 2017 9:45 pm

Re: RPi Cam Web Interface

Wed Jun 03, 2020 10:15 am

Bromley47 wrote:
Wed Jun 03, 2020 9:40 am
Sorry for being a noob - we all have to start somewhere..!!
Your are using a Linux system so you have to STUDY from start this Operating System, there are a lot of good training in Internet. Thius is that a good nood have to do ;)
4.1) write a file named "/etc/nas" with the credentials (1): HOW DO I MAKE FILE ?
I can't (and I do not want) explain this here: if you are not able to make a text file, you have to learn this in advance...
4.2) mount your remote folder (change the names in bold):

HOW DO I MOUNT? JUST COPY AND PASTE INTO TERMINAL WINDOW? THEN SAYS NO SUCH FILE OR DIRECTORY? I ASSUME MYWINDOWSMACINE NAME IS NAME OF PC i AM USING? DO I LEAVE 'FOLDER' IN THE LINE OR IS THAT PART OF THE 'REMOTE' NAME?

sudo mount.cifs //MYWINDOWSMACHINENAME/REMOTE FOLDER /var/www/html/media -o cred=/etc/nas,uid=www-data,gid=www-data
You're right, "REMOTE FOLDER" had to be without the space, my bad.
The command to mount a folder is "mount", preceeded by "sudo" because it has to be used with "root" permissions.
But, I must repeat myself, you have to learn the basis of Linux before trying to do something because Linux is not Windows: it's not designed for a common user, "they" hate users! :evil:

Bromley47
Posts: 15
Joined: Sat May 16, 2020 9:00 am

Re: RPi Cam Web Interface

Thu Jun 04, 2020 9:13 am

Thanks for your help - I am getting my limited brain resources around Linux and I got it to work in the end. images now being saved on USB hard drive connected to my PC with loads of capacity.

My next task is to somehow change those confusing file names that are not that easy to read (date and time) but that's another story.

Again - cheers for your patience

nicolap8
Posts: 523
Joined: Mon Mar 13, 2017 9:45 pm

Re: RPi Cam Web Interface

Thu Jun 04, 2020 9:47 am

Bromley47 wrote:
Thu Jun 04, 2020 9:13 am
Thanks for your help - I am getting my limited brain resources around Linux and I got it to work in the end. images now being saved on USB hard drive connected to my PC with loads of capacity.

My next task is to somehow change those confusing file names that are not that easy to read (date and time) but that's another story.

Again - cheers for your patience
The image names are in file /etc/raspimjpeg
It's a text file, near the end you will find "image_path", modify with caution!

Bromley47
Posts: 15
Joined: Sat May 16, 2020 9:00 am

Re: RPi Cam Web Interface and USB drive mount

Sun Jun 07, 2020 8:51 am

I have a RPi Zero W and official RPi camera - as a security camera sited outside my house - I have managed to get the RPi to download images to a 1 TB USB Hard drive plugged into my Windows 10 PC. (with loads of help from this forum).

However (and there is always an however) the terminal shows the drive mounted when I do a 'sudo mount -av', but it does not stay mounted. At some stage (this time in the night) it decides to only see the 32 GB SD card in the RPi and saves images to that. Which obviously is going to get full soon and was the whole idea of the USB Drive.

If I click on the 'download images and videos' button it takes ages to respond and when it goes to the file page I can see that the SD card capacity is shown not the USB Drive. If I then do 'sudo mount -av' again it comes back to saving on the USB Drive, although at the moment its only showing jpeg thumbnails and not mp4 videos. But that may be tied in with the drive changing.

The question is how do I get the USB Drive to stay continuously mounted and not revert to the SD card?

Any help appreciated.

nicolap8
Posts: 523
Joined: Mon Mar 13, 2017 9:45 pm

Re: RPi Cam Web Interface and USB drive mount

Sun Jun 07, 2020 11:15 am

Bromley47 wrote:
Sun Jun 07, 2020 8:51 am
I have a RPi Zero W and official RPi camera - as a security camera sited outside my house - I have managed to get the RPi to download images to a 1 TB USB Hard drive plugged into my Windows 10 PC. (with loads of help from this forum).

However (and there is always an however) the terminal shows the drive mounted when I do a 'sudo mount -av', but it does not stay mounted. At some stage (this time in the night) it decides to only see the 32 GB SD card in the RPi and saves images to that. Which obviously is going to get full soon and was the whole idea of the USB Drive.

If I click on the 'download images and videos' button it takes ages to respond and when it goes to the file page I can see that the SD card capacity is shown not the USB Drive. If I then do 'sudo mount -av' again it comes back to saving on the USB Drive, although at the moment its only showing jpeg thumbnails and not mp4 videos. But that may be tied in with the drive changing.

The question is how do I get the USB Drive to stay continuously mounted and not revert to the SD card?

Any help appreciated.
The problem can be in Win10... It often go in stand-by, suspend, etc and shuts down the peripherals.

regfixit
Posts: 1
Joined: Tue Jun 16, 2020 12:46 pm

Re: RPi Cam Web Interface

Tue Jun 16, 2020 12:50 pm

Is there a way to start and stop the timelapse, but keeping the file index numbers the same.
Basically I want to do a timelapse during the daytime over several days.
If I start and stop the timelapse each day I get a new set of files for each day.
Is there a way to in effect pause the timelapse so it continues on with same numbering scheme when resumed ?

nicolap8
Posts: 523
Joined: Mon Mar 13, 2017 9:45 pm

Re: RPi Cam Web Interface

Tue Jun 16, 2020 5:16 pm

regfixit wrote:
Tue Jun 16, 2020 12:50 pm
Is there a way to start and stop the timelapse, but keeping the file index numbers the same.
Basically I want to do a timelapse during the daytime over several days.
If I start and stop the timelapse each day I get a new set of files for each day.
Is there a way to in effect pause the timelapse so it continues on with same numbering scheme when resumed ?
You have to change the image file names (edit /etc/raspimjpeg) so you can use only the date+time to sort the images.

praefectum
Posts: 4
Joined: Wed May 06, 2020 6:19 pm
Location: Italy

Re: RPi Cam Web Interface

Fri Jun 19, 2020 7:18 am

Hello to everyone!

I'm trying to setup my RPi 0W with official camera and interface with motion detection and it's up and running, so first of all thank you for that!

However I'm not so experienced in Linux coding and I'm running into issues when dealing with the macros to send an email notification. I'm sorry to ask again for help on this topic, but I've been reading the complete tread, I've been banging my head for days, I've tried everything it was suggested in other posts, but still it's not working and I feel it's a very stupid and noob error somewhere.

The end_box script works when manually executed from command line (as pi with sudo or as www-data without sudo) and I receive the email with message and attachment, but it doesn't work when launched from the web interface (with manual recording or motion detection).
I attached below what I did, can maybe someone help me please?

So, I first configured msmtp in /etc/. I'm using a service gmail account shared with the NAS to send notifications to my principal gmail account. I was able to activate an app password to avoid gmail restrictions on less secure apps:

Code: Select all

# Set default values for all following accounts.
defaults
port 587
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

account gmail
host smtp.gmail.com
from myserviceadress@gmail.com
auth on
user myservicename
password myapppassword

# Set a default account
account default : gmail
I then configured Mutt with the system Muttrc in /etc/ adding the following instructions at the end:

Code: Select all

set sendmail="/usr/bin/msmtp"
set use_from=yes
set realname="myservicename"
set from=myserviceadress@gmail.com
set envelope_from=yes
set copy = no
And finally I modified the end_box.sh script I found here on the forum as it follows::

Code: Select all

#!/bin/bash

# Maximum file sizes for sendmail
MAXSIZE=25000000 # gmail max filesize

# email recipients...replace <myname> with your username
RCVR1=myprincipaladress@gmail.com

# get thumb filename
list=( $1*.th.jpg )
thumb="${list[-1]}"

# Get file size of original video
FILESIZE=$(stat -c%s "$1")

#check file size
if [ $FILESIZE -gt $MAXSIZE ]
then

#too big...send thumb
mutt -a $thumb -s "Motion detected - Thumb" -- $RCVR1 < message_toobig.txt
else

#size is right...mailing file
mutt -a $1 -s "Motion detected - Video" -- $RCVR1 < message_sizeok.txt
fi

exit
Script permissions are as follows:

Code: Select all

-rwxrw-r-- 1 www-data www-data  751 Jun 18 22:28 end_box.sh
-rw-r--r-- 1 www-data www-data   33 Jun 19 08:24 error_hard.sh
-rw-r--r-- 1 www-data www-data  148 Jun 18 11:06 message_sizeok.txt
-rw-r--r-- 1 www-data www-data  229 Jun 18 11:07 message_toobig.txt
-rw-r--r-- 1 www-data www-data 1218 Jun 19 08:24 startstopX.sh
-rw-r--r-- 1 www-data www-data   42 Jun 19 08:24 test.sh
And here's the last execution attempt as captured by scheduleLog.txt:

Code: Select all

{2020/06/19 09:06:57} Capturing started
{2020/06/19 09:07:03} Capturing stopped
{2020/06/19 09:07:03} Add /var/www/html/media/vi_0039_20200619_090657.mp4 to Box Queue at pos 1
{2020/06/19 09:07:03} DEBUG 3
{2020/06/19 09:07:03} Start boxing /var/www/html/media/vi_0039_20200619_090657.h264 to /var/www/html/media/vi_0039_20200619_090657.mp4 Queue pos 1
{2020/06/19 09:07:05} Finished boxing /var/www/html/media/vi_0039_20200619_090657.mp4 from Box Queue at pos 1
{2020/06/19 09:07:05} Executing macro /var/www/html/macros/end_box.sh "/var/www/html/media/vi_0039_20200619_090657.mp4"  
{2020/06/19 09:07:06} Removed item from Box Queue

praefectum
Posts: 4
Joined: Wed May 06, 2020 6:19 pm
Location: Italy

Re: RPi Cam Web Interface

Tue Jun 23, 2020 1:52 pm

praefectum wrote:
Fri Jun 19, 2020 7:18 am
Hello to everyone!

I'm trying to setup my RPi 0W with official camera and interface with motion detection and it's up and running, so first of all thank you for that!

However I'm not so experienced in Linux coding and I'm running into issues when dealing with the macros to send an email notification. I'm sorry to ask again for help on this topic, but I've been reading the complete tread, I've been banging my head for days, I've tried everything it was suggested in other posts, but still it's not working and I feel it's a very stupid and noob error somewhere.

The end_box script works when manually executed from command line (as pi with sudo or as www-data without sudo) and I receive the email with message and attachment, but it doesn't work when launched from the web interface (with manual recording or motion detection).
I attached below what I did, can maybe someone help me please?
I quote myself because I found out what the problem was and it was indeed very stupid... Long story short, always use complete file locations. In my case in end_box.sh

Code: Select all

#!/bin/bash

# Maximum file sizes for sendmail
MAXSIZE=25000000 # gmail max filesize

# email recipients...replace <myname> with your username
RCVR1=myprincipaladress@gmail.com

# get thumb filename
list=( $1*.th.jpg )
thumb="${list[-1]}"

# Get file size of original video
FILESIZE=$(stat -c%s "$1")

#check file size
if [ $FILESIZE -gt $MAXSIZE ]
then

#too big...send thumb
mutt -a $thumb -s "Motion detected - Thumb" -- $RCVR1 < /var/www/html/macros/message_toobig.txt
else

#size is right...mailing file
mutt -a $1 -s "Motion detected - Video" -- $RCVR1 < /var/www/html/macros/message_sizeok.txt
fi

exit

Return to “Camera board”