Giter Club home page Giter Club logo

node-stream's Introduction

Hi there πŸ‘‹

I'm Waleed Waleed Ahmad | Twitter Waleeds's LinkedIN . I'm a freelancer developer.

Waleed's GitHub stats

Languages & Tools :

πŸ’Ό Reach out for freelance work at my email :)

if you like what i do, maybe consider buying me a coffee/tea πŸ₯ΊπŸ‘‰πŸ‘ˆ

Buy Me A Coffee

node-stream's People

Contributors

waleedahmad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-stream's Issues

drop stream (reject) if the obs stream_key != to database client stream_key

the problem is :- when the client try to connect to the server with wrong stream_key is obs access to server and share 2 frames or 3 then ==> session.reject() work.
i fixed this issue by creating a list with stream_keys and compare the obs stream_key with the database stream_key my code :-

File Name:- media_server.js

const NodeMediaServer = require('node-media-server'),
      config          = require('./config/default').rtmp_server,
      User            = require('./database/Schema').User;
var keys = [];
User.find({} , (err , result)=>{
    result.forEach((key)=>{
        keys.push(key.stream_key);
    });
});

nms = new NodeMediaServer(config);
nms.on('prePublish', async (id, StreamPath, args) => {
    let stream_key = getStreamKeyFromStreamPath(StreamPath);
    let count;
    for(let i = 0 ; i<=keys.length; ++i){
        if(stream_key === keys[i]){
            count = 1;
            break;
        }else{
            count = 0;
        }
    }
    if(count != 1){
        let session = nms.getSession(id);
        session.reject();
    }
});

const getStreamKeyFromStreamPath = (path) => {
    let parts = path.split('/');
    return parts[parts.length - 1];
};
module.exports = nms;

the final result when the client enter a wrong stream_key obs is going to send alert and client never going to send any frame to the server side
Screenshot from 2020-03-24 08-13-24
*note using forEach will case a bad performance...

[INFO] [rtmp play] Stream not found. In production environment

I have followed the documentation for this project step by step. I first test on Windows, as my development system and i broadcast my stream from OBS, the thumbnails is created with a broken link thereby making the image not to appear. But that's not withstanding, the stream is able to play back. When i tested it in production using Ubuntu 20 on Vultr, I was able to stream only with the node media server (http://IP:8080/admin/stream) where it plays http-flv but on the web application (http://IP:3333), even the thumbnail could not be created and the logs shows:) [INFO] [rtmp play] Stream not found. Can someone tell me what could possibly be the cause of this?

Thanks

How to add dinamic relay

I tested it and it is amazing works pretty well

But There is a question:

how can users relay their own stream for other server live facebook or youtube individually without restart the server.

I noticed if I put relay on settings it will set same relay to all user and when I change relay it restart the server. Is there a way to set individual relay to each users without restart server and stop other streams?

SAMPLE CODE:

if I set this way all user will relay for the same but I wanna have one for each.

const config = {
	server: {
		secret: '<SECRET_KEY>',
		port: 3333
	},

	rtmp_server: {
		rtmp: {
			port: 1935,
			chunk_size: 60000,
			gop_cache: true,
			ping: 60,
			ping_timeout: 30
		},
		http: {
			port: 8888,
			mediaroot: './server/media',
			allow_origin: '*'
		},
		relay: {
			ffmpeg: '/usr/bin/ffmpeg',
			tasks: [
				{
					app: 'live',
					mode: 'push',
					edge: 'rtmp://a.rtmp.youtube.com/live2/<YOUTUBE_KEY>',
				},
				{
					app: 'live',
					mode: 'push',
					edge: 'rtmps://rtmp-pc.facebook.com:443/rtmp/<FACEBOOK_KEY>',
				}
			]
		},
		trans: {
			ffmpeg: '/usr/bin/ffmpeg',
			tasks: [{
				app: 'live',
				hls: true,
				hlsFlags: '[hls_time=2:hls_list_size=3:hls_flags=delete_segments]',
				dash: true,
				dashFlags: '[f=dash:window_size=3:extra_window_size=5]'
			}]
		}
	}
};

module.exports = config;

Stream delay

Very cool project and tutorial. Is there any way to reduce the delay of the stream?

How to access the client app

Hello,

I run the project on windows 7. npm start and npm run watch were successful. When I enter "localhost:8888" in chrome, it shows a message saying that adobe flash player must be installed. I installed it but I had a whole different screen than the picture in the tutorial.

