Skip to content
A simple MJPEG streamer for Linux
Branch: master
Clone or download
ccrisan Merge pull request #20 from cHemingway/master
Add pthread.h to common.h to fix build on OS X / macOS
Latest commit ebc0508 May 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
extras Python 3 support for raspimjpeg.py Dec 19, 2018
.gitignore
LICENSE initial commit Apr 12, 2015
Makefile apparently we're supposed to use -pthread instead of -lpthread Apr 22, 2016
README.md
auth.c fixed auth hash length Aug 16, 2015
auth.h added support for http basic authentication Jun 12, 2015
client.c fixed memory leak when at client connection Apr 23, 2016
client.h various performance improvements & fixes; added fps debug logging Jul 12, 2015
common.h Add pthread.h to common.h to fix build on OSX May 21, 2019
streameye.c choose the minimum client frame interval rather than the average, when Jul 16, 2015
streameye.h raspimjpeg.py: minor argument names adjustments Oct 1, 2016

README.md

streamEye

streamEye is a simple MJPEG streamer for Linux. It acts as an HTTP server and is capable of serving multiple simultaneous clients.

It will feed the JPEGs read at input to all connected clients, in a MJPEG stream. The JPEG frames at input may be delimited by a given separator. In the absence of a separator, streamEye will autodetect all JPEG frames.

Installation

streamEye was tested on various Linux machines, but may work just fine on other platforms. Assuming your machine has git, gcc and make installed, just type the following commands to compile and install:

git clone https://github.com/ccrisan/streameye.git
cd streameye
make
sudo make install

Usage

Usage: <jpeg stream> | streameye [options] Available options:

  • -d - debug mode, increased log verbosity
  • -h - print this help text
  • -l - listen only on localhost interface
  • -p port - tcp port to listen on (defaults to 8080)
  • -q - quiet mode, log only errors
  • -s separator - a separator between jpeg frames received at input (will autodetect jpeg frame starts by default)
  • -t timeout - client read timeout, in seconds (defaults to 10)

Examples

The following shell script will serve the JPEG files in the current directory, in a loop, with 2 frames per second:

while true; do
    for file in *.jpg; do
        cat $file
        echo -n "--separator--"
        sleep 0.5
    done
done | streameye -s "--separator--"

The following command will stream your camera (assuming it's at /dev/video0), with 30 frames per second at 640x480:

ffmpeg -f video4linux2 -i /dev/video0 -r 30 -s 640x480 -f mjpeg -qscale 5 - 2>/dev/null | streameye

Extras

raspimjpeg.py

This script continuously captures JPEGs from a Raspberry PI's CSI camera and writes them to standard output. It works out-of-the-box on Raspbian. The following command will make a simple MJPEG streamer out of your Raspberry PI:

raspimjpeg.py -w 640 -h 480 -r 15 | streameye

Why not raspivid or raspistill? Well, at the time of writing raspivid doesn't output JPEGs and raspistill only works in stills mode.

Why Python and not C? Because most of the stuff is done by the GPU, so the insignificant performance gain would not make it worth writing C code. And of course because picamera is an amazing library.

You can’t perform that action at this time.