Closed jayeshtechextensor closed 2 years ago
@jayeshhhh hi!
If I understood correctly, you want to start a brand new stream for each client. For this you can just create new rtsp.FFMpeg
instance for each client request.
Juse replace server's code with something like this:
io.on('connection', function(socket) {
var uri = 'rtsp://freja.hiof.no:1935/rtplive/definst/hessdalen03.stream',
stream = new rtsp.FFMpeg({input: uri});
var pipeStream = function(data) {
socket.emit('data', data.toString('base64'));
};
stream.on('data', pipeStream);
socket.on('disconnect', function() {
stream.removeListener('data', pipeStream);
});
});
But, the purpose of this library, on the contrary, is to reduce the number of ffpmeg
processes. And to share only one stream between clients and stop ffmpeg
when no one is subscribed on the stream. This is useful when you have live translation from ip-camera, for example, to reduce server's cpu and memory usage.
Hello @agsh , Thank you so much for the quick reply :)
I have almost followed the same process in my code. You can check it following my video link: http://srecorder.com/uploads/2022-01-24_11.03.52.mp4
Please check and update I think I have to make some minor changes. Thank you in advance
return this.arguments.concat([
'-loglevel', 'quiet',
'-i', this.input,
'-r', this.rate.toString()
],
this.quality ? ['-q:v', this.quality.toString()] : [],
this.resolution ? ['-s', this.resolution] : [],
[
// '-vf', 'fps=25',
// '-b:v', '32k',
'-f', 'image2',
'-update', '1',
'-'
]);
Also, I'm trying to code modify here to run multiple streams. Following the FFMPEG doc.
@jayeshhhh Sorry for the late, a lot of work :tired_face:.
I think that the stream.on('data', <smth>);
event shares sources to each client. Can you provide the whole example to check it?
@agsh I resolve the issue. thank you for time :)
Cool!
Hello,
Suppose I have two media stream https://localhost:6147/?url=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov and https://localhost:6147/?url=rtsp://ipcam.stream:8554/bars
Now, I want to run both streams at the same time with different-different browsers. But write now the output is coming common stream in both browsers and "I want to get output is a different stream with different browser at a time"
How can I manage? Any help would be very appreciated!