Skip to content

Commit

Permalink
Configurable analyzeduration and probesize
Browse files Browse the repository at this point in the history
  • Loading branch information
datagutt committed Aug 28, 2019
1 parent 82ba725 commit cfad857
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions node_trans_server.js
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion node_trans_session.js
Expand Up @@ -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) {
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit cfad857

Please sign in to comment.