diff --git a/frameloom b/frameloom index ad90cf6..53c4955 100644 --- a/frameloom +++ b/frameloom @@ -464,6 +464,10 @@ async function spinFrames() { if (randomInt(0, 1) === 1) { flop = '-flop '; } + if (flip === '' && flop === '' && rotate === '') { + //skip unrotated, unflipped and unflopped frames + continue; + } cmd = `convert ${framePath} ${rotate}${flip}${flop} ${framePath}`; console.log(cmd); try { @@ -495,11 +499,6 @@ async function render(output, avconv) { const cmd = `${exe} -r ${framerate} -f image2 -s ${resolution} -i ${frames} ${format} -y ${output}`; log(`Exporting video ${output}`); log(cmd); - /*try { - await exec(`ls "${TMPPATH}"`) - } catch (err) { - log(err) - }*/ try { await exec(cmd); } @@ -600,6 +599,15 @@ async function main(arg) { log('Error weaving', err); return process.exit(5); } + if (arg.spin) { + try { + await spinFrames(); + } + catch (err) { + log('Error spinning', err); + return process.exit(13); + } + } if (e) { try { await subExec(e); @@ -634,6 +642,7 @@ program .option('-t, --tmp [dir]', 'Specify tmp directory for exporting frames') .option('-a, --avconv', 'Specify avconv if preferred to ffmpeg') .option('-R, --random', 'Randomize frames. Ignores pattern if included') + .option('-s, --spin', 'Randomly rotate frames before rendering') .option('-e, --exec', 'Command to execute on every frame. Specify {{i}} and {{o}} if the command requires it, otherwise frame path will be appended to command') .option('-q, --quiet', 'Suppresses all log messages') .parse(process.argv); diff --git a/src/frameloom.ts b/src/frameloom.ts index 25a0361..003f0e7 100755 --- a/src/frameloom.ts +++ b/src/frameloom.ts @@ -498,6 +498,10 @@ async function spinFrames () { if (randomInt(0, 1) === 1) { flop = '-flop ' } + if (flip === '' && flop === '' && rotate === '') { + //skip unrotated, unflipped and unflopped frames + continue + } cmd = `convert ${framePath} ${rotate}${flip}${flop} ${framePath}` console.log(cmd) try { @@ -643,6 +647,15 @@ async function main (arg : any) { return process.exit(5) } + if (arg.spin) { + try { + await spinFrames() + } catch (err) { + log('Error spinning', err) + return process.exit(13) + } + } + if (e) { try { await subExec(e) @@ -678,6 +691,7 @@ program .option('-t, --tmp [dir]', 'Specify tmp directory for exporting frames') .option('-a, --avconv', 'Specify avconv if preferred to ffmpeg') .option('-R, --random', 'Randomize frames. Ignores pattern if included') + .option('-s, --spin', 'Randomly rotate frames before rendering') .option('-e, --exec', 'Command to execute on every frame. Specify {{i}} and {{o}} if the command requires it, otherwise frame path will be appended to command') .option('-q, --quiet', 'Suppresses all log messages') .parse(process.argv)