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.97k stars 1.52k forks source link

Unable to access stream #45

Open Anmolk22 opened 6 years ago

Anmolk22 commented 6 years ago

I m running a node media server. PFB the code

`var nodeMediaSer = require('node-media-server');

const config = { rtmp: { port: 1935, chunk_size: 60000, gop_cache: true, ping: 60, ping_timeout: 30 }, http: { port: 8000, allow_origin: '*' } };

var nms = new nodeMediaSer(config); nms.run(()=> { console.log("Server Started"); })

nms.on('preConnect', (id, args) => { console.log('[NodeEvent on preConnect]', id=${id} args=${JSON.stringify(args)}); // let session = nms.getSession(id); // session.reject(); });

nms.on('postConnect', (id, args) => { console.log('[NodeEvent on postConnect]', id=${id} args=${JSON.stringify(args)}); });

nms.on('doneConnect', (id, args) => { console.log('[NodeEvent on doneConnect]', id=${id} args=${JSON.stringify(args)}); });

nms.on('prePublish', (id, StreamPath, args) => { console.log('[NodeEvent on prePublish]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)}); // let session = nms.getSession(id); // session.reject(); });

nms.on('postPublish', (id, StreamPath, args) => { console.log('[NodeEvent on postPublish]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)}); });

nms.on('donePublish', (id, StreamPath, args) => { console.log('[NodeEvent on donePublish]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)}); });

nms.on('prePlay', (id, StreamPath, args) => { console.log('[NodeEvent on prePlay]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)}); // let session = nms.getSession(id); // session.reject(); });

nms.on('postPlay', (id, StreamPath, args) => { console.log('[NodeEvent on postPlay]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)}); });

nms.on('donePlay', (id, StreamPath, args) => { console.log('[NodeEvent on donePlay]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)}); });

`

after this I run comman npm run start with ffmpeg installed with 'sudo apt-get install ffmpeg' I run the below commands 'ffmpeg -re -i INPUT_FILE_NAME -c:v libx264 -preset superfast -tune zerolatency -c:a aac -ar 44100 -f flv rtmp://localhost/live/STREAM_NAME' 'ffplay http://localhost:8000/live/STREAM_NAME.flv' after running the second command I always get the same error on the console that the stream is not found /live/STREAM_NAME is not found.

NOTE: STREAM_NAME is being changed with the file name

illuspas commented 6 years ago

Please paste all the contents of the console output.