Jakein
Posts: 7
Joined: Thu Jul 24, 2014 9:36 am

Re: RPi Cam Web Interface

Sun Nov 09, 2014 1:08 am

Hi everyone. Anyone knows if it's possible to display a live preview of the camera on the Pi itself while simultaneously streaming MJPEG? I've been struggling for days now trying to get this working, I'd really appreciate any help.

kishoor
Posts: 1
Joined: Sun Nov 09, 2014 8:49 am

Re: RPi Cam Web Interface

Sun Nov 09, 2014 8:58 am

I would like to start the RPi Cam web interface upon motion triggered using my PIR motion sensor. I have tried using subprocess to start the "./RPi_Cam_Web_Interface_Installer.sh start" inside a python script(view attachment), however it returned error(attachment 2). Any ideas how i can proceed with this?
Attachments
Untitled2.jpg
Untitled2.jpg (54.85 KiB) Viewed 6456 times
Untitled.jpg
Untitled.jpg (32.18 KiB) Viewed 6456 times

User avatar
DougieLawson
Posts: 39539
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RPi Cam Web Interface

Sun Nov 09, 2014 2:45 pm

You need to have your current working directory (cd command) set to where that installer script lives before starting the process.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

yelsewno
Posts: 2
Joined: Thu Nov 13, 2014 3:22 pm

Re: RPi Cam Web Interface

Thu Nov 13, 2014 3:46 pm

I'd like to disable the annotation completely with the raspimjpeg config file. Is this possible?

I've tried removing the annotation line from the file, but that breaks things. Any advice is appreciated, thanks!

aleksarias
Posts: 1
Joined: Thu Nov 13, 2014 6:18 pm

Re: RPi Cam Web Interface

Thu Nov 13, 2014 6:20 pm

Is there a way to "stop camera" as soon as a user exits out of the RPI web interface?
I'm unsure where to insert code to do this... index.php?

Thanks,
Alex

ptrbrown
Posts: 1
Joined: Thu Nov 13, 2014 10:55 pm

Re: RPi Cam Web Interface

Thu Nov 13, 2014 10:59 pm

First of all I would like to say a big thank you to author of this project. This is exactly what I have been looking for.

I have one question though - is it possible to record video from pi camera with sound from usb microphone? That would be just perfect.

newlife2014
Posts: 1
Joined: Sun Nov 16, 2014 6:22 am

Re: RPi Cam Web Interface

Sun Nov 16, 2014 6:29 am

Hi,

I am using RPI B plus with camera module ... When I click "motion detection start" with the default values then I see no videos are getting recorded even though there is a motion.. Please advise....

thanks in advance...

Note : I am a first time user....

dobrescu
Posts: 1
Joined: Sun Nov 16, 2014 8:56 am

Re: RPi Cam Web Interface

Sun Nov 16, 2014 8:59 am

Does anyone have any idea why after setting "MP4Box false" in /etc/raspimjpeg, the videos are no longer readable? The extension is still mp4 instead of .h264 and any player including MP4Box are seing it as a "Corrupted Data in file/stream".
Thoughts?

Fab4Space
Posts: 2
Joined: Tue Nov 11, 2014 4:24 pm

Re: RPi Cam Web Interface

Mon Nov 17, 2014 6:40 pm

