Live camera streaming in Node js and Reactjs - node.js

I am trying to live stream the data from one of our camera into the browser.I can connect to camera and converting RTSP to HLS using FFMPEG in Node JS. All the segments are written to local folder in Node JS. But how do i send this ReactJS continuously.
Backend
----->src
----->videos
output.m3u8
output1.ts
output2.ts

Since you're using HLS, the client simply requests the segments as it needs them. You simply serve these files like any other static files, via any standard web server.

Related

Is there a difference between normal video stream, and a stream made by NodeJS?

I'm working on a video streaming project with NodeJS.
In normal situation, If I provide a source like "http://Example.com/video.mp4" to a HTML5 video player, for instance, It doesn't download the whole file into client's browser and then plays it. instead, looks like it gets chunks of data and loads the video.
On the other hand, we have NodeJS streaming process. Which reads a file by streaming and then sends chunks of data to client. I can provide "http://Example.com/stream/:mediaId" to HTML5 player, and in related JS file I do streaming "video.mp4" with Node.
So is there a difference between these two options?

Should a long Running video processing task to be done client side or server side

I was creating an application in react for uploading video and using a REST API to send that to the server and store in S3. I also wanted the simple audio version of the video for some other tasks and I am confused as to what might be the better way:
Creating audio file on the fly when it is needed using node-ffmpeg package and not store it anywhere
Start converting the video file to audio on the browser client only, and posting that to the server for storage along with the video.
Just post the video to the server and use queue system for creating a new task for video conversion to audio and then save that to the S3 storage.
The second method seems to be saving some compute power on the server but it might be a problem if the video upload completes, audio conversion is still going on and the client disconnects.
Would appreciate some help, thanks.

how do i stream a video from RTSP to react

i'm using nodejs and react (both with typescript) and i'm trying to get the video from an IP Camera through RTSP,
i tried using node-rtsp-stream but this library uses jsmpeg as a consumer in the front-end and it does not work with react & typescript.
i need some recommandations or other solutions
I have an idea that we can transfer the RTSP to HTTP format(like HLS) first, then many of the video players and js libraries are able to play it.

What is the best solution for Live-cam Service in web application?

I am trying to setup a web-based Live webcam streaming service(Using laravel framework php) where a user can broadcast live via webcam (Web based Only).
For example:
User X Starts a webcam-Broadcast at http://localhost/userx while Users Y,Z etc join that room on http://localhost/userx will be able to watch the live webcam/stream.
I was playing around with node.js and socket.io library for realtime chat and it works fine.
But I have no idea about webcam streaming.
Should i use webrtc? How many viewers can handle the broadcaster if i use Webrtc ?
What is best solution for handling around 1000-2000 viewers?
Any suggestion would help me a lot.
Why not use the node-camera module which enables you to access and stream web camera in nodejs using opencv and websockets.
This the command you should run in order to run it:
npm start -- [-open] [-wsport websocketPort] [-webport webserverport] [-res widthxheight]
where the options passed to run it are:
-open Open streaming url on startup
-wsport Web socket port for streaming media
-webport Web server port
-res Resolution for preview image
-input Input source. ( eg. ip camera url)
There are few more libraries such as ffmpeg, vlc and OpenCV which are available using webcam access that can be written as node's native addon

Video Stream Hosting

Good day! I'm a newbie on video streaming. Can you help me find good ways on how to make a video streaming secure?
I'm having some issues on my video hosting project security.
I am creating a web page which calls a video stream hosted on a different server where
my web page is deployed.
Server 1(web page video embed) calls video to stream on Server 2(video host).
The problem is that they are hosted on an absolute different network. Should Server 2 where the video is hosted should be private and only allow Server 1 to fetch the video stream creating a server to server transfer of data, or should it be public for the clients to be able access it.
Can you help me decide what to do to secure my videos?
I badly need some idea on this... thanks guys!
How are you streaming and what streaming protocol are you using?
Server to server wont help in securing the video.it is better to stream the video direcly from your Server 2(video host) directly to the client,so that it wont be overhead for server 1(web page video embed).You need to use secure way to protect you video on server 2.if the server2 is not secure,even if you stream through server1 it wont help.
Here are details of security level on different video streamings.
If you are using progressive download.This can be done using normal http protocol.In this approach you would be able to see the video url in the browser.Once you got the url you can download it as a normal file download.Security is very low here.Even if you sign the video url,the user can download the video easily.
Streaming,you can stream the video using different protocol like rtmp etc.If you are streaming videos using some rtmp.In this approch, you wont be able to download the video directly,but you can use some good software to capture the video stream and save to the pc.
Streaming securly.There are some protocols like rtmpe.I tried only rtmpe,In this protocol,the streaming content will be encrypted on the server and decrypted on the client.so the software wont be able to capture the video stream.
Along with approach 3,if you sign the video url,it will add more security.Hope this helps.

Resources