kyriesent / node-rtsp-stream

Stream any RTSP stream and output to websocket for consumption by jsmpeg (https://github.com/phoboslab/jsmpeg). HTML5 streaming video! Requires ffmpeg.
MIT License
451 stars 166 forks source link

How to close the socket and stop ffmpeg? #11

Closed shivangidas closed 6 years ago

shivangidas commented 6 years ago

stream.wsServer.close() - as suggested in one of the closed issues, doesn't stop the FFmpeg. The FFmpeg(s) keeps running in the background. How can I close the socket and stop FFmpeg, too?

kyriesent commented 6 years ago

You'll need to kill the child process manually.

stream.mpeg1Muxer.stream is a child process that is running ffmpeg. You can see it instantiated in the code here.

If you are done with the video stream, then you can simply kill the child process and it will stop ffmpeg.

You would be :zap: if you submitted a pull request to create a stream.end() method that did all this stuff automatically...

As I've mentioned in some issues before, this was built as a Proof-of-Concept a few years ago and I'm not actively maintaining it. I hope it inspires you to do something even better!