illuspas / Node-Media-Server

A Node.js implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH/MP4 Media Server
https://www.npmjs.com/package/node-media-server
MIT License
5.95k stars 1.52k forks source link

Not able to run with given instructions #319

Open softmantk opened 4 years ago

softmantk commented 4 years ago

I have cloned the repo and ran the code which is there in the repo

mkdir nms cd nms npm install node-media-server vi app.js

const config = {
  rtmp: {
    port: 1935,
    chunk_size: 60000,
    gop_cache: true,
    ping: 30,
    ping_timeout: 60
  },
  http: {
    port: 8000,
    mediaroot: './media',
    webroot: './www',
    allow_origin: '*',
    api: true
  },
  https: {
    port: 8443,
    key: './privatekey.pem',
    cert: './certificate.pem',
  },
  auth: {
    api: true,
    api_user: 'admin',
    api_pass: 'admin',
    play: false,
    publish: false,
    secret: 'nodemedia2017privatekey'
  },
};

let nms = new NodeMediaServer(config)
nms.run();

The server ran without a hussle. So, started the streaming using OBS studio

set URL : rtmp://localhost:1935/live

Stream key : t

But got error and no video played.

This is my logs:

4/16/2020 17:31:36 90119 [INFO] Node Media Server v2.1.6
4/16/2020 17:31:36 90119 [INFO] Node Media Rtmp Server started on port: 1935
4/16/2020 17:31:36 90119 [INFO] Node Media Http Server started on port: 8000
4/16/2020 17:31:36 90119 [INFO] Node Media WebSocket Server started on port: 8000
4/16/2020 17:31:36 90119 [INFO] Node Media Https Server started on port: 8443
4/16/2020 17:31:36 90119 [INFO] Node Media WebSocketSecure Server started on port: 8443
[NodeEvent on preConnect] id=1DY37OPQ args={"app":"","type":"nonprivate","flashVer":"FMLE/3.0 (compatible; FMSc/1.0)","swfUrl":"rtmp://localhost:1935/","tcUrl":"rtmp://localhost:1935/"}
4/16/2020 17:31:42 90119 [INFO] [rtmp connect] id=1DY37OPQ ip=::ffff:127.0.0.1 app= args={"app":"","type":"nonprivate","flashVer":"FMLE/3.0 (compatible; FMSc/1.0)","swfUrl":"rtmp://localhost:1935/","tcUrl":"rtmp://localhost:1935/"}
[NodeEvent on postConnect] id=1DY37OPQ args={"app":"","type":"nonprivate","flashVer":"FMLE/3.0 (compatible; FMSc/1.0)","swfUrl":"rtmp://localhost:1935/","tcUrl":"rtmp://localhost:1935/"}
1004:onPublish:invokeMessage: {
  cmd: 'publish',
  transId: 5,
  cmdObj: null,
  streamName: 't',
  type: 'live'
}

[NodeEvent on prePublish] id=1DY37OPQ StreamPath=//t args={} 4/16/2020 17:31:42 90119 [INFO] [rtmp publish] New stream. id=1DY37OPQ streamPath=//t streamId=1 [NodeEvent on postPublish] id=1DY37OPQ StreamPath=//t args={} 4/16/2020 17:31:43 90119 [INFO] [rtmp publish] Handle audio. id=1DY37OPQ streamPath=//t sound_format=10 sound_type=2 sound_size=1 sound_rate=3 codec_name=AAC 44100 2ch 4/16/2020 17:31:43 90119 [INFO] [rtmp publish] Handle video. id=1DY37OPQ streamPath=//t frame_type=1 codec_id=7 codec_name=H264 1152x720 [NodeEvent on preConnect] id=T6WRKPJJ args={"app":"live","flashVer":"LNX 9,0,124,2","tcUrl":"rtmp://192.168.1.3:1935/live","fpad":false,"capabilities":15,"audioCodecs":4071,"videoCodecs":252,"videoFunction":1} 4/16/2020 17:31:55 90119 [INFO] [rtmp connect] id=T6WRKPJJ ip=::ffff:192.168.1.4 app=live args={"app":"live","flashVer":"LNX 9,0,124,2","tcUrl":"rtmp://192.168.1.3:1935/live","fpad":false,"capabilities":15,"audioCodecs":4071,"videoCodecs":252,"videoFunction":1} [NodeEvent on postConnect] id=T6WRKPJJ args={"app":"live","flashVer":"LNX 9,0,124,2","tcUrl":"rtmp://192.168.1.3:1935/live","fpad":false,"capabilities":15,"audioCodecs":4071,"videoCodecs":252,"videoFunction":1} [NodeEvent on prePlay] id=T6WRKPJJ StreamPath=/live/t args={} 4/16/2020 17:31:55 90119 [INFO] [rtmp play] Stream not found. id=T6WRKPJJ streamPath=/live/t streamId=1

Not able to play in the admin panel too : got error in browser console :

Screenshot 2020-04-16 at 5 38 18 PM

mlsgrnt commented 4 years ago

Same here