Hello all,
I have used the awesome raspimjpeg from Silvan for my high altitude balloon project with RPI. It allowed me to capture at 10fps full frame the whole video of the near space flight.
Image
More video and pictures can be seen here:
http://fab4space.com
I have modified the source code of raspimjpeg (source available here:http://fab4space.com/src/RaspiMJPEG.c) to have 2 encoding pipelines:
  • * one for the video encoding with a mmal resizer from 2592x1944 to 1400x1050 , connected to the h264 encoder at 10 fps
    * one full frame jpeg encoder at 2592x1944 each 50 frames (one picture every 5 seconds)
Thanks to this picture/video concurrent system I was able to record the frame of the burst of the balloon at 27000m altitude!:
Image

Fabrice

andlinux
Posts: 18
Joined: Fri Dec 13, 2013 12:08 pm
Location: Belgium

Re: RPi Cam Web Interface

Wed Nov 19, 2014 5:35 pm

I want to embed this stream on my webpage, so I can see if my chickens are inside and then I can close the door.
The problem I have is that it looks great on my desktop pc, but when I want to view it on my smartphone then the view is cut off. (see images)

Smartphone:
Screenshot_2014-11-18-18-06-21.png
Screenshot_2014-11-18-18-06-21.png (41.74 KiB) Viewed 5992 times
Desktop PC:
PC.jpg
PC.jpg (40.08 KiB) Viewed 5991 times
So my question is how can I make this a responsive design ?
I have asked this question on another forum and people were helping me but nobody had the right answer.

Here is the code I have now:

Code: Select all

<html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content = "width=device-width,initial-scale=1" />
        <title>WebIOPi | Kippenhok</title>
        <script type="text/javascript" src="/webiopi.js"></script>
        <script type="text/javascript">
        webiopi().ready(function() {

                webiopi().setFunction(0,"out");
                webiopi().setFunction(1,"out");

                var content, button;
                content = $("#content");

                button = webiopi().createGPIOButton(0,"Deur");
                content.append(button); // append button to content div

                button = webiopi().createGPIOButton(1,"Licht");
                content.append(button); // append button to content div

                webiopi().refreshGPIO(true);


        });
        </script>
        <style type="text/css">
                button {
                        display: block;
                        margin: 5px 5px 5px 5px;
                        width: 160px;
                        height: 45px;
                        font-size: 24pt;
                        font-weight: bold;
                        color: black;
                }

                input[type="range"] {
                        display: block;
                        width: 160px;
                        height: 45px;
                }

                .LOW {
                        background-color: White;
                }

                .HIGH {
                        background-color: Green;
                }

                #container {
                    width: 100%;
                }

                #content {
                    margin: 0 auto;
                    max-width: 640px;

                    text-align: center;
                }

                #content button {
                    margin-left: auto;
                    margin-right: auto;
                }

                .video  {
                    display: block;
                    position: relative;
                    width: 100%;
                    height: 0;
                    padding-bottom: 75%;
                }

                .video iframe {
                    position: absolute;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    border: 0;
                }
      </style>
</head>
<body>
<div id="container">
    <div id="content">
        <div class="video">
            <iframe src="http://192.168.1.13/clean.php" scrolling="yes"></iframe>
        </div>
    </div>
</div>
</body>
</html>

User avatar
Mettauk
Posts: 238
Joined: Mon Dec 10, 2012 12:40 pm
Location: Zarg

Re: RPi Cam Web Interface

Sat Nov 22, 2014 6:51 pm

I want to include temperature and humidity on the RPi Cam Web Interface page.

I can get readings via python via ssh. It would be nice if it auto updated on the RPi cam page but I would be very happy for it to simply load the latest readings when the page loads.

I am not very familiar with python or php but know some html and I can't find a straight forward solution to get the "python call" on to the web page. I've managed to get the sensor working but don't know a "simply" way to put readings on a web page?

The small python script that checks the sensor and prints current temp and humidity is below (From Adafruit DHT)

Code: Select all

#!/usr/bin/python
#simpletest.py
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# edit

import Adafruit_DHT
sensor = Adafruit_DHT.DHT22
pin = 25
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)

if humidity is not None and temperature is not None:
	print 'Temp={0:0.1f}*C  Humidity={1:0.1f}%'.format(temperature, humidity)
else:
	print 'Failed to get reading. Try again!'
This might be a bit off topic so sorry if I am.
As humans we have been the same for a very very long time, technology changes how we do... not who we are as people.

