Pangu
Posts: 78
Joined: Tue Dec 18, 2012 5:30 pm

Re: RPi Cam Web Interface

Thu Mar 06, 2014 3:58 pm

I have solved it like that:

Code: Select all

sudo vi /etc/motion/motion.conf
modified line 517:

From:

Code: Select all

on_event_end echo 'ca 0' > /var/www/FIFO
To:

Code: Select all

on_event_end echo 'ca 0' > /var/www/FIFO && mv /var/www/media/* /mydestdir
That worked so far, so I will write a small bash script which will do the rsync part. But I have realized an important issue: the process "motion" is run under "root" account (!) How could we change that?

User avatar
Marcos.Scholl
Posts: 31
Joined: Wed Feb 05, 2014 7:12 pm
Location: Brasil

Re: RPi Cam Web Interface

Thu Mar 06, 2014 8:54 pm

unnamed7 wrote:http://grid.stronazen.pl/rpi/rpi-cam-visual-pack.zip
just upload contents of .zip to var/www and delete default index.html
i haven't really tested it in all browsers but it should be ok since it's based on twitter bootstrap.
hope you like it :)
Only I do not have access to this file?

Code: Select all

403 Forbidden 
Access to this resource on the server is denied!
Is it because I am from another continent?
unnamed7, could check?

robm99
Posts: 6
Joined: Sat Feb 22, 2014 1:20 am

Re: RPi Cam Web Interface

Thu Mar 06, 2014 10:25 pm

unnamed7 wrote:http://grid.stronazen.pl/rpi/rpi-cam-visual-pack.zip
just upload contents of .zip to var/www and delete default index.html
i haven't really tested it in all browsers but it should be ok since it's based on twitter bootstrap.
hope you like it :)
I tried this tonight, and it looks like a really nice UI. Only one problem, which I hadn't anticipated, is that once the files are in place, the old HTML index page no longer works! The page shows, but the images are not shown and there is no control.

Can anyone tell me either:
(a) how to get the PHP and HTML versions of the control page to co-exist (I'm happy to have one link to "index.php" and another to "index2.html" or something)
or (b) how to add the timelapse script and code into the PHP control page?

Thanks

Pangu
Posts: 78
Joined: Tue Dec 18, 2012 5:30 pm

Re: RPi Cam Web Interface

Fri Mar 07, 2014 8:04 am

@robm: yes, that's true. I also miss that, because I did create the index2.html and it doesn't work anymore. But unnamed7 told that in his explanation. He said, that index.html has to be removed to allow his visual pack addon to work. Hopefully he will help us when reading this posting how to allow side-by-side with our old index-files

The other question you had relating to timelapse function. I have done it like this:

- open index.php and search for the lines:

Code: Select all

...
        <div class="row">
          <div class="col-xs-12 controls">
              <div class="btn-group">
              <button id="video_button" class="btn btn-default"></button>
              <button id="image_button" class="btn btn-default"></button>
              <button id="md_button" class="btn btn-default"></button>
              <button id="halt_button" class="btn btn-default"></button>
              </div>
        </div>
        </div>
right after that you add the timelapse function, and it looks like that in summary:

Code: Select all

        <div class="row">
          <div class="col-xs-12 controls">
              <div class="btn-group">
              <button id="video_button" class="btn btn-default"></button>
              <button id="image_button" class="btn btn-default"></button>
              <button id="md_button" class="btn btn-default"></button>
              <button id="halt_button" class="btn btn-default"></button>
              </div>
        </div>
        </div>
<script>
var lapsrunning=0;
var autoStopTime=0;
var lapsTimer;
var stopTimer;
function setlaps(){
   if(lapsrunning==0){
      document.getElementById('startstopLaps').innerHTML='Stop Timelapse';
      var e=document.getElementById("lapsInterval");
      lapsrunning=e.options[e.selectedIndex].value;
      lapsrunning=parseFloat(lapsrunning)*1000;
 
[...]and so on... until [...]

<br>Time left: <span id='test'>0</span> minutes
<script>calcStop();</script>

    </div>
    <script src="https://code.jquery.com/jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="script.js"></script>
  </body>
</html>
This is the end of index.php

What I really miss from the timelapse function is ==> it should generate a video instead of separate image files. Is that somehow possible?

poing
Posts: 1131
Joined: Thu Mar 08, 2012 3:32 pm

Re: RPi Cam Web Interface

Fri Mar 07, 2014 8:45 am

Sounds to me it's not really an 'add-on pack' if it removes original functionality. Form over function, not my cup of tea.

Creating a video should be easy with ffmpeg; Why not figure out the proper command and then I can easily put it in the TimeLapse function ;-)

Another thing I'm planning on is to create a Cookie system that keeps the settings over sessions and page changes plus a way where a button press disables the camera in the page and launches raspistll/vid directly with either the used settings or a pre defined string of options. In the case of timelapses that would enable closing down the webpage while all options would be available taking images and videos.

Sadly I will have little time the coming month, so it might take a while :-)

Pangu
Posts: 78
Joined: Tue Dec 18, 2012 5:30 pm

Re: RPi Cam Web Interface

Fri Mar 07, 2014 9:10 am

anyone can explain, why this RPI Cam method by silvianmelchor cannot show/record videos with full FOV possible?? If I use raspistill or raspivid I get a huge FOV, but all videos that are done through this interface are not complete. There are details missing. Is there no fix for that and if so why?

User avatar
Marcos.Scholl
Posts: 31
Joined: Wed Feb 05, 2014 7:12 pm
Location: Brasil

Re: RPi Cam Web Interface

Sat Mar 08, 2014 3:28 am

Hello
How do I change the resolution of the image?
I tried changing the rc.local, the raspimjpeg command, but I keep getting a 1920x1080 video at 25fps.

I wish I had a video with resolution as 800x600 and 25fps, because when I stream between two RPI, which receives the transmission, keeps the CPU at 100% due to the Broswer.

Is this possible?

Why when I change the raspimjpeg command, I see no difference in the image?
Sorry for my english.

silvanmelchior
Posts: 76
Joined: Mon Nov 25, 2013 5:56 pm

Re: RPi Cam Web Interface

Sat Mar 08, 2014 5:13 pm

Update: It's now possible to view the full sesor area as preview with 15 fps. I added a new button "change mode to image". In image mode, you can't record videos, but you see the right preview for the images. The update is online, so just run the installer again and let me know if it works.

poing
Posts: 1131
Joined: Thu Mar 08, 2012 3:32 pm

Re: RPi Cam Web Interface

Sat Mar 08, 2014 5:41 pm

Doesn't seem to work... All I get is a broken image and 5 empty buttons...And no way to revert back to the previous install :-(

Bill2k
Posts: 13
Joined: Sat Nov 16, 2013 9:26 pm

Re: RPi Cam Web Interface

Sat Mar 08, 2014 8:44 pm

This project is amazing! I couldn't believe how easy it was to get it up and running by following the instructions. I have made a few changes to this project by following other peoples advice in this thread. Thanks to everyone I have been able to change the size of the streaming video and set a username and password to open the web interface. Now I would like to do more modifications and I'm hoping some of you can point me in the right direction.

My main goal is to create a new directory every day and put any of the motion videos of that day into the new directory.
I was going to use crontab to create the new directory at midnight with the new days date as the directory's name.
How could I get motion to put the video file into the new directory?

Also... if someone could explain what the code in rc.local is doing, that would be great!

Thanks in advanced,
Bill

silvanmelchior
Posts: 76
Joined: Mon Nov 25, 2013 5:56 pm

Re: RPi Cam Web Interface

Sat Mar 08, 2014 9:48 pm

@poing: Maybe it helps if you reboot the Pi, empty the cash of your browser and reload the page.

poing
Posts: 1131
Joined: Thu Mar 08, 2012 3:32 pm

Re: RPi Cam Web Interface

Sat Mar 08, 2014 10:56 pm

I did the reboot and refreshing Chrome didn't work, but a reinstall did the trick. Before raspimjpeg wasn't running... Thanks, new mode is very helpful!

cica
Posts: 9
Joined: Mon Mar 03, 2014 1:45 am
Location: Boston, MA USA

Re: RPi Cam Web Interface

Sun Mar 09, 2014 1:16 pm

silvanmelchior wrote:Update: It's now possible to view the full sesor area as preview with 15 fps. I added a new button "change mode to image". In image mode, you can't record videos, but you see the right preview for the images. The update is online, so just run the installer again and let me know if it works.
I switched your code to run on nginx and removed apache. Is there a way to update the project without doing a full reinstall?

xzanfr
Posts: 18
Joined: Wed Jun 20, 2012 12:52 pm

Re: RPi Cam Web Interface

Sun Mar 09, 2014 9:46 pm

I've had this working really well over the last few weeks - a great piece of work!.
Since upgrading today to the latest install the night exposure seems to have lost a lot of sensitivity. Has something been changed in the program relating to the night exposure since the previous version?
Cheers
Gary

poing
Posts: 1131
Joined: Thu Mar 08, 2012 3:32 pm

Re: RPi Cam Web Interface

Sun Mar 09, 2014 10:06 pm

I think something changed in raspistill/vid itself, not so much in raspimjpeg. I too get less night exposure.

xzanfr
Posts: 18
Joined: Wed Jun 20, 2012 12:52 pm

Re: RPi Cam Web Interface

Sun Mar 09, 2014 10:19 pm

poing wrote:I think something changed in raspistill/vid itself, not so much in raspimjpeg. I too get less night exposure.
Thanks for the confirmation, poing. I'll see if there is some way round the raspistill/raspivid issue as i's pretty useless for my purposes now.

LEdgeley
Posts: 3
Joined: Wed Jan 11, 2012 12:14 pm

Re: RPi Cam Web Interface

Sun Mar 09, 2014 11:33 pm

I needed an alternative solution to creating a timelapse using the RPi Cam Web Interface - I want users to be able to see live video from the camera over the web, but also to automatically save an image every 10 seconds, without any user interaction.

Because I want the timelapse to begin on boot, and continue irrespective of whether any clients are viewing the web page, modifying the javascript was out. Instead, a (very) simple bash script came to the rescue:

Code: Select all

while true; do
        echo "im" > /var/www/FIFO
        sleep 10
done
This sends an "im" command to the FIFO buffer every ten seconds, causing an image to be saved into /var/www/media. I've added an entry to the crontab so that the script gets run at bootup and it's working pretty well.

poing
Posts: 1131
Joined: Thu Mar 08, 2012 3:32 pm

Re: RPi Cam Web Interface

Mon Mar 10, 2014 12:34 am

You should make it save to the ram disk (/run/shm or something I think, forgot the exact name) for otherwise you'll wear out the SD card with too many writes.

jarrah31
Posts: 125
Joined: Wed Oct 10, 2012 10:16 am

Re: RPi Cam Web Interface

Mon Mar 10, 2014 11:25 am

silvanmelchior wrote:Update: It's now possible to view the full sesor area as preview with 15 fps. I added a new button "change mode to image". In image mode, you can't record videos, but you see the right preview for the images. The update is online, so just run the installer again and let me know if it works.
Thank you Silvanmelchior, the full FOV works really well and it makes a huge difference being able to see more with the camera now!!

User avatar
Trixster
Posts: 261
Joined: Sat Jul 07, 2012 3:53 pm

Re: RPi Cam Web Interface

Mon Mar 10, 2014 3:38 pm

Now we just need to find a way to make this FOV the default.

jarrah31
Posts: 125
Joined: Wed Oct 10, 2012 10:16 am

Re: RPi Cam Web Interface

Mon Mar 10, 2014 8:14 pm

Trixster wrote:Now we just need to find a way to make this FOV the default.
If you have the camera auto-starting after a reboot, then you can add this command to the /etc/rc.local file after the raspimjpeg command:

Code: Select all

echo 'pm' > /var/www/FIFO
So it would look like this:

Code: Select all

raspimjpeg -w 512 -h 288 -wp 512 -hp 384 -d 1 -q 25 -of /dev/shm/mjpeg/cam.jpg -cf /var/www/FIFO -sf /var/www/status_mjpeg.txt -vf /var/www/media/video_%04d_%04d%02d%02d_%02d%02d%02d.mp4 -if /var/www/media/image_%04d_%04d%02d%02d_%02d%02d%02d.jpg -p -ic $image -vc $video > /dev/null &

echo 'pm' > /var/www/FIFO

exit 0
If you want to add more than one command to change options such as rotating the image, you'll need a sleep command between them:

Code: Select all

echo 'pm' > /var/www/FIFO
sleep 1
echo 'ro 270' > /var/www/FIFO
Last edited by jarrah31 on Mon Mar 10, 2014 8:20 pm, edited 1 time in total.

jarrah31
Posts: 125
Joined: Wed Oct 10, 2012 10:16 am

Re: RPi Cam Web Interface

Mon Mar 10, 2014 8:19 pm

xzanfr wrote:
poing wrote:I think something changed in raspistill/vid itself, not so much in raspimjpeg. I too get less night exposure.
Thanks for the confirmation, poing. I'll see if there is some way round the raspistill/raspivid issue as i's pretty useless for my purposes now.
Same here, night exposure mode is really dark now compared to how it was before. :(

jarrah31
Posts: 125
Joined: Wed Oct 10, 2012 10:16 am

Re: RPi Cam Web Interface

Mon Mar 10, 2014 8:20 pm

I've started up a wiki page on eLinux.org as a possible place to store all the useful bits of code and information found in this thread so that anyone can create an account and add content. Given that there's so much good stuff in here it would take ages to read up on 15 posts to find it so if you think it's a good idea please do contribute:

http://elinux.org/RPi-Cam-Web-Interface

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

Re: RPi Cam Web Interface

Mon Mar 10, 2014 8:38 pm

Marcos.Scholl wrote:How do I change the resolution of the image?
I tried changing the rc.local, the raspimjpeg command, but I keep getting a 1920x1080 video at 25fps.
I wish I had a video with resolution as 800x600 and 25fps, because when I stream between two RPI, which receives the transmission, keeps the CPU at 100% due to the Broswer.
I am not sure if you mean resolution of the MJPEG stream served through the Apache2 webserver, or the H.264 video saved locally to SD card. The resolution specified in the /etc/rc.local is the MJPEG stream (individual JPEG images) that shows up as the live image in the browser window, and not the 1920x1080 H.264 format video recorded on the Pi. As far as I know the H.264 video resolution is set in the raspimjpeg code so you would need to recompile it to change that. But if you are streaming MJPEG, by default the resolution is only 512 x 288. I've never tried viewing the MJPEG stream on a second R-Pi, even that relatively low resolution might well run the CPU to 100% in a browser. I cannot believe the R-Pi web browser can display MJPEG at 1920x1080 25 fps because the ARM is not fast enough for that.

Here is the source code to raspimjpeg: https://github.com/silvanmelchior/userl ... spiMJPEG.c

User avatar
Mrbcsimpson
Posts: 17
Joined: Tue Jan 07, 2014 9:29 pm
Location: Lincolnshire, UK
Contact: Website

Re: RPi Cam Web Interface

Mon Mar 10, 2014 9:03 pm

I appear to be getting an issue whereby after a day or so the motion detections stops. It shows that it is still running and I can switch it on and off. I can still take photos, record video manually. Can I troubleshoot this somehow?

Return to “Camera board”