diff --git a/src/constants.js b/src/constants.js index 44abf88..6a9619c 100644 --- a/src/constants.js +++ b/src/constants.js @@ -6,9 +6,11 @@ module.exports = { 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, + // frame that appears between videos). The goal of these things is to + // prevent the video from getting stuck on the last second, which looks bad + // for some reason ~750 works well. I raised the fps to 60 and now 420 works + // but I wish it was lower. + GAP_DURATION: 10*42, //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. diff --git a/src/ffmpeg.js b/src/ffmpeg.js index 42a0800..779e379 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -217,7 +217,11 @@ class FFMPEG extends events.EventEmitter { } if (pic != null) { - ffmpegArgs.push("-r" , "24"); + if (this.opts.noRealTime === true) { + ffmpegArgs.push("-r" , "60"); + } else { + ffmpegArgs.push("-r" , "24"); + } ffmpegArgs.push( '-i', pic, ); @@ -232,8 +236,12 @@ class FFMPEG extends events.EventEmitter { videoComplex = `;[${inputFiles++}:0]format=yuv420p[formatted]`; videoComplex +=`;[formatted]scale=w=${iW}:h=${iH}:force_original_aspect_ratio=1[scaled]`; videoComplex += `;[scaled]pad=${iW}:${iH}:(ow-iw)/2:(oh-ih)/2[padded]`; - videoComplex += `;[padded]loop=loop=-1:size=1:start=0[looped]`; - videoComplex +=`;[looped]realtime[videox]`; + videoComplex += `;[padded]loop=loop=-1:size=1:start=0`; + if (this.opts.noRealTime !== true) { + videoComplex +=`[looped];[looped]realtime[videox]`; + } else { + videoComplex +=`[videox]` + } //this tune apparently makes the video compress better // when it is the same image stillImage = true; diff --git a/src/program-player.js b/src/program-player.js index 3d9fd1c..d7ceea4 100644 --- a/src/program-player.js +++ b/src/program-player.js @@ -34,6 +34,7 @@ class ProgramPlayer { // people might want the codec normalization to stay because of player support context.ffmpegSettings.normalizeResolution = false; } + context.ffmpegSettings.noRealTime = program.noRealTime; if ( typeof(program.err) !== 'undefined') { console.log("About to play error stream"); this.delegate = new OfflinePlayer(true, context); diff --git a/src/video.js b/src/video.js index 605b715..11b02bc 100644 --- a/src/video.js +++ b/src/video.js @@ -198,6 +198,7 @@ function video( channelService, fillerDB, db, programmingService, activeChannelS lineupItem = { type: 'loading', title: "Loading Screen", + noRealTime: true, streamDuration: GAP_DURATION, duration: GAP_DURATION, redirectChannels: [channel], @@ -207,6 +208,7 @@ function video( channelService, fillerDB, db, programmingService, activeChannelS lineupItem = { type: 'interlude', title: "Interlude Screen", + noRealTime: true, streamDuration: GAP_DURATION, duration: GAP_DURATION, redirectChannels: [channel],