Thanks a lot.

UnhandledPromiseRejectionWarning: Error: spawn /usr/local/bin/ffmpeg EACCES

Getting error on restart server and not able to get live access, Using Mac OS, Please refer below logs

node-stream % npm run start

[email protected] start /Users/a10660927/Desktop/rupak/node-stream
supervisor -w server ./server/app.js

Running node-supervisor with
program './server/app.js'
--watch 'server'
--extensions 'node,js'
--exec 'node'

Starting child process with 'node ./server/app.js'
Watching directory '/Users/a10660927/Desktop/rupak/node-stream/server' for changes.
Press rs for restarting the process.
7/26/2022 23:50:14 32528 [INFO] Node Media Server v2.4.4
App listening on 3333!
7/26/2022 23:50:14 32528 [INFO] Node Media Rtmp Server started on port: 1935
7/26/2022 23:50:14 32528 [INFO] Node Media Http Server started on port: 8888
7/26/2022 23:50:14 32528 [INFO] Node Media WebSocket Server started on port: 8888
(node:32528) UnhandledPromiseRejectionWarning: Error: spawn /usr/local/bin/ffmpeg EACCES
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:19)
at onErrorNT (internal/child_process.js:472:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use node --trace-warnings ... to show where the warning was created)
(node:32528) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:32528) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
7/26/2022 23:57:13 32528 [INFO] [rtmp disconnect] id=TH93H1SK
7/26/2022 23:57:13 32528 [INFO] [rtmp disconnect] id=HZYBV3AB
7/26/2022 23:57:44 32528 [INFO] [rtmp disconnect] id=M58CLYT7
7/26/2022 23:57:44 32528 [INFO] [rtmp disconnect] id=48SK84KD
7/26/2022 23:58:19 32528 [INFO] [rtmp disconnect] id=0VAY3VVP
7/26/2022 23:58:19 32528 [INFO] [rtmp disconnect] id=8QJUITVY
7/26/2022 23:59:19 32528 [INFO] [rtmp disconnect] id=WBJ4ONHD
7/26/2022 23:59:19 32528 [INFO] [rtmp disconnect] id=Q1I8AW9F
7/27/2022 24:00:49 32528 [INFO] [rtmp disconnect] id=IL83IFZM
7/27/2022 24:00:49 32528 [INFO] [rtmp disconnect] id=E0G7NNQ9
^CReceived SIGINT, killing child process...
Parent process exiting, terminating child...

How to Simulcast to Social Media?

How would I go about pushing an incoming RTMP stream out to YouTube Live for instance? With NGINX I would use a push directive in the config, for instance. Is there something relative to that here? The idea is to have many incoming RTMP streams that can be broadcasted to each broadcasters respective social media accounts.

Server requirements

Hi, I'd like to implement this and would like to know about server requirements. Anyone has any idea, let's say there's 100 streamers and 1000 viewers. what kinda hardware would this need?!

How far can it go on let's say an heroku free dyno?

Thanks,
Tiago

IPV6 only somehow not listening on ipv4

I have ubuntu 18 and although I have it all working I have this issue...

tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 101 14263 -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 23786 -
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 111 23096 -
tcp6 0 0 :::1935 :::* LISTEN 1000 81497 21828/node
tcp6 0 0 :::22 :::* LISTEN 0 23788 -
tcp6 0 0 :::4000 :::* LISTEN 1000 81498 21828/node
tcp6 0 0 :::3333 :::* LISTEN 1000 81496 21828/node

problem viewing stream - points to 127.0.0.1, where to set?

before running npm update I did get a jsplayer at :3333/stream/user but it failed to stream (network problem or incompatible format error)

:8888/api/streams shows the connection properly from what i can tell and the backend shows a play attempt and does convert it to the right folder for incoming, but the root page at :3333 shows no streams active (both before and after update)

browser console shows the m3u8 failed to load.... ahhh, because it's 127.0.0.1 !!!

client/components/LiveStream.js and VideoPlayer.js - be sure to rerun the "npm start watch" after

Add Python as a Prerequisite in the readme

I got the following error below from running npm install. Installing python resolved the issue.

