RPIRaspberry Pi Cam Web interface
A nice project by silvanmelchior that deploys a web server, dvr like, multi target streaming server. needNeeds more infoinformation
Streaming with mjpg is supported by almost all browsers, including IE 6Internet Explorer 6. AllotA lot of cameras used before h264H.264 used hardware mjpg, which essentially dumped jpgJPEG files as fast as possible into a folder while mjpg read the file into a buffer and deleted them. Some devices could achieve up to 25fps25 fps and even if you had a bad connection you would get at least 1fps1 fps.
Support for mjpg was dropped in HD cameras because the jpgJPEG file just got too large to stream over the internetInternet and h264H.264 is a much faster and better quality protocol.
Since we have no way to broadcast h264H.264 using the camera module nativly this seems like a viable fallback ...
It is pretty much instant, but don't expect to get more than 1.5 fps fps. This is down to raspistill
being extremely SLOOOW! Using the time-lapse function set to 100ms100 ms which should give us 10fps10 fps does not work because raspistill
just chokes up and has serious performance issues within it selfitself.
- changeChange
/tmp
to use RAM for speed /etc/default/tmpfs
- change RAMTMP=yes
(This is an effort to increase fps, but raspistill just cannot keep with its self.)
- Reboot
- apt-get install git
- apt-get install libjpeg8-dev
- apt-get install libv4l-dev
- apt-get install imagemagick
- cd
/usr/src
, mkdir mjpg-streamer, cd mjpg-streamer ...
git clone https://github.com/engine12/mjpg-streamer.git
make USE_LIBV4L2=true clean all
- OPTIONAL If you have errors
sudo ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
sudo ln -s /usr/include/lib4l2.h /usr/include/linux/lib4l2.h
- insideInside the makefile, comment out all the plugins except for input_file and output_http and do make again. I had allota lot of issues here.
- copyCopy the binary,
mjpg_streamer
and its plugins input_*.so
and output_*.so
to /usr/local/bin
otherwise. Otherwise, run it direct from the src directory.
- Optional end
mkdir /tmp/stream
raspistill -w 640 -h 480 -q 5 -o /tmp/stream/pic.jpg -tl 100 -t 9999999 -th 0:0:0 &
LD_LIBRARY_PATH=./ ./mjpg_streamer -i "input_file.so -f /tmp/stream" -o "output_http.so -w ./www"
(run this where the binary and plugins are)
- gotoGoto
http://<IP-address>:8080
- Here are a few option, enjoy "live" streaming the old fashioned way ... supported by most browsers - modern, old and experimental.
I struggled to compile it for about for 5 hours.... sigh, but I think I will use this as I can access the stream from any phone and any browser. JustI just have to wait till we get better drivers... anotherAnother year or two. :(
No matter what quality I try, I get no faster or no slower than 1fps1 fps using stream. I used 720p and 1080p and only image quality gets better, but fps is no difference on LAN. I suppose smaller settings will help with WAN/3G or other radio transmissions.
raspistill writes the image to a single file. This could be a bottle neckbottleneck. It writes the file, mjpg strreamer reads it and deletes it causing a blocking I/O, so raspistill cannot write to the file.
The only thing I can think of is using raspivid piped into ffmpegFFmpeg that will create jpgJPEG files for us - I need to try this and possibly itsit's much faster than usign raspistill. I managed to get 25 fps fps at a shocking quality, and it was delayed about 10 seconds... tweakingTweaking the settings got me about 3 fps fps, but 100% cpuCPU. No hardware is being used to process the video stream...
raspivid -w 640 -h 480 -fps 25 -vf -t 86400000 -b 1800000 -o - \
ffmpeg -i - \
-f image2(?) \
-c:v mjpeg \
stream%d.jpg
I was also reading and found that we can use %d%d
in the raspistill output file name. I wonder if that will boost the fps. Also JPG encoding is hardware accelerated in raspistill, so I am really struggling to figure out why itsit's so slow...
I got a staggering 2 FPS FPS using %d%d
in the filename. For some reason, writing the jpgJPEG file is horribly slow from raspistill sigh. Sigh.