Fast Network Camera

Calin Crisan edited this page Oct 4, 2015 · 1 revision

What Is Fast Network Camera

If you want to turn your Raspberry PI into a simple but fast network camera, starting with version 20150621 there's a new option that will get you there: it's called Fast Network Camera and can be found in the Expert Settings section. However, Fast Network Camera option works only on Raspberry PI boards (any model) equipped with the standard CSI camera module!

How It Works

motionEyeOS normally uses the motion daemon internally to capture, stream and process the video frames. While motion does a great job in most of the cases, it won't take advantage of the Raspberry PI's GPU processing power; all the processing (including JPEG encoding is done by the CPU).

When enabling the Fast Network Camera option, motionEyeOS switches from using motion to using a completely different backend called streamEye. streamEye, together with raspimjpeg.py will capture JPEG frames from your Raspberry PI's GPU and will stream them as MJPEG over HTTP.

The Differences

When you have Fast Network Camera enabled, you'll notice that:

  • your motionEyeOS-based camera can reach a significantly higher frame rate, at a higher resolution
  • you can tweak many CSI camera-specific parameters directly from the UI
  • your browser will eat up less CPU at the same frame rate/resolution (it uses a pure MJPEG stream, rather than triggering every refresh from JavaScript)

On the other hand, this doesn't come without some disadvantages:

  • no more motion detection
  • no more motion notifications
  • no more pictures or movies
  • no more overlaid text (date/time, camera name)
  • a significantly higher network bandwidth usage
  • you'll need to forward port 8081 as well, if you want to access your camera from the Internet

streamEye

streamEye aims to be a simple but efficient MJPEG streamer. It waits for successive JPEG frames at input and serves them as MJPEG to all connected HTTP clients. It's written entirely in C and has minimal overhead.

Why not mjpg-streamer? Well, because I needed a simple daemon that reads already compressed JPEGS from standard input and does its HTTP thing. mjpg-streamer has a few plug-ins that allow streaming data from a V4L(2) devices or from folders on a disk, but not from standard input and not without some unnecessary overhead. I know there are mjpg-streamer forks that work tight with the CSI camera module, but I wanted all command line options to be similar to raspivid/raspistill's and I wanted full control. And, besides that, who doesn't like writing some C code every now and then?

raspimjpeg.py

raspimjpeg.py is a python script that uses picamera to program the Raspberry PI GPU to continuously capture frames in video mode and output ready-made JPEGs. It supports most of the camera options accepted by raspistill & raspivid.

Why not raspistill? Because it uses the stills mode (as opposed to the video mode), which is significantly slower when it comes to the achievable frame rate.

Why not raspivid? Because it doesn't output MJPEG (or JPEG) data.

Tips & Tricks

  • Decreasing the image quality (which defaults to 50) will increase the maximum reachable framerate. Try it yourself with values as low as 20 and you'll see the difference, while the quality itself isn't affected that much.

  • Overclocking also improves the performance considerably. For example, on a normally clocked Raspberry PI the maximum throughput is somewhere around 4MB/s; if overclocked using the turbo preset, the throughput can go as high as 7 MB/s.

  • If by mistake you left the Enable Debugging option on while using your motionEyeOS as a Fast Network Camera, turn it off as it will quickly fill up your SD card with huge log files.