npm ERR! code 1
npm ERR! path C:\Users\_scrubbed__\node-stream\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\_scrubbed__\node-stream\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'C:\\Users\\ethan.melamed\\Development\\Tutorials\\node-stream\\node_modules\\node-gyp\\bin\\node-gyp.js',npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:89:16npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\isexe\index.js:42:5 
npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:199:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:89:16npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\isexe\index.js:42:5 
npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:199:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:89:16npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\isexe\index.js:42:5 
npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:199:21)
npm ERR! gyp verb `which` failed  python Error: not found: python
npm ERR! gyp verb `which` failed     at getNotFoundError (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\which\which.js:89:16npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\isexe\index.js:42:5 
npm ERR! gyp verb `which` failed     at C:\Users\_scrubbed__\node-stream\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:199:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the 
PYTHON env variable.
npm ERR! gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\_scrubbed__\node-stream\node_modules\node-gyp\lib\configure.js:484:19)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\ethan.melamed\DeveloPYTHON env variable.pment\Tutorials\node-stream\node_modules\node-gyp\lib\configure.js:509:16)            opment\Tutorials\node-stream\node_modules\no
npm ERR! gyp ERR! stack     at C:\Users\_scrubbed__\node-stream\node_modules\graceful-fs\polyfills.js:282:31                                        pment\Tutorials\node-stream\node_modules\nod
npm ERR! gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:199:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19042                                        m\node_modules\graceful-fs\polyfills.js:282:
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ethan.melamed\\Development\\Tutorials\\node-stream\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="                                                                          med\\Development\\Tutorials\\node-stream\\no
npm ERR! gyp ERR! cwd C:\Users\_scrubbed__\node-stream\node_moass_cflags=" "--libsass_ldflags=" "--libsassdules\node-sass
npm ERR! gyp ERR! node -v v15.4.0                                                     dules\node-sass
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ethan.melamed\AppData\Local\npm-cache\_logs\2021-01-19T16_54_17_050Z-debug.log  

JSON at Position 0

Hello Waleed,

when we give npm run start command in the terminal, I get ERROR stating "2715 [ERROR] uncaughtException SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()"

Any solutions to fix
Thank You
image

license

hi, please, put a license in your repository

Node Media Trans Server startup failed. ffmpeg:/c/ffmpeg/bin/ffmpeg cannot be executed.

I am having ffmpeg issue in the terminal
image

This is my default.js
image

My ffmpeg is set to /c/ffmpeg/bin/ffmpeg because I get that using this command:
image

My OS is Windows11 and I have installed the ffmpeg on my machine which is placed in c folder as following
image

I also have given full-control permission to this folder which is as following:
image

So my stream screen in the frontend is also not working as following:
image

Kindly guide me. Thanks

rtmp reject while testing through OBS

Hi,
I am getting rtmp reject when trying to read stream from OBS on my server, do you know any reason behind this. I have searched on net and haven't found this error.
Below is the log output:

6/9/2019 12:27:17 12008 [INFO] [rtmp connect] id=UUEPJ201 ip=::ffff:x.x.x.x app=live args={"app":"live","type":"nonprivate","flashVer":"FMLE/3.0 (compatible; FMSc/1.0)","swfUrl":"rtmp://x.x.x.x:1935/live","tcUrl":"rtmp://x.x.x.x:1935/live"}
[NodeEvent on prePublish] id=UUEPJ201 StreamPath=/live/sdfsfasd args={}
6/9/2019 12:27:18 12008 [INFO] [rtmp publish] New stream. id=UUEPJ201 streamPath=/live/sdfsfasd streamId=1
6/9/2019 12:27:18 12008 [INFO] [Transmuxing HLS] /live/sdfsfasd to ./server/media/live/sdfsfasd/index.m3u8
6/9/2019 12:27:18 12008 [INFO] [Transmuxing DASH] /live/sdfsfasd to ./server/media/live/sdfsfasd/index.mpd
6/9/2019 12:27:18 12008 [INFO] [rtmp reject] id=UUEPJ201

Thanks

/api/streams hanging

/api/streams appears to hang when a single client is streaming but returns {} when no one is streaming.

May be an issue with the existing library used ( node-media-server )

[rtmp disconnect] id=NZHCJH7R

I add to the path in windows the ffmpeg with the adress c:/ffmpeg/bin/ffmpeg
RTMP,HTTP AND WEBSOCKET Works propertly with the adress
trans: {
ffmpeg: '/ffmpeg',
tasks: [
{
app: 'live',
hls: true,
hlsFlags: '[hls_time=2:hls_list_size=3:hls_flags=delete_segments]',
dash: true,
dashFlags: '[f=dash:window_size=3:extra_window_size=5]'
}

what is the correct adress?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.