node-rtsp-rtmp-server icon indicating copy to clipboard operation
node-rtsp-rtmp-server copied to clipboard

add functionalty to save stream to file

Open davibe opened this issue 9 years ago • 6 comments

Hi. I would like to be able to save the user webcam to disk. I am looking forward to you adding support for multiple publishers (another issue) but for my purpose i need a way to save the rtmp to disk. Dumping a flv file would be just fine.

What do you think about this ? is it easy ? Do you plan to do it yourself ? if not where could i start from ?

I know I could just connect a gstreamer client pipeline or use rtmpdump to save the stream to disk but i would like to do it in the same process (not having one process per publisher) and I don't want to loose the very first frame so it has to be tightly integrated I think.

Thank you very much for your work i totally love the idea of a Coffee/js/node.js based streaming server.

davibe avatar Feb 18 '15 19:02 davibe

Thanks for the suggestion. I'm willing to add that feature after multiple streams feature is done, but how do you want to save streams to files? You want every stream to be saved, or only streams that are selected by some criteria?

iizukanao avatar Feb 20 '15 00:02 iizukanao

Well, at first i would say the simplest and most hackable thing is ok.

If you look around other solutions support both ways. Nginx-rtmp for example has a configuration option of the RTMP "application" that allows you to specify all streams on that application need to be recorded. So for example you can have everything in "/live" to be not recorder, and everything on "/record" to be recorder instead. However the very same rtmp-nginx also has an http rest api to start and stop recording from an external application. It also supports redirecting the user from one application to the other so you can also redirect the user to the recording application when needed.

I suggest you don't need all of this complications atm. You can just make the feature isolated and pluggable to the stream and then auto-plug it if the application is configured to record. This way it's clear for someone else how to modify the code for custom needs and maybe send pull requests. To me it's just important that if the recorder is plugged at the beginning of the stream it does not loose first frames.

On Fri, Feb 20, 2015 at 1:01 AM, Nao Iizuka [email protected] wrote:

Thanks for the suggestion. I'm willing to add that feature after multiple streams feature is done, but how do you want to save streams to files? You want every stream to be saved, or only streams that are selected by some criteria?

— Reply to this email directly or view it on GitHub https://github.com/iizukanao/node-rtsp-rtmp-server/issues/11#issuecomment-75165296 .

davibe avatar Feb 20 '15 08:02 davibe

Ah, I think you mean publishing type "record" which is defined in RTMP spec. This server doesn't support "record" at this time, but I'm willing to add that feature. Also, the plugin system you wrote sounds good. I'll take into account that architecture when refactoring the code.

iizukanao avatar Feb 20 '15 17:02 iizukanao

I don't mean the "record" command. I mean the application name. When you stream to rtmp://127.0.0.1:1935/live/foo then "live" is the rtmp application name, "foo" is the stream name. Therefore you could have rtmp:// 127.0.0.1:1935/record/foo which is another application configured to record.

On Fri, Feb 20, 2015 at 6:57 PM, Nao Iizuka [email protected] wrote:

Ah, I think you mean publishing type "record" which is defined in RTMP spec. This server doesn't support "record" at this time, but I'm willing to add that feature. Also, the plugin system you wrote sounds good. I'll take into account that architecture when refactoring the code.

— Reply to this email directly or view it on GitHub https://github.com/iizukanao/node-rtsp-rtmp-server/issues/11#issuecomment-75287589 .

davibe avatar Feb 20 '15 18:02 davibe

Oh, I see. I'll consider implementing it in the next major version.

iizukanao avatar Feb 20 '15 18:02 iizukanao

+1 for this feature.

Classsic avatar Jun 28 '16 17:06 Classsic