Add spin back to frameloom as -s, --spin flag. Skip frames that aren't rotated.

This commit is contained in:
mmcwilliams 2019-08-05 12:19:11 -04:00
parent 4e27edcfa9
commit cbc7745f02
2 changed files with 28 additions and 5 deletions

View File

@ -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);

View File

@ -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)