{"id":15539807,"url":"https://github.com/nickrobinson/paparazzi","last_synced_at":"2025-04-02T21:32:46.911Z","repository":{"id":20729935,"uuid":"90743037","full_name":"nickrobinson/paparazzi","owner":"nickrobinson","description":"Paparazzi.js","archived":false,"fork":false,"pushed_at":"2024-03-25T21:05:07.000Z","size":1179,"stargazers_count":0,"open_issues_count":6,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-18T08:24:48.047Z","etag":null,"topics":["mjpeg","nodejs","npm"],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nickrobinson.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-09T12:27:22.000Z","updated_at":"2019-07-07T11:47:49.000Z","dependencies_parsed_at":"2024-10-20T13:46:02.241Z","dependency_job_id":null,"html_url":"https://github.com/nickrobinson/paparazzi","commit_stats":{"total_commits":68,"total_committers":11,"mean_commits":6.181818181818182,"dds":0.5294117647058824,"last_synced_commit":"044cfa4c60af592832e34f5ab3aba51682fe68e7"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickrobinson%2Fpaparazzi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickrobinson%2Fpaparazzi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickrobinson%2Fpaparazzi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickrobinson%2Fpaparazzi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickrobinson","download_url":"https://codeload.github.com/nickrobinson/paparazzi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246895659,"owners_count":20851308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mjpeg","nodejs","npm"],"created_at":"2024-10-02T12:11:33.014Z","updated_at":"2025-04-02T21:32:46.891Z","avatar_url":"https://github.com/nickrobinson.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"paparazzi.js\n-\n\n[![CircleCI](https://img.shields.io/circleci/project/github/nickrobinson/paparazzi.svg)](https://circleci.com/gh/nickrobinson/paparazzi)\n[![npm](https://img.shields.io/npm/dw/paparazzi.svg)](https://www.npmjs.com/package/paparazzi)\n[![Known Vulnerabilities](https://snyk.io/test/github/nickrobinson/paparazzi/badge.svg)](https://snyk.io/test/github/nickrobinson/paparazzi)\n\n_A stalker of [IP cameras](http://en.wikipedia.org/wiki/IP_camera)_\n\n**What is this?**\n\nA high performance web proxy for serving [MJPG](http://en.wikipedia.org/wiki/Motion_JPEG) streams to the masses.\n\nIPCamera (1) \u003c-\u003e (1) paparazzi.js (1) \u003c-\u003e (N) Users\n\n![Demo screenshot](https://github.com/nickrobinson/paparazzi/blob/master/mjpg_demo.gif \"Streaming a VIVOTEK camera\")\n\nBackground\n-\n\n**IP cameras can't handle web traffic**\n\nIP 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:\n\n1. **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.\n2. **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.\n3. **Plug n' pray approach** - Embed a flash or Java-based player, such as the  [Cambozola](http://www.charliemouse.com/code/cambozola/) player. This requires plugins.\n4. **MJPG proxy** - Serve the MJPG stream directly if you are targeting only grade A browsers, (sorry IE).\n5. **paparazzi.js: 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. I've found that this approach is scalable, elegant, blazing fast and doesn't require disk access.\n\nUsage\n-\n\n**Server side**\n\n```coffeescript\n# Initialize\n\n# Same parameters as requst.get https://github.com/request/request\npaparazzi = new Paparazzi\n  url: 'http://67.109.86.186/mjpg/video.mjpg'\n  auth:\n    user: 'admin'\n    password: 'admin'\n    sendImmediately: false\n\npaparazzi.on \"update\", (image) =\u003e \n  console.log \"Downloaded #{image.length} bytes\"\n\npaparazzi.on 'error', (error) =\u003e \n  console.log \"Error: #{error.message}\"\n\npaparazzi.start()\n\n# Serve image\n# Take a look at server.coffee\n```\n\n**Client side**\n\nYou can simulate MJPG streaming by requesting new images on a specific interval. Appending a random parameter avoids caching.\n\n```javascript\n// JavaScript example using jQuery\n\n// Active camera will refresh every 2 seconds\nvar TIMEOUT = 2000;\nvar refreshInterval = setInterval(function() {\n  var random = Math.floor(Math.random() * Math.pow(2, 31));\n  $('img#camera').attr('src', 'http://localhost:3000/camera?i=' + random);\n}, TIMEOUT);\t\n```\n\n```html\n\u003c!-- In your HTML output --\u003e\n\u003cimg src='' id='camera' /\u003e\n```\n\nDemo\n-\n\t$ make run\n\nFor a list of tested cameras check [\"List of tested\ncameras\"](https://github.com/nickrobinson/paparazzi/wiki/List-of-tested-cameras) in the wiki\nsection.\n\nUpcoming features\n-  \n* Websockets implementation to get more FPS\n\nTODO\n-  \n* More tests\n* Find more public cameras to test\n\nLicense  \n-  \n\n\u003ca rel=\"license\" href=\"http://opensource.org/licenses/MIT\"\u003eThe MIT License (MIT)\u003c/a\u003e\n\nOriginal Author: Rodolfo Wilhelmy, AMA on Twitter \u003c[@rodowi](https://twitter.com/rodowi)\u003e\n\nMaintainer: Nick Robinson, Twitter \u003c[@Nrobinson33](https://twitter.com/NRobinson33)\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickrobinson%2Fpaparazzi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickrobinson%2Fpaparazzi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickrobinson%2Fpaparazzi/lists"}