node-media-server
rtmp flv server
A Node.js implementation of RTMP Server. Latest version: 2.7.0, last published: 3 months ago. Start using node-media-server in your project by running `npm i node-media-server`. There are 10 other projects in the npm registry using node-media-server.
https://static-production.npmjs.com/58a19602036db1daee0d7863c94673a4.png
npm
A Node.js implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH Media Server

https://www.nodemedia.cn/product/node-media-server/

https://github.com/illuspas/Node-Media-Server-Admin

http://server_ip:8000/admin

Cross platform support Windows/Linux/Unix

Support H.264/AAC/MP3/SPEEX/NELLYMOSER/G.711

Extension support H.265(flv_id=12)/OPUS(flv_id=13)

Support GOP cache

Support remux to LIVE-HTTP/WS-FLV, Support NodePlayer.js playback

Support remux to HLS/DASH/MP4

Support xycdn style authentication

Support event callback

Support https/wss

Support Server Monitor

Support Rtsp/Rtmp relay

Support api control relay

Support real-time multi-resolution transcoding

Support Enhancing RTMP, FLV (HEVC/AV1 encoding using OBS)

npx node-media-server

npm i node-media-server -g node-media-server

docker run --name nms -d -p 1935:1935 -p 8000:8000 -p 8443:8443 illuspas/node-media-server

node app.js

If you have a video file with H.264 video and AAC audio:

ffmpeg -re -i INPUT_FILE_NAME -c copy -f flv rtmp://localhost/live/STREAM_NAME

Or if you have a video file that is encoded in other audio/video format:

ffmpeg -re -i INPUT_FILE_NAME -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -ar 44100 -f flv rtmp://localhost/live/STREAM_NAME

Settings -> Stream

Stream Type : Custom Streaming Server

URL : rtmp://localhost/live

Stream key : STREAM_NAME?sign=expires-HashValue (sign parameter required only if publish auth is enabled)

rtmp://localhost/live/STREAM_NAME

http://localhost:8000/live/STREAM_NAME.flv

ws://localhost:8000/live/STREAM_NAME.flv

http://localhost:8000/live/STREAM_NAME/index.m3u8

http://localhost:8000/live/STREAM_NAME/index.mpd

It is now possible to modify the logging type which determines which console outputs are shown.

There are a total of 4 possible options:

0 - Don't log anything

1 - Log errors

2 - Log errors and generic info

3 - Log everything (debug)

Modifying the logging type is easy - just add a new value logType in the config and set it to a value between 0 and 4. By default, this is set to show errors and generic info internally (setting 2).

For custom log handling, see events for log message logMessage, errorMessage, debugMessage, and ffDebugMessage.

The logger events noted above are fired independently of the log level set by logType

rtmp://hostname:port/appname/stream?sign=expires-HashValue

http://hostname:port/appname/stream.flv?sign=expires-HashValue

ws://hostname:port/appname/stream.flv?sign=expires-HashValue

1.Publish or play address:

rtmp://192.168.0.10/live/stream

2.Config set auth->secret: 'nodemedia2017privatekey'

3.expiration time: 2017/8/23 11:25:21 ,The calculated expiration timestamp is

1503458721

4.The combination HashValue is:

HashValue = md5("/live/stream-1503458721-nodemedia2017privatekeyâ)

HashValue = 80c1d1ad2e0c2ab63eebb50eed64201a

5.Final request address

rtmp://192.168.0.10/live/stream?sign=1503458721-80c1d1ad2e0c2ab63eebb50eed64201a

The 'sign' keyword can not be modified

Play:NodeMediaClient-Android and NodeMediaClient-iOS

Commercial Pure JavaScrip live stream player: NodePlayer.js

OpenSource Pure JavaScrip live stream player: pro-flv.js

OBS 29.1+

OBS 29.1+

openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem

https://localhost:8443/live/STREAM_NAME.flv wss://localhost:8443/live/STREAM_NAME.flv

In the browser environment, Self-signed certificates need to be added with trust before they can be accessed.

const config = { ....... auth: { api : true, api_user: 'admin', api_pass: 'nms2018', }, ...... }

Based on the basic authï¼Please change your password. The default is not turned on

http://localhost:8000/api/server

http://localhost:8000/api/streams

Remux to RTMP cannot use the same app name

NodeMediaServer implement RTSP and RTMP relay with ffmpeg.

The static pull mode is executed at service startup and reconnect after failure. It could be a live stream or a file. In theory, it is not limited to RTSP or RTMP protocol.

relay: { ffmpeg: '/usr/local/bin/ffmpeg', tasks: [ { app: 'cctv', mode: 'static', edge: 'rtsp://admin:admin888@192.168.0.149:554/ISAPI/streaming/channels/101', name: '0_149_101', rtsp_transport : 'tcp' //['udp', 'tcp', 'udp_multicast', 'http'] }, { app: 'iptv', mode: 'static', edge: 'rtmp://live.hkstv.hk.lxdns.com/live/hks', name: 'hks' }, { app: 'mv', mode: 'static', edge: '/Volumes/ExtData/Movies/Dancing.Queen-SD.mp4', name: 'dq' } ] }

When the local server receives a play request. If the stream does not exist, pull the stream from the configured edge server to local. When the stream is not played by the client, it automatically disconnects.

relay: { ffmpeg: '/usr/local/bin/ffmpeg', tasks: [ { app: 'live', mode: 'pull', edge: 'rtmp://192.168.0.20', } ] }

When the local server receives a publish request. Automatically push the stream to the edge server.

relay: { ffmpeg: '/usr/local/bin/ffmpeg', tasks: [ { app: 'live', mode: 'push', edge: 'rtmp://192.168.0.10', } ] }

Real-time transcoding multi-resolution output

fission: { ffmpeg: '/usr/local/bin/ffmpeg', tasks: [ { rule: "game/*", model: [ { ab: "128k", vb: "1500k", vs: "1280x720", vf: "30", }, { ab: "96k", vb: "1000k", vs: "854x480", vf: "24", }, { ab: "96k", vb: "600k", vs: "640x360", vf: "20", }, ] }, { rule: "show/*", model: [ { ab: "128k", vb: "1500k", vs: "720x1280", vf: "30", }, { ab: "96k", vb: "1000k", vs: "480x854", vf: "24", }, { ab: "64k", vb: "600k", vs: "360x640", vf: "20", }, ] }, ] }

https://play.google.com/store/apps/details?id=cn.nodemedia.qlive

https://github.com/NodeMedia/NodeMediaClient-Android

https://github.com/NodeMedia/NodeMediaClient-iOS

https://github.com/NodeMedia/react-native-nodemediaclient

Implemented with asm.js / wasm

http-flv/ws-flv

H.264/H.265 + AAC/Nellymoser/G.711 decoder

Ultra low latency

All modern browsers are supported