yeme
Posts: 7
Joined: Sun Jul 28, 2013 9:29 pm

Re: RPi Cam Web Interface

Sat Dec 21, 2013 1:34 pm

jbeale wrote:
yeme wrote:I too have this streaming with Chrome. I am trying to have my video surveillance software pick up this video stream and need help with the path of the displayed stream on the Pi. From my review of this thread, I am trying: /run/shm/mjpeg/ with no success. Any suggestions?
If your software is not running on the Pi, you need a URL to access the stream over the network. For example, whatever your Chrome browser is pointed to. Or are you remotely accessing your Pi's filesystem via Samba, etc.?

I don't know exactly what your software expects but I think this implementation relies on the remote web browser running a javascript .js file that keeps hitting the Apache server to reload each new JPEG image. The R-Pi just captures and saves the jpeg image from the camera and also hosts the webserver, but it does not send out a "stream" of images on its own, without the continual action of the javascript code.
That makes some sense to me. I am using Blue Iris software on my Win7 PC and it normally looks for a RTSP stream which I have working from the Pi camera . This setup is another attempt to utilize and test the RPi camera for me. The BI software has an option for mjpeg stream but I believe it needs a mpg file and not js.

Thanks for the reply

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

Re: RPi Cam Web Interface

Sat Dec 21, 2013 3:19 pm

It seems the banding is fps-related. It's getting dark now, when using 'Auto' the banding is bad, using 'Sports' it's very bad and using 'Night' it's gone.

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

Re: RPi Cam Web Interface

Sat Dec 21, 2013 3:57 pm

poing wrote:It seems the banding is fps-related. It's getting dark now, when using 'Auto' the banding is bad, using 'Sports' it's very bad and using 'Night' it's gone.
I believe the banding can be caused by RF interference. If there are RF pulses at a specific repetition rate, where and how big the bands appear would be related to the scanline readout rate, which is in turn related to FPS and shutter speed. If the Pi is running a wifi link, that is a nearby source of RF, and with MJPEG going out it would be in frequent use... are you running on ethernet, or wireless? If you need to use wifi, you might try a USB extender cable to place the wifi adapter farther away from the camera and the ribbon cable. A shorter ribbon cable might also help, I know you can get 10 cm and 5 cm versions: http://www.ebay.com/itm/Raspberry-Pi-Ca ... 1241155328
Last edited by jbeale on Sat Dec 21, 2013 4:06 pm, edited 1 time in total.

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

Re: RPi Cam Web Interface

Sat Dec 21, 2013 4:06 pm

Although I'm connected through Ethernet the Pi does have a WiFi adapter configured as access point. But I'm using the Pi in this setup since 'the beginning of time' and connected the camera when it got available. I used the exact same setup with the RPi Cam setup in this thread since it came online. Only after the latest update, which made the real time display smoother, the banding was suddenly visible. Before I had no banding but a stuttering display.

I can try to yank out the wifi adapter tomorrow, too dark right now for anything except 'Night', but I doubt it will make a difference. Nobody else seeing banding?

NB, I use a rev2 model B but with 256MB memory.

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

Re: RPi Cam Web Interface

Sat Dec 21, 2013 4:11 pm

Ok, I can imagine the software update probably changed the timing of processor activity relative to when frames were taken, so it is possible there is some interference from the noise on the R-Pi board itself to the camera? Can you try placing the camera further away from the Pi, especially if you have the ribbon cable folded up tight to the board? You might also try a different power supply, although I don't know why that would be related to a software update (unless you also happened to change the power supply at the same time as the update- but I guess not, if it's been the exact same setup all along.)

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

Re: RPi Cam Web Interface

Sat Dec 21, 2013 4:39 pm

Power supply is the same and the ribbon cable is about flat, camera maximum distance away. The setup is taped to the attic window, didn't change anything except the update. Never had any interference problems with any Pi/camera setup, including other power supplies, cameras, Pies, WiFi dongles, you name it.

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

Re: RPi Cam Web Interface

Sat Dec 21, 2013 5:34 pm

Just did an update of raspimjpeg
but it gave me this:

Code: Select all

pi@raspberrypi ~ $ raspimjpeg --version
Error: Invalid arguments
But if I take a look in /var/www then there is standing a file "Version.txt" and in that file is standing "1.0".
So I think it worked.

Another thing I remarked is when I set the exposure to "Night" then the smoothness is gone but I guess that's normal ?
And CPU is still around 33%.

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

Re: RPi Cam Web Interface

Sat Dec 21, 2013 5:49 pm

I'm using 'Night' right now (it's dark over here, just street lights), meaning the shutter speed is about 1/4sec. Thus there's no 30fps smoothness possible. But the CPU indicated by top is between 0.7 and 1.0 for raspimjpeg. Apache uses around 60%, depending on when you look.

Not sure but when I re-flashed the card I got the lower % for raspimjpeg.

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

Re: RPi Cam Web Interface

Sat Dec 21, 2013 7:58 pm

When I did the update by the 2nd RPi then the cpu was also a lot lower.

Problem is that it's not so easy to change the sd card because of the location of the PI.

