diff --git a/src/constants.js b/src/constants.js index 8dcbba2..44abf88 100644 --- a/src/constants.js +++ b/src/constants.js @@ -5,6 +5,11 @@ module.exports = { TVGUIDE_MAXIMUM_FLEX_DURATION : 6 * 60 * 60 * 1000, TOO_FREQUENT: 1000, + // Duration of things like the loading screen and the interlude (the black + // frame that appears between videos). The theory is that we don't need + // it to last longer than one frame, but I am not so sure. + GAP_DURATION: 83, + //when a channel is forcibly stopped due to an update, let's mark it as active // for a while during the transaction just in case. CHANNEL_STOP_SHIELD : 5000, diff --git a/src/ffmpeg.js b/src/ffmpeg.js index 30a6895..42a0800 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -198,8 +198,9 @@ class FFMPEG extends events.EventEmitter { iW = this.wantedW; iH = this.wantedH; + let durstr = `duration=${streamStats.duration}ms`; + if (this.audioOnly !== true) { - ffmpegArgs.push("-r" , "24"); let pic = null; //does an image to play exist? @@ -216,6 +217,7 @@ class FFMPEG extends events.EventEmitter { } if (pic != null) { + ffmpegArgs.push("-r" , "24"); ffmpegArgs.push( '-i', pic, ); @@ -235,6 +237,8 @@ class FFMPEG extends events.EventEmitter { //this tune apparently makes the video compress better // when it is the same image stillImage = true; + this.volumePercent = Math.min(70, this.volumePercent); + } else if (this.opts.errorScreen == 'static') { ffmpegArgs.push( '-f', 'lavfi', @@ -269,7 +273,7 @@ class FFMPEG extends events.EventEmitter { videoComplex = `;realtime[videox]`; } } - let durstr = `duration=${streamStats.duration}ms`; + if (typeof(streamUrl.errorTitle) !== 'undefined') { //silent audioComplex = `;aevalsrc=0:${durstr}[audioy]`; @@ -549,6 +553,7 @@ class FFMPEG extends events.EventEmitter { if (this.hasBeenKilled) { return ; } + //console.log(this.ffmpegPath + " " + ffmpegArgs.join(" ") ); this.ffmpeg = spawn(this.ffmpegPath, ffmpegArgs, { stdio: ['ignore', 'pipe', (doLogs?process.stderr:"ignore") ] } ); if (this.hasBeenKilled) { console.log("Send SIGKILL to ffmpeg"); diff --git a/src/video.js b/src/video.js index 9f1ff4d..152ad94 100644 --- a/src/video.js +++ b/src/video.js @@ -188,7 +188,7 @@ function video( channelService, fillerDB, db, programmingService, activeChannelS let redirectChannels = []; let upperBounds = []; - const GAP_DURATION = 750; + const GAP_DURATION = constants.GAP_DURATION; if (isLoading) { lineupItem = { type: 'loading',