Skip to content

sulhan/paparazzogo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Paparazzo.go

A stalker of IP cameras

endorse

What is this?

A high performance caching web proxy for serving MJPG streams to the masses.

Features

  • Easy to use.
  • Done with Go programming language.
  • Compatible with http.HandlerFunc.
  • No unnecessary network traffic to IP-camera.
  • Serves MJPEG-stream as single jpeg-images.
  • Works with every browser.
  • Supports client-side caching.

IPCamera (1) <-> (1) Paparazzo.go (1) <-> (N) Users

Demo screenshot

Background

IP cameras can't handle web traffic

IP cameras are slow devices that can't handle a regular amount of web traffic. So if you plan to go public with an IP camera you have the following options:

  1. The naive approach - Embed the camera service directly in your site, e.g. http://201.166.63.44/axis-cgi/jpg/image.cgi?resolution=CIF.
  2. Ye olde approach - Serve images as static files in your server. I've found that several sites use this approach through messy PHP background jobs that update this files at slow intervals, generating excessive (and unnecessary) disk accesses.
  3. Plug n' pray approach - Embed a flash or Java-based player, such as the Cambozola player. This requires plugins.
  4. MJPG proxy - Serve the MJPG stream directly if you are targeting only grade A browsers, (sorry IE).
  5. Paparazzo.go: A web service of dynamic images - Build a MJPG proxy server which parses the stream, updates images in memory, and delivers new images on demand. This approach is scalable, elegant, blazing fast and doesn't require disk access.

Usage

Get Paparazzo and start demo:

go get github.com/putsi/paparazzogo

cd $GOPATH/src/github.com/putsi/paparazzogo/demo
go run demo.go
open demo.html

Customization of settings:

mjpegHandler := &paparazzogo.Mjpegproxy{
	// Max MJPEG-frame size (5Mb by default).
	partbufsize: 625000,

	// Sleep time between error and reconnecting to stream (one second by default).
	waittime: time.Second * 1,

	// How long to use one stream response before reconnecting (one hour by default).
	responseduration: time.Hour,

	// Caching enables/disables support for client-side caching
	// of jpg-files. If enabled, saves bandwidth.
	// If disabled, allows more than one frame per second.
	// Enabled by default.
	caching: true,
}

See more examples in demo-folder.

Licence

Use of this source code is governed by a MIT-style licence that can be found in the LICENCE-file.

See Also

The original Paparazzo.js for NodeJS!

About

HTTP.Handler for Go. Caching proxy that delivers MJPEG-stream in JPG-images.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 87.2%
  • HTML 12.8%