agsh / rtsp-ffmpeg

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

Enhancement: Allow to use custom ffmpeg params #3

Closed pirquessa closed 9 years ago

pirquessa commented 9 years ago

I had to customize the lib to be able to use parameter like "-vf crop=ih:ih:(iw-ih)/2:0, transpose=2" in FFMpeg.prototype._args method.

It could be good to expose a way for the user to use custom parameters... A callback ? A generic array that will be concat to existing params ?

Could you do it for me ? :-D

agsh commented 9 years ago

Just add an arguments option in the constructor. You can pass parameters in child_process.spawn style like this:

{
  arguments: ['-vf', 'crop=ih:ih:(iw-ih)/2:0']
}
pirquessa commented 9 years ago

Nice ! I'll try it tonight :)

Thanks

pirquessa commented 9 years ago

Fail :(

There is a strange '-' as last argument in the FFMpeg.prototype._args method. It looks like we have to keep it at the end. You know why ?

The fact is that the fix does not works... Using this.arguments as the fist argument of the concat method make it works.

agsh commented 9 years ago

Oh, crap. Forgot about dash at the end which forces ffmpeg to use stdin. f65da575e8cb0510c3a325b0a0d048cd37703a8c

pirquessa commented 9 years ago

Seems better now. Thx :)

Do you update the npm repo each time ?

agsh commented 9 years ago

For this small library - yes.