Skip to content

Commit

Permalink
Merge branch 'wip'
Browse files Browse the repository at this point in the history
  • Loading branch information
shbatm committed Jun 20, 2017
2 parents 4efea9a + 0535085 commit aeddf91
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.0.1] - Fixes #2 - Add UDP Protocol

Added option for using UDP protocol in `ffmpeg`

## [1.0.0] - Initial Release

First public release
1 change: 1 addition & 0 deletions MMM-RTSPStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Module.register("MMM-RTSPStream", {
snapshotType: 'url', // 'url' or 'file'
snapshotUrl: '',
snapshotRefresh: 10, // Seconds
protocol: "tcp", // 'tcp' or 'udp'
frameRate: "30",
port: 9999,
width: undefined,
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ cd MMM-RTSPStream
npm install
```

## Updating after a Module Update:

```shell
cd ~/MagicMirror/modules/MMM-RTSPStream
git pull
npm run-script update
```

## Using the module

To use this module, add the following configuration block to the modules array in the `config/config.js` file:
Expand Down Expand Up @@ -109,6 +117,7 @@ config: {
|----------------- |-----------
| `name` | *Required* The name of the individual stream. Will be displayed when paused if snapshots are turned off.
| `url` | The url of the RTSP stream. See [this list](https://github.com/shbatm/MMM-RTSPStream/wiki/Stream-URLs-for-Various-Cameras) for paths for some common security cameras. Also see below for how to test for a valid url<br>Username and password should be passed in the url if required: `rtsp://<username>:<password>@<hostname>:<port>/<path>`<br>*Default:* A test stream at `'rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov'`,
| `protocol` | Protocol to use for receiving RTSP stream<br>*Default:* `"tcp"`, valid options: `"tcp"` or `"udp"`.
| `snapshotUrl` | A string with the path to the camera snapshot. This can either be a url to camera itself (if supported) or a file path to where the snapshot is stored every X seconds by the camera. Leave blank to show just the stream title when paused.<br>Username and password should be passed in the url if required: `http://<username>:<password>@<hostname>:<port>/<path>`
| `snapshotType` | The type of snapshot path given<br>*Values:* `url` or `file`<br>*Default:* `url`
| `snapshotRefresh` | How often to refresh the snapshot image (in sec).<br>*Default:* 10 (seconds)
Expand Down Expand Up @@ -151,6 +160,8 @@ keyBindings: {
## To-do

* Add better touchscreen support (use an OnTouch method to play/pause instead of OnClick).
* Reduce lag time / delay on live camera streams
* Add option to use `omxplayer` to display a full screen live view on local machine.

## Experimentation

Expand All @@ -165,4 +176,4 @@ ffmpeg -i {RTSP_SOURCE} -f image2 -vf fps=fps=1/{x} -update 1 thumb.png
// Grab the first frame from a stream and save as thumb.jpg
ffmpeg -i {RTSP_SOURCE} -ss 00:00:01.500 -f image2 -vframes 1 thumb.png
```
([source](https://superuser.com/questions/663928/ffmpeg-to-capture-stills-from-h-264-stream))
([source](https://superuser.com/questions/663928/ffmpeg-to-capture-stills-from-h-264-stream))
5 changes: 2 additions & 3 deletions node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ module.exports = NodeHelper.create({
method: 'GET',
encoding: null,
}, function (error, response, body) {
// console.log("Received response for "+this.callerName);
if (!error && response.statusCode == 200) {
if (!error && typeof response !== "undefined" && response.statusCode == 200) {
self.sendSocketNotification("SNAPSHOT", { name: this.callerName, image: true, buffer: 'data:image/jpeg;base64,' + body.toString('base64') });
} else if (response.statusCode === 401) {
} else if (error || response.statusCode === 401) {
self.sendSocketNotification("DATA_ERROR_" + this.callerName, error);
console.error(self.name, error);
} else {
Expand Down
15 changes: 3 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "MMM-RTSPStream",
"version": "1.0.0",
"version": "1.0.1",
"description": "Magic Mirror 2 module to stream video from an RTSP stream",
"main": "MMM-RTSPStream.js",
"author": "shbatm",
"license": "MIT",
"scripts": {
"test": "node test_server.js"
"test": "node test_server.js",
"update": "npm install github:shbatm/node-rtsp-stream-es6"
},
"dependencies": {
"datauri": "^1.0.5",
Expand All @@ -17,14 +18,4 @@
"type": "git",
"url": "git+https://github.com/shbatm/MMM-RTSPStream.git"
},
"devDependencies": {
"grunt": "latest",
"grunt-eslint": "latest",
"grunt-jsonlint": "latest",
"grunt-markdownlint": "^1.0.13",
"grunt-stylelint": "latest",
"grunt-yamllint": "latest",
"stylelint-config-standard": "latest",
"time-grunt": "latest"
}
}

0 comments on commit aeddf91

Please sign in to comment.