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

Disconnected camera #84

Open NasserAlmanji opened 3 years ago

NasserAlmanji commented 3 years ago

The module works well.

In case the camera is disconnected (unplug the cable) and then connect, the module does not detect that and the process needs a restart to see the media again in browser.

Kind regards, Nasser

llindor commented 3 years ago

Same issue here.

I tried passing some http options to ffmpeg but it has no effect :

  ffmpegOptions: {
    "-reconnect": 1,
    "-reconnect_at_eof": 1,
    "-reconnect_streamed": 1,
    "-reconnect_delay_max": 2,
  },

The process need to restart to see the video too.

OmanCoding commented 3 years ago

Thanks for clarification

AndresGamboaBaldi commented 1 year ago
image

The solution is to modify the file mpegmuxer.js, in the line 44 when an error occurs, this is only handling errors with code = 1, if the camera gets disconnected the error code = 0, so I fixed it adding the code === 0 to the If