https://github.com/lsongdev/node-rtmp
A Node.js implementation of RTMP Server
https://github.com/lsongdev/node-rtmp
rtmp rtmp-server rtmp-stream
Last synced: 7 months ago
JSON representation
A Node.js implementation of RTMP Server
- Host: GitHub
- URL: https://github.com/lsongdev/node-rtmp
- Owner: lsongdev
- License: gpl-2.0
- Created: 2018-08-01T06:04:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-07-20T07:49:36.000Z (over 4 years ago)
- Last Synced: 2024-12-31T10:05:33.036Z (about 1 year ago)
- Topics: rtmp, rtmp-server, rtmp-stream
- Language: JavaScript
- Homepage: https://npmjs.org/rtmp2
- Size: 23.4 KB
- Stars: 23
- Watchers: 5
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RTMP-Server
A Node.js implementation of RTMP Server
- Supports only RTMP protocol.
- Supports only H.264 video and AAC audio.
# Install
```bash
npm install --save rtmp2
```
# Usage
```js
const RTMP = require('rtmp2');
const rtmpServer = RTMP.createServer();
rtmpServer.on('client', client => {
client.on('command', command => {
// console.log(command.cmd, command);
});
client.on('connect', () => {
console.log('connect', client.app);
});
client.on('play', ({ streamName }) => {
console.log('PLAY', streamName);
});
client.on('publish', ({ streamName }) => {
console.log('PUBLISH', streamName);
});
client.on('stop', () => {
console.log('client disconnected');
});
});
rtmpServer.listen(1935);
```
You can now publish streams to `rtmp://localhost:1935/live/mytv` and use any unique stream key.
```bash
~$ ffmpeg -f avfoundation -i "1" -vcodec libx264 -f flv rtmp://localhost:1935/live/mytv
```
The stream will then be available at `rtmp://localhost:1935/live/mytv`.
# License
This project is under MIT license.