Skip to content

Commit

Permalink
Improve interlude
Browse files Browse the repository at this point in the history
  • Loading branch information
vexorian committed Nov 14, 2023
1 parent 92cd5ec commit 66804fe
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 11 additions & 3 deletions src/ffmpeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/program-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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],
Expand Down

0 comments on commit 66804fe

Please sign in to comment.