mmaelzer/mjpeg-consumer

Could you use this to convert a MJPEG stream to on demand JPEG

edasque opened this issue · 1 comments

I have a stream coming from a camera and I'd like to create a small HTTP server with one endpoint that outputs the most recent image as JPEG (and doesn't refresh until I hit the endpoint again).

Could I use this library to create this? Would the app be constantly streaming in or only when a jpeg is requested?

If you'd just like a simple HTTP server that serves the most recent jpeg image from a camera, take a look at mjpeg-camera which leverages this library. Specifically, you can use the camera server like this:

$ npm install mjpeg-camera -g
$ cs

  Usage: server [options]

  Options:

    -h, --help          output usage information
    -V, --version       output the version number
    -u --user []        Set the username for camera authentication
    -pw --password []   Set the password for camera authentication
    -l --url []         Set the url for the camera
    -p --port [8080]    Set the port for the http server to listen on
    -n --name [camera]  Set the name of the camera


$ cs -l http://204.248.124.202/mjpg/video.mjpg?camera=1 -n "Spring Grove" -p 12345
=== Spring Grove camera server listening on 12345 ===

// open up http://localhost:12345/frame in your browser to view the current frame from the camera