Streampunk / beamcoder

Node.js native bindings to FFmpeg.
GNU General Public License v3.0
392 stars 76 forks source link

how to use listen_timeout for demuxer #70

Open heleon19 opened 3 years ago

heleon19 commented 3 years ago

Hi Is it possible to use the demuxer with an listen_timeout?

I tryed await beamcoder.demuxer({ "url": "rtsp://admin:admin@192.168.2.242/1", "options": { "listen_timeout": 10 } }); but get an error.

[Error: In file c:\daten\nodejs\beamcode\node_modules\beamcoder\src\demux.cc on line 76, found error: Problem opening input format: Unable to create AV error string.] { code: '5000' }

hbTecAG commented 3 years ago

Is it possible?

scriptorian commented 3 years ago

Hi, FFmpeg command line offers a protocol layer that has a 'rw_timeout' option that appears to provide what you are looking for. The API doesn't have this option directly but does provide the opportunity to implement a simple 'interrupt_callback' parameter in the AVFormatContext struct passed to the demuxer open call that would allow a timeout or abort call to be implemented. There is a pull request from November that appears to provide a solution - could you please review it and give some feedback on whether it meets you needs?