User avatar
rleyden
Posts: 75
Joined: Thu Jun 14, 2012 2:17 am

Re: RPi Cam Web Interface

Sun Dec 22, 2013 6:35 pm

andlinux wrote:Just did an update of raspimjpeg
but it gave me this:

Code: Select all

pi@raspberrypi ~ $ raspimjpeg --version
Error: Invalid arguments
But if I take a look in /var/www then there is standing a file "Version.txt" and in that file is standing "1.0".
.
I had the same experience with "--version" and version.txt after a fresh update. Everything seemed fine but I did a precautionary full removal (following the instructions in the 1st post) and then a fresh installation including all the updating (which took a surprisingly long time even though the last update had been a day or so earlier). Now "raspimjpeg --version" answers version 1.0.

I will also note that the system has worked flawlessly for 2 days now, camera on, recording intermittently. No banding observed.
Edit/update: After 5 days, web page shows only Apache info, ssh connects for login but disconnects when login name is entered, "disconnected by remote server", before requesting password.
Last edited by rleyden on Tue Dec 24, 2013 5:25 pm, edited 1 time in total.

AJB2K3
Posts: 215
Joined: Sun Aug 11, 2013 3:25 pm

Re: RPi Cam Web Interface

Sun Dec 22, 2013 6:48 pm

Can't access the website to download it direct to the raspi on btinternet!
Bt pop up saying that the address can't be found but yet I can access it from my Macbook Pro?
Back in the old days, we were smarter then the technology.
Nowadays technology makes us look like villages fools in front of the children!

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

Re: RPi Cam Web Interface

Sun Dec 22, 2013 6:57 pm

rleyden wrote: I will also note that the system has worked flawlessly for 2 days now, camera on, recording intermittently. No banding observed.
Hmmm, mine crashed again after 24+ hours and I still got the banding. When time permits I'll try different Pi, camera and power supply etc.

midnight1111
Posts: 20
Joined: Sun Apr 07, 2013 4:13 am

Re: RPi Cam Web Interface

Mon Dec 23, 2013 3:10 am

I tried this out. It works well. I have a couple of questions: Can I change the resolution to full HD? Can multiple browsers watch the video?
Thx.
M-

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

Re: RPi Cam Web Interface

Mon Dec 23, 2013 3:15 am

Multiple browsers can watch the video but your framerate will likely drop (bandwidth limit). You can try full HD, but you can't get MJPEG at full HD at any reasonable framerate due to bandwidth limits both internal and external to the R-Pi board. If you want to stream full HD you need to use H.264 compression. However note that the "record video" button allows you to record full 1920x1080 HD locally on the Pi (to h264 format), while also viewing the MJPEG live at the reduced resolution. The recorded video can be downloaded and also previewed, and the preview window can be resized as large as your screen allows. Maybe that could be full HD, I don't know as my computer screen is not 1920 pixels across.

buzzai
Posts: 7
Joined: Sat Oct 12, 2013 2:01 pm

Re: RPi Cam Web Interface

Mon Dec 23, 2013 6:56 pm

Awesome tool! 8-)
I plan to use is to stream a low-res preview ana analyze it with motion.
Motion detection will trigger a high-res capture until motion goes away, using the 'ca' command.

This runs quite well, but no stable at the moment (I ran the installer today again to get the latest version of everything).
I keep running into two errors:
sudo raspimjpeg -w 640 -h 352 -d 1 -q 25 -of /dev/shm/mjpeg/cam.jpg -cf /var/www/FIFO -sf /var/www/status_mjpeg.txt
MJPEG streaming, ready to receive commands
*** glibc detected *** raspimjpeg: free(): invalid pointer: 0xb6fa0878 ***
and
Capturing started

Sometimes they happen with the first 'ca 1' command sent, sometimes after a while...
Anybody who can help?
Thanks!
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 0xea6b20 (EINVAL)
mmal: mmal_connection_create: format not set on input port
Error: Could not create connecton camera -> video converter

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 27101
Joined: Sat Jul 30, 2011 7:41 pm

Re: RPi Cam Web Interface

Mon Dec 23, 2013 8:00 pm

We just released a new firmware that has native MJPEG support in the encoder component, which means raspivid will be able to output MPJG directly. This may we be of use here. I may need to update raspivid to have a command line parameter to select it - not sure if that was in the firmware upgrade.

http://www.raspberrypi.org/forum/viewto ... ad#p473591
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

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

Re: RPi Cam Web Interface

Mon Dec 23, 2013 8:32 pm

Thanks a lot James. But I suspect the link should be http://www.raspberrypi.org/forum/viewto ... 75#p471907

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

Re: RPi Cam Web Interface

Sat Dec 28, 2013 2:02 pm

I was wondering if it's also possible to watch the stream on VLC ?

hystrix
Posts: 57
Joined: Mon Jan 07, 2013 12:44 pm

Re: RPi Cam Web Interface

Sun Dec 29, 2013 4:10 pm

This is an excellent project. Many thanks for sharing.

