agsh / rtsp-ffmpeg

Node.js FFMpeg wrapper for streaming RTSP into MotionJPEG
MIT License
248 stars 84 forks source link

Restart method #2

Closed pirquessa closed 9 years ago

pirquessa commented 9 years ago

I notice that the restart method was not declared as stop/start on the prototype... Is that normal ?

See line 111:

FFMpeg.restart = function()

When replaced by

FFMpeg.prototype.restart = function()

I can restart the streaming if needed.

agsh commented 9 years ago

Yeah, you are absolutely right! This is a misspell. Thank you.

pirquessa commented 9 years ago

\o/ First usefull participation on a repo \o/

Thanks for your lib !

Do you think there is a way to get an event when ffmpeg crash & reboot ? (It seems to do it a lot when the camera is down)

Other question: how to know that the camera is down ?

Thanks again :)

agsh commented 9 years ago

When something goes wrong with ffmpeg, you can uncomment these two lines: https://github.com/agsh/rtsp-ffmpeg/blob/master/lib/rtsp-ffmpeg.js#L95 and write everything you want. And when the camera is down, ffmpeg doesn't produce any data, so you can handle a timeout to check activity on data event. Better solution is to ping camera and find out what's happening.

pirquessa commented 9 years ago

"error" callback can be removed / stay commented, It does not seems to be trigger. Even if the ffmpeg process die or restart. The "close" callback seems to be triggered when the camera stream come back, not when it disappear :(