mjpeg-decoder
Advanced tools
@@ -139,2 +139,3 @@ const { EventEmitter } = require('events'); | ||
| if (this.lastFrameTime && (Date.now() - this.lastFrameTime) < interval) { | ||
| this.drainCallbackQueue(null, frame); | ||
| return; | ||
@@ -149,3 +150,3 @@ } | ||
| if (maxFrames && this.seq >= maxFrames) { | ||
| if (maxFrames > 0 && this.seq >= maxFrames) { | ||
| this.abort('end'); | ||
@@ -152,0 +153,0 @@ return; |
+9
-2
| { | ||
| "name": "mjpeg-decoder", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "A NodeJS M-JPEG decoder which can be used to retrieve individual JPEG frames or take a snapshot from a IP/network camera which serves M-JPEG video stream.", | ||
@@ -10,3 +10,10 @@ "main": "lib/mjpeg-decoder.js", | ||
| "private": false, | ||
| "types": "./lib/mjpeg-decoder.d.ts" | ||
| "types": "./lib/mjpeg-decoder.d.ts", | ||
| "keywords": [ | ||
| "M-JPEG decoder", | ||
| "mjpeg decoder", | ||
| "mjpeg snapshot", | ||
| "mjpeg screenshot", | ||
| "mjpeg parser" | ||
| ] | ||
| } |
+23
-5
@@ -57,5 +57,5 @@ # mjpeg-decoder | ||
| `MjpegDecoder.MjpegDecoderOptions` | ||
| - `interval`: Specify the time interval in which the frames will be delivered. | ||
| - `maxFrames`: Specify the max frames to consume before stopping. | ||
| - `timeout`: Specify the timeout before the http connection is aborted | ||
| - `interval`: Specify the time interval in which the frames will be delivered (_default: `0`_) | ||
| - `maxFrames`: Specify the max frames to consume before stopping (_default: `0`_) | ||
| - `timeout`: Specify the timeout before the http connection is aborted (_default: `10000`ms_) | ||
@@ -71,3 +71,3 @@ ### Constructor | ||
| > How to find the url of the camera? | ||
| > The camera user manual should usually mention the URL, or searching the camera model number should get you a result as well. You can also try this tool http://skjm.com/icam/mjpeg.php. | ||
| > The camera user manual should usually mention the URL, or searching the camera model number should get you a result as well. You can also try this tool http://skjm.com/icam/mjpeg.php or this tool https://www.ispyconnect.com/man.aspx. | ||
@@ -132,2 +132,20 @@ ### decoderForSnapshot | ||
| - `end`: when you call the `stop` method of the decoder or the max frames have been delivered. | ||
| - `max_buffer_size_exceeded`: when the internal data buffer size reached the limit, and this might be caused by the M-JPEG decoding problem. If you accountered this error, please create an issue. | ||
| - `max_buffer_size_exceeded`: when the internal data buffer size reached the limit, and this might be caused by the M-JPEG decoding problem. If you accountered this error, please create an issue. | ||
| ### Capture M-JPEG snapshot the other ways | ||
| Use wget: | ||
| ```bash | ||
| $ wget <url> -O snapshot.jpg | ||
| ``` | ||
| Use ffmpeg: | ||
| ```bash | ||
| ffmpeg -f MJPEG -y -i <url> -r 1 -vframes 1 -q:v 1 snapshot.jpg | ||
| ``` | ||
| ## References | ||
| - https://aeroquartet.com/movierepair/jpeg.en.html | ||
| - https://www.media.mit.edu/pia/Research/deepview/exif.html | ||
| - https://github.com/jacksonliam/mjpg-streamer/ | ||
| - https://channel9.msdn.com/coding4fun/articles/MJPEG-Decoder | ||
| - https://medium.com/@petehouston/capture-mjpg-streamer-snapshot-9d0e253b9bbd |
13234
6.25%230
0.44%148
13.85%