I currently operate a Pi based trail camera with PIR motion sensing to capture still images and a video of pre-determined length (e.g. 40 seconds). (Details here: http://www.afraidofsunlight.co.uk/weath ... e=trailcam)

Can someone give me some guidance on how I might integrate a PIR Motion Sensor into this web cam interface, so I can always see a preview of my webcam in a browser, and when motion is detected, video will be recorded.

Many thanks.

buzzai
Posts: 7
Joined: Sat Oct 12, 2013 2:01 pm

Re: RPi Cam Web Interface

Sun Dec 29, 2013 5:08 pm

Nice bird pictures!

The RPi camera web interface 'talks' to raspimjpeg using a pipe, located at /var/www/FIFO by default.
If you do echo 'ca 1' > /var/www/FIFO raspimjpeg starts recording a movie and echo 'ca 0' > /var/www/FIFO stops it again (see https://raw.github.com/silvanmelchior/u ... piMJPEG.md at the bottom of the page for all commands possible).
You can configure motion to send commands through this pipe when motion is detected and when motion goes away:

Edit /etc/motion/motion.conf

Code: Select all

on_event_start echo 'ca 1' > /var/www/FIFO
on_event_end echo 'ca 0' > /var/www/FIFO
Do a sudo service motion restart to activate the configuration.

The starting & stopping of video recording can be monitored through the web interface as buttons get enabled & disabled.

hystrix
Posts: 57
Joined: Mon Jan 07, 2013 12:44 pm

Re: RPi Cam Web Interface

Mon Dec 30, 2013 10:46 am

buzzai wrote:Nice bird pictures!

The RPi camera web interface 'talks' to raspimjpeg using a pipe, located at /var/www/FIFO by default.
If you do echo 'ca 1' > /var/www/FIFO raspimjpeg starts recording a movie and echo 'ca 0' > /var/www/FIFO stops it again (see https://raw.github.com/silvanmelchior/u ... piMJPEG.md at the bottom of the page for all commands possible).
You can configure motion to send commands through this pipe when motion is detected and when motion goes away:

Edit /etc/motion/motion.conf

Code: Select all

on_event_start echo 'ca 1' > /var/www/FIFO
on_event_end echo 'ca 0' > /var/www/FIFO
Do a sudo service motion restart to activate the configuration.

The starting & stopping of video recording can be monitored through the web interface as buttons get enabled & disabled.
Many thanks for the info!

I now have this working by modifying my Python script that monitors the GPIO for motion detected by the PIR sensor, using the following code:

Code: Select all

subprocess.call ("echo 'ca 1' > /var/www/FIFO", shell=True)
time.sleep(40)
subprocess.call ("echo 'ca 0' > /var/www/FIFO", shell=True)
Now all I need to do is to get a live feed to my website :)

lazzjazz
Posts: 1
Joined: Mon Dec 30, 2013 4:55 pm

Re: RPi Cam Web Interface

Mon Dec 30, 2013 8:50 pm

Hi every one!
This forum site is great :D Special thanks to Sylvan for starting this project.
I am a sheep and cattle farmer and my special interest is breeding working sheepdogs. I am part of a project which wants to improve our understanding of the hereditary working characteristics of these dogs by documenting and quantifying their behaviour when working animals. I realised that filming from the air would greatly increase the quality of our documentation. Like you, Sylvan, I have a Quadcopter and have stated filming using a friends GoPro camera. There are no live streaming possiblities however, hence my excitement about this project.
The big problem, as I see it, with using Rpi on a Quadcopter is the weight.
We want a flight time of 15 mins with a full payload and the cost of a Copter carrying this weight becomes prohibitive.
Your input on this would be greatly appreciated.
I am a novice at programing but have managed to get my Rpi up and running on remote using Wlan and Tightvnc. Had just started trying to get the camera working on remote when I discovered you lot :D :D
Thanks again for some great work

apple1554
Posts: 8
Joined: Fri Jan 03, 2014 2:49 pm

Re: RPi Cam Web Interface

Fri Jan 03, 2014 2:54 pm

Sadly, i can't get this to work... I'm a complete linux-noob but i know how to paste code :P

Ok, seems i forgot a bunch of text. The attachment is how it looks, the images seem "empty" as i can not open them - same with videos.

Second edit, i didn't fix it but i found the problem - there's something broken with the pi. My second one works just fine
Attachments
rpi.PNG
rpi.PNG (34.85 KiB) Viewed 13168 times

toadleyb
Posts: 21
Joined: Sat Jan 04, 2014 11:05 pm

Re: RPi Cam Web Interface

Sat Jan 04, 2014 11:08 pm

Is it possible to save the images and videos to a windows share that I have mounted on my raspberry pi? I have an htpc which is always on and would rather save to it (much more disk space).

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

Re: RPi Cam Web Interface

Sun Jan 05, 2014 10:11 pm

Hello, I'm back from my holidays! I updated the interface with a few new features:
- Trigger video record by motion detection
- Timestamp added to filename
- New autostart-option: Motion detection

To update, run the instructions in my first post and check if "raspimjpeg --version" and "/var/www/Version.txt" show you version 2.0. I the update didn't work, maybe a fresh installation helps.

I stop the developement now and start a long-time test, because you posted about some crashes after a a few days.

Return to “Camera board”