GithubHelp home page GithubHelp logo

motion's People

Contributors

ajbogh avatar mmaelzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

motion's Issues

Example with MjpegConsumer doesn't appear to make any sense!

Let me prefix all of the following by saying this isn't my area, so I may be completely on the wrong track. I think, however, there's something that doesn't make sense about your example in the README.md for this module.

The key hinges on this line:

request(options).pipe(consumer).pipe(motion).pipe(writer);

In other words, MjpegConsumer is being fed directly into motion-detect (which in turns uses motion). However, I just couldn't get this working. After bashing my head against it, and creating a poor-man's stream to replace motion-detect and talk directly to motion.js, I think I understand. What MjpegConsumer generates is JPEG files. However, these are (by the lossy nature of JPEGs) variable in length. What motion appears to be expecting (which might explain the line I referred to in issue #6) is RGBA arrays. So I've knocked together some code that uses https://www.npmjs.com/package/jpeg-js to decode the JPGs into RGBA arrays, and bingo - now motion works!

What I don't get is how your example ever worked? Did you miss something from the sample code? Am I still fundamentally missing something?

FWIW, my code looks approx like this:

var jpeg = require('jpeg-js');

  class FrameHandler extends Stream {
    constructor () {
      super()
      this.motion = new Motion()
      this.lastFrame = []
    }

    write (newFrame) {
      const newFrameRGBA = jpeg.decode(newFrame).data
      let hasMotion = this.motion.detect(newFrameRGBA, this.lastFrame)
      let diff = this.motion.diff(newFrameRGBA, this.lastFrame)
      this.lastFrame = newFrameRGBA
      if (hasMotion) { logger.debug('Motion detected') }
    }
  }

  var consumer = new MjpegConsumer()

  request(options).pipe(consumer).pipe(new FrameHandler())

Cannot work out how to data urlEncode output of getBlendedImage(image1, image2)

Hi there,

Sorry to bother you - but I'd like to stream the output of getBlendedImage(image1, image2) over a websocket to a client - however, I cannot seem to work out how to convert the RGBA array into a base64 encoded data uri (so that it can be directly loaded in as a src in an img).

Any pointers you could give would be greatly appreciated...

Issues with stray line in motion.js

Hi, it appears there is an inconsistency between the version of motion-detect on GitHub and the version on npm.

I've traced it to the stray line if(img1.length !== img2.length) return null; in lib/motion.js (which is I assume should not be present and is a bug. The version of motion.js (which corresponds to a package.json of 0.2.4) on GitHub does not have this line, but the version downloaded via npm install does.

Thanks for your work on this great library.

cgi example

Hello, is there any example of videostream.cgi for this repo?
I don't know how to create it, thanks.

Some small issues with resulting JPEG files

Firstly, thank you very much for putting this together, I've been experimenting with it for the past couple days, and it has really surpassed my expectations. I really appreciate the time you've put into it, and I would love to help with anything moving forward.

I am testing out the Usage example (under "Motion Stream") where we write images to a file:

request(options).pipe(consumer).pipe(motion).pipe(writer);

I have found that I am sometimes getting JPEGs that are invalid. I'm not quite sure where in the process something goes wrong, but upon converting the JPEGs into a GIF using this command:

convert -delay 3 -loop 0 video/*.jpg monday.gif

Several of the file conversion produces errors that look like this:

convert: Not a JPEG file: starts with 0x34 0x38 video/1457373787249.jpg' @ error/jpeg.c/JPEGErrorHandler/322.
convert: Not a JPEG file: starts with 0x5f 0x30 video/1457373788733.jpg' @ error/jpeg.c/JPEGErrorHandler/322.
convert: Not a JPEG file: starts with 0x36 0x0d video/1457373789767.jpg' @ error/jpeg.c/JPEGErrorHandler/322.
convert: Not a JPEG file: starts with 0x3a 0x30 video/1457373792936.jpg' @ error/jpeg.c/JPEGErrorHandler/322.

I don't mind digging around to investigate this issue, but I was wondering if you knew what could be happening? Or possibly what part of the process could lead to resulting in corrupted jpeg images?

Thank you very much again,
Doug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.