WebRTC change default (500kbps) bandwidth NodeJS - Kurento Media Server (KMS) - node.js

I am using Kurento Media Server for my WebRTC project, I've been following the tutorial one2one-call.
Everything is okay until I'm using the media constraints of 640x360, as the bandwidth required by this constraints fits within the default bandwidth of KMS i.e. (500kbps), but as I increase the video resolution it demands more bandwidth and the video starts to pixelate, on the other end.
What I have tried till now
using setMinVideoSendBandwidth, setMaxVideoSendBandwidth, setMinVideoRecvBandwidth, setMaxVideoRecvSendBandwidth on webRtcEndpoints
adding "b=AS: 5000" to the client side offer SDP before setting it as local description and sending to server (edited kurento-utils.js).
changing bitrate in MediaElement.conf.ini at server configurations
I'm using kurento-utils.js at client side for inititaing RTC object, creating and answering offer.
As I said above I tried to add b=AS: 5000, for that I edited the kurento-utils.js.
I'm not sure if this required but my KMS runs on AWS and the Application server is hosted locally and on remote VPS.
Thanks in Advance!

Related

How to get WebRTC MediaStream to Node JS

I just want to know to get webrtc media stream to the node js server and serves it to the clients connected to that server.
I already created P2P WebRTC application with node js signalling server and it works fine. But now wants to route the media stream through the server. It should have low latency and delay to make it work at live server.
What you need is a SFU (Selective Forwarding Unit). Like these
mediasoup
janus-gateway
kurento
Here is a github project where it is implemented using mediasoup.

Peer to peer connection on LAN using Node js

I'm working on a data sharing app using node js, the idea is to create an application that can connect peers using node-js without using any kind of central dependency i.e a signalling server or something of its kind. After a lot of research I'm always back to this diagram but it only makes sense if there is no signalling server I'm targeting LAN networks so that I don't have to deal with NAT.
To be specific, I would like some to answer these specific question
Is it possible to connect to webrtc on LAN, i.e the webrtc connection will connect using my client's ip
Is it possible to use websockets without a central server, or something like websockets
Is it possible to connect two clients on LAN using node js without using any hardcoded Ips or asking users to enter ip.
Since you are using node.js, you can very well use raw UDP (dgram) and use UDP broadcasting for device discovery - then you do not need any form of centralization required by websockets/webRTC.
The answer to all your questions is Yes!
Also, there is a lof WebRTC server that you can use them on a simple Linux box, like Janus, Kurento, etc. I've tested them and they have worked with some mischief, lol. So, run it and next read their API to exchange anything you want on their medium.
I'm not sure about Janus but the Kurento has a nodeJS client itself. Read the Local Installation and JavaScript Kurento Client.
Additionally, if you want to make a WebSocket connection, it has enabled by default configuration.
To change the port, enter this command at the final step:
npm start -- --ws_uri=ws://https://185.164.72.144/:8888/kurento --as_uri=https://185.164.72.144:6008/

RTSP Camera P2P Connection without Port Forwarding and Console Application

I am trying to connect Remote RTSP Stream from IP Camera, but unable to get it without port Forwarding or Client Application. Is there any procedure to connect RTSP stream from one network to other network without port forwarding?
I have already tried with application client from hikvision and checked Wireshark streams but unable to get it
cam = cv2.VideoCapture("rtsp")
Take a look at the Nabto P2P platform, it is designed exactly to solve this problem, free for personal use and test / R&D. The Nabto blog has specific examples for setting up RTSP P2P tunnelling on cameras, Raspberry Pi devices and ESP32 devices:
You can either install the Nabto P2P reverse proxy in front of your RTSP service on the camera as a standalone process - or you can integrate it into an existing application. Full source is available in github.
On the client side, you can use an existing Nabto enabled RTSP client - or build your own based on the client SDKs, available for most popular platforms. Existing client apps available in github and in App store / Google Play.

Building Node Js server to receive live Video streams from multiple clients{Raspberry Pi's} over the internet

As the title suggests I want to build a NodeJs server to receive live video stream from multiple clients at the same time OVER THE INTERNET.
My client would basically be a Rpi with a camera sending it's live video stream to my NodeJs server.
I would be having multiple clients {Rpis} doing the same.
My NodeJs Server has a Static Public IP.
My NodeJs server and Clients{Rpis} are not on the same Local Network....So how can I send Live Video Stream from Multiple RPis to the central NodeJs server over the internet ?
....Basically I want to Build a VideoStream API[Implemented on NodeJs server], which can be used by my Multiple clients to push frames on to my server.
I have no clue on how to achieve the above .. Plz Help.
...
I saw many solutions online. None seem to fulfill my purpose.
Most of the solution online said. To configure Rpi as a nodejs server and stream camera feed in local network but I want to achieve the same on the INTERNET. but this not what I want. Since I have multiple client i.e multiple Raspberry pi's which are not same Network as of the NodeJs server.
client{raspberry pi}
const request = require('request');
const readablestream = require('magical-not-provided-way-to-access-camera-stream')
const r = request.post("http://staticIp/");
r.pipe(readablestream);
server
requestlistener(req){req.pipe(writeablestream)}
client
raspberrys.foreach(pullStream)
server{raspberry pi}
requestlistener(req,res){res.pipe(camerastream)}

why webRTC work by local Lan but not in Internet?

I create a webrtc sample based On this tutorial. this work on my local network fine and I can send and receive signal and videos. but when I connect from internet ti the server and two peer are not in same network video connection does not create.
I am using self sign Certificate and must add them two browsers.
there is no error or exception. my signaling server is a web socket server written in nodejs.
Original Answer
I believe that you require a HTTPS (SSL certificate) if you are using Chrome +47 to be deployed online, but is not required if serving from a local machine on the same network.
According to caniuse; Edge and Firefox may yield non blocking results (but prefix with moz):http://caniuse.com/#feat=stream
The issue isn't necessarily WebRTC but getUserMedia/Stream API isn't provided when the called from a non-secure site (or non-localhost address).
Attached Image:
(https://developers.google.com/web/updates/2015/10/chrome-47-webrtc)
Update:
Did a bit more digging around, and the following answer is related to the question getUserMedia() in chrome 47 without using https i.e. possible duplicate;
You "can" launch a Chrome browser to accept the insecure origin; however, that's temp. fix, whereas you'd probably want to get a certificate.
chrome.exe --user-data-dir=/test/only/profile/dir --unsafely-treat-insecure-origin-as-secure="http://example.com"

Resources