From cfad8573d6e4f6deb39278ac55ecf7f4efbfbb49 Mon Sep 17 00:00:00 2001 From: datagutt Date: Wed, 28 Aug 2019 15:48:10 +0200 Subject: [PATCH] Configurable analyzeduration and probesize --- node_trans_server.js | 2 ++ node_trans_session.js | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/node_trans_server.js b/node_trans_server.js index 751d0832..a22d238a 100644 --- a/node_trans_server.js +++ b/node_trans_server.js @@ -59,6 +59,8 @@ class NodeTransServer { while (i--) { let conf = this.config.trans.tasks[i]; conf.ffmpeg = this.config.trans.ffmpeg; + conf.analyzeDuration = this.config.trans.analyzeDuration; + conf.probeSize = this.config.trans.probeSize; conf.mediaroot = this.config.http.mediaroot; conf.rtmpPort = this.config.rtmp.port; conf.streamPath = streamPath; diff --git a/node_trans_session.js b/node_trans_session.js index 1180bd11..80f18076 100644 --- a/node_trans_session.js +++ b/node_trans_session.js @@ -23,6 +23,9 @@ class NodeTransSession extends EventEmitter { let inPath = 'rtmp://127.0.0.1:' + this.conf.rtmpPort + this.conf.streamPath; let ouPath = `${this.conf.mediaroot}/${this.conf.streamApp}/${this.conf.streamName}`; let mapStr = ''; + let analyzeDuration = this.conf.analyzeDuration || '1000000'; // used to be 2147483647 + let probeSize = this.conf.probeSize || '1000000'; // used to be 2147483647 + const random = [...Array(11)].map(i=>(~~(Math.random()*36)).toString(36)).join(''); if (this.conf.rtmp && this.conf.rtmpApp) { @@ -63,7 +66,7 @@ class NodeTransSession extends EventEmitter { Logger.log('[Transmuxing FLV] ' + this.conf.streamPath + ' to ' + ouPath + '/' + flvFileName); } mkdirp.sync(ouPath); - let argv = ['-y', '-flags', 'low_delay', '-fflags', 'nobuffer', '-analyzeduration', '2147483647', '-probesize', '2147483647', '-i', inPath]; + let argv = ['-y', '-flags', 'low_delay', '-fflags', 'nobuffer', '-analyzeduration', analyzeDuration, '-probesize', probeSize, '-i', inPath]; Array.prototype.push.apply(argv, ['-c:v', vc]); Array.prototype.push.apply(argv, this.conf.vcParam); Array.prototype.push.apply(argv, ['-c:a', ac]);