visavis88
Posts: 1
Joined: Sun Nov 23, 2014 7:37 pm

Re: RPi Cam Web Interface

Sun Nov 23, 2014 7:50 pm

Can somebody advise me on how to constantly record video without interruption?
When I record video for 10 seconds, and after that immediately want to record another one for 10 seconds and so on, it takes about 4-6 seconds to convert .h264 to .mp4. If I want to record 1 minute video, it takes much longer to convert that video. So I can't use approach of constantly converting. Plus it uses a lot of CPU.

My thought is to record video without converting it to mp4, but how to do that in RaspiMJPEG?

User avatar
Mettauk
Posts: 238
Joined: Mon Dec 10, 2012 12:40 pm
Location: Zarg

Re: RPi Cam Web Interface

Mon Nov 24, 2014 12:13 am

Follow the instructions shown in the original post re motion detection, that will stop the post production bit....
Motion Detection: To configure motion detection, edit /etc/motion/motion.conf. Motion detection is not active while the old video is converted to mp4. To prevent this, stop boxing the h264-video after recording by changing "MP4Box true" to "MP4Box false" in /etc/raspimjpeg and restart your RPi.
As humans we have been the same for a very very long time, technology changes how we do... not who we are as people.

liderbug
Posts: 189
Joined: Sat Oct 08, 2011 4:47 pm

Re: RPi Cam Web Interface

Mon Nov 24, 2014 4:18 am

visavis88 wrote:Can somebody advise me on how to constantly record video without interruption?
When I record video for 10 seconds, and after that immediately want to record another one for 10 seconds and so on, it takes about 4-6 seconds to convert .h264 to .mp4. If I want to record 1 minute video, it takes much longer to convert that video. So I can't use approach of constantly converting. Plus it uses a lot of CPU.

My thought is to record video without converting it to mp4, but how to do that in RaspiMJPEG?
I'm using RasPiMjpeg to feed Zoneminder on another computer. I've tried every ZM option and only one, FILE, gives me a error free delivery [ the only way I can think to show it 1111111111111........11101111111..........11111111111011111111....] 100's of good frames then 1 partial? short?

Code: Select all

while [ 1 ]
do
  curl -s "http://raspi/cam.jpg" > /mnt/shm/cam~.jpg
  mv /mnt/shm/cam~.jpg  /mnt/shm/cam.jpg
  usleep 10000
done
That seems to work 100% - for me - my hardware?? my software?? You don't say what your end product will be. But [/run][/mnt]/shm/cam.jpg will be updated aproz 8-10/sec. You could save the jpg's off to a subdir with a circular schema cam.%4d.jpg for 10,000 images and use ffmpeg to create your .mov or .whatever.

punktea
Posts: 21
Joined: Thu Jul 18, 2013 8:55 am

Re: RPi Cam Web Interface

Tue Nov 25, 2014 11:25 am

visavis88 wrote:Can somebody advise me on how to constantly record video without interruption?
When I record video for 10 seconds, and after that immediately want to record another one for 10 seconds and so on, it takes about 4-6 seconds to convert .h264 to .mp4. If I want to record 1 minute video, it takes much longer to convert that video. So I can't use approach of constantly converting. Plus it uses a lot of CPU.

My thought is to record video without converting it to mp4, but how to do that in RaspiMJPEG?
- To record video without converting to mp4, make sure you have "MP4Box false" in /etc/raspimjpeg. Depending on the size of your SD card, you can record several hours and after you stop recording, download the file onto your PC where you can convert to mp4 format so you can view it with a player. You will find out that RPi will crash when SD card gets filled and you will have skipped frames every now and then. To fix that problem, create an XFS partition and save your video on that partition.
- To constantly record video into mp4 without interruption and still stay within reasonable limits for CPU usage, it can be done but it takes a fair amount of work to get it implemented.
1. configure raspimjpeg to save video in a fifo (i.e. video_path /var/www/vfifo)
2. install ffmpeg
3. ffmpeg -y -r 30 -i /var/www/vfifo -vcodec copy -map 0:0 -an -reset_timestamps 1 -f segment -segment_format mp4 -segment_time 300 "/var/www/media/video_%03d.mp4"
The above command will save segments in mp4 format in 300 sec increments.
Because the CPU will not be able to handle the load of both apache and ffmpeg, you need to ssh into RPI and stop apache while ffmpeg is running.

el_cid
Posts: 27
Joined: Thu Jun 05, 2014 2:29 pm
Location: Switzerland

Re: RPi Cam Web Interface

Wed Nov 26, 2014 5:14 pm

punktea wrote: - To record video without converting to mp4, make sure you have "MP4Box false" in /etc/raspimjpeg. Depending on the size of your SD card, you can record several hours and after you stop recording, download the file onto your PC where you can convert to mp4 format so you can view it with a player. You will find out that RPi will crash when SD card gets filled and you will have skipped frames every now and then. To fix that problem, create an XFS partition and save your video on that partition.
.
This sentence, "create an XFS partition and save your video on that partition" is very easily written... ;) Have you tried it? Because I tried it, I changed the locations of the files in /etc/raspiconfig to the locations on the xfs-partition, and displaced the fifo-file to the xfs-partition. But then it wasn't possible anymore to make pictures or record a video, the buttons just didn't seem to react.

I mean, I really hope you tried it and suceeded. Because then you could tell us how... :)

punktea
Posts: 21
Joined: Thu Jul 18, 2013 8:55 am

Re: RPi Cam Web Interface

Thu Nov 27, 2014 8:32 am

el_cid wrote: This sentence, "create an XFS partition and save your video on that partition" is very easily written... ;) Have you tried it? Because I tried it, I changed the locations of the files in /etc/raspiconfig to the locations on the xfs-partition, and displaced the fifo-file to the xfs-partition. But then it wasn't possible anymore to make pictures or record a video, the buttons just didn't seem to react.

I mean, I really hope you tried it and suceeded. Because then you could tell us how... :)

You probably have not changed the ownership of the xfs partition from root to www-data, preventing RPI Cam Web interface to be able to write to that partition. Here are step by step instructions:

Suppose you have already created an xfs partition using fdisk and this partition is /dev/mmcblk0p3

# mkdir /xfsmedia
# mount /dev/mmcblk0p3 /xfsmedia
# chown www-data /xfsmedia
# cd /var/www
Make sure you have saved all the media files that are in /var/www/media
# rm -rf media
# ln -s /xfsmedia media

You should not have to change /etc/raspimjpeg but double-check it has this line:
video_path /var/www/media/video_%04d_%04d%02d%02d_%02d%02d%02d.mp4

(I have several Pi running RPi Cam Web Interface with xfs partition flawlessly for hours on end. XFS is now the default file system for Red Hat Enterprise Linux so I just hope that raspbian will soon adopt xfs as its default file system and we will not have to muck around with this)

el_cid
Posts: 27
Joined: Thu Jun 05, 2014 2:29 pm
Location: Switzerland

Re: RPi Cam Web Interface

Thu Nov 27, 2014 11:10 am

You are my precious! ;)

Thank you, I will try this as soon as possible.

Just another question, you wrote something of "dropped frames". I am experiencing a lot of dropped frames in my recorded videos, so much that for example a clip showing 2 minutes of a clock lasts only 1:55 or so. Did you also experience things like this? Did you manage to reduce this behaviour considerably with the xfs-partition?

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

Re: RPi Cam Web Interface

Thu Nov 27, 2014 12:59 pm

Hello, how do I turn off the red light on the camera?
I disabled with the following parameter:

Code: Select all

disable_camera_led=1
Inserted in my /boot/config.txt, its works to switch of the camera led.

punktea
Posts: 21
Joined: Thu Jul 18, 2013 8:55 am

Re: RPi Cam Web Interface

Thu Nov 27, 2014 8:21 pm

el_cid wrote:You are my precious! ;)

Thank you, I will try this as soon as possible.

Just another question, you wrote something of "dropped frames". I am experiencing a lot of dropped frames in my recorded videos, so much that for example a clip showing 2 minutes of a clock lasts only 1:55 or so. Did you also experience things like this? Did you manage to reduce this behaviour considerably with the xfs-partition?
I experienced exactly like what you described, and I tried various brands of Class 10 SD cards. Following a tip in this forum, I put the videos on xfs partition and no longer has dropped frames as far as I can tell. I had 3 cameras shooting same scene and was able to sync up the video clips perfectly.

trdough
Posts: 14
Joined: Tue Nov 11, 2014 12:16 am

Re: RPi Cam Web Interface

Sun Nov 30, 2014 9:48 pm

This is absolutely wonderful!! thanks so much for posting this! I have a question tho.

I have been following this tutorial: http://www.instructables.com/id/Web-Con ... y-Pi-GPIO/

and now I have followed yours. I would absolutely love to be able to merge the two. Anytime I do anything to the source code for the http://www.instructables.com/id/Web-Con ... y-Pi-GPIO/, it breaks.

I am making a door unlocking system where you can log in online and look to see who is at your front door then you can remotely unlock your door. I have both tutorials working separately but would like to have both on the same page if possible. Any ideas?

Thanks!!

User avatar
Lombra
Posts: 67
Joined: Tue Sep 16, 2014 12:41 am
Location: Sweden

Re: RPi Cam Web Interface

Thu Dec 04, 2014 6:17 pm

How well can I expect this to run on a model A+? Framerate, latency? I do not yet own a Pi, and am not very well versed in its capabilities. :) Maybe nothing in particular in the A+ model that would limit it compared to B+?

Also a more generic question. As far as I understand, many of the available Pi streaming solutions involves rapidly taking photos, rather than really recording video. Is this true? If so, why is it done this way?

I'm looking for a more low level solution than this (instead of a whole ready made server and webpage), but I'm probably going to try this out first. From the few videos I've seen showcasing this application the performance seems decent enough compared to other solutions.

AKhlghatyan
Posts: 1
Joined: Mon Mar 03, 2014 8:08 pm

Re: RPi Cam Web Interface

Sun Dec 07, 2014 12:02 pm

Hello

Is it possible to add digital zoom buttons on web interface?

Thanks

el_cid
Posts: 27
Joined: Thu Jun 05, 2014 2:29 pm
Location: Switzerland

Re: RPi Cam Web Interface

Mon Dec 08, 2014 1:01 pm

Lombra wrote:How well can I expect this to run on a model A+? Framerate, latency? I do not yet own a Pi, and am not very well versed in its capabilities. :) Maybe nothing in particular in the A+ model that would limit it compared to B+?

Also a more generic question. As far as I understand, many of the available Pi streaming solutions involves rapidly taking photos, rather than really recording video. Is this true? If so, why is it done this way?
The RPi Cam Web Interface is no problem for the A+. I have used the RPi Cam Web Interface with the B+ and the A+. I couldn't notice a difference between the two using the Web Interface. The loss of frames I talked about in my previous post I expererienced both with the B+ and the A+.

What I have read from earlier in this thread MJPEG (used by the RPI Cam Web Interface; = taking pictures quite fast, 10 per second in this case, to give the illusion of a video) because MJPEG brings you very low latency, below a second. .h264 video streaming has high latency, which can go up to 10s.

trdough
Posts: 14
Joined: Tue Nov 11, 2014 12:16 am

Re: RPi Cam Web Interface

Thu Dec 11, 2014 5:24 pm

Im having problems with the buttons now. Under the camera image there are 5 buttons, record video, etc. At this time they do not do anything. How can I make them record video and take pictures?

Return to “Camera board”