diff --git a/index.js b/index.js index c39d5a9..6363e0e 100644 --- a/index.js +++ b/index.js @@ -243,6 +243,12 @@ module.exports = async (config = {}) => { console.log(`${width}x${height} ${fps}fps`); + const estimatedTotalFrames = fps * clips.reduce((acc, c, i) => { + let newAcc = acc + c.duration; + if (i !== clips.length - 1) newAcc -= c.transition.duration; + return newAcc; + }, 0); + const channels = 4; const { runTransitionOnFrame } = GlTransitions({ width, height, channels }); @@ -330,6 +336,11 @@ module.exports = async (config = {}) => { if (verbose) console.log('Frame', totalFrameCount, 'from', fromClipFrameCount, `(clip ${transitionFromClipId})`, 'to', toClipFrameCount, `(clip ${getTransitionToClipId()})`); + if (!verbose) { + const percentDone = Math.floor(100 * (totalFrameCount / estimatedTotalFrames)); + if (totalFrameCount % 10 === 0) process.stdout.write(`${String(percentDone).padStart(3, ' ')}% `); + } + if (!frameData1 || transitionFrameAt >= transitionNumFramesSafe - 1) { // if (!frameData1 || transitionFrameAt >= transitionNumFramesSafe) { console.log('Done with transition, switching to next clip');