Add spin back to frameloom as -s, --spin flag. Skip frames that aren't rotated.
This commit is contained in:
parent
4e27edcfa9
commit
cbc7745f02
19
frameloom
19
frameloom
|
@ -464,6 +464,10 @@ async function spinFrames() {
|
||||||
if (randomInt(0, 1) === 1) {
|
if (randomInt(0, 1) === 1) {
|
||||||
flop = '-flop ';
|
flop = '-flop ';
|
||||||
}
|
}
|
||||||
|
if (flip === '' && flop === '' && rotate === '') {
|
||||||
|
//skip unrotated, unflipped and unflopped frames
|
||||||
|
continue;
|
||||||
|
}
|
||||||
cmd = `convert ${framePath} ${rotate}${flip}${flop} ${framePath}`;
|
cmd = `convert ${framePath} ${rotate}${flip}${flop} ${framePath}`;
|
||||||
console.log(cmd);
|
console.log(cmd);
|
||||||
try {
|
try {
|
||||||
|
@ -495,11 +499,6 @@ async function render(output, avconv) {
|
||||||
const cmd = `${exe} -r ${framerate} -f image2 -s ${resolution} -i ${frames} ${format} -y ${output}`;
|
const cmd = `${exe} -r ${framerate} -f image2 -s ${resolution} -i ${frames} ${format} -y ${output}`;
|
||||||
log(`Exporting video ${output}`);
|
log(`Exporting video ${output}`);
|
||||||
log(cmd);
|
log(cmd);
|
||||||
/*try {
|
|
||||||
await exec(`ls "${TMPPATH}"`)
|
|
||||||
} catch (err) {
|
|
||||||
log(err)
|
|
||||||
}*/
|
|
||||||
try {
|
try {
|
||||||
await exec(cmd);
|
await exec(cmd);
|
||||||
}
|
}
|
||||||
|
@ -600,6 +599,15 @@ async function main(arg) {
|
||||||
log('Error weaving', err);
|
log('Error weaving', err);
|
||||||
return process.exit(5);
|
return process.exit(5);
|
||||||
}
|
}
|
||||||
|
if (arg.spin) {
|
||||||
|
try {
|
||||||
|
await spinFrames();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
log('Error spinning', err);
|
||||||
|
return process.exit(13);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (e) {
|
if (e) {
|
||||||
try {
|
try {
|
||||||
await subExec(e);
|
await subExec(e);
|
||||||
|
@ -634,6 +642,7 @@ program
|
||||||
.option('-t, --tmp [dir]', 'Specify tmp directory for exporting frames')
|
.option('-t, --tmp [dir]', 'Specify tmp directory for exporting frames')
|
||||||
.option('-a, --avconv', 'Specify avconv if preferred to ffmpeg')
|
.option('-a, --avconv', 'Specify avconv if preferred to ffmpeg')
|
||||||
.option('-R, --random', 'Randomize frames. Ignores pattern if included')
|
.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('-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')
|
.option('-q, --quiet', 'Suppresses all log messages')
|
||||||
.parse(process.argv);
|
.parse(process.argv);
|
||||||
|
|
|
@ -498,6 +498,10 @@ async function spinFrames () {
|
||||||
if (randomInt(0, 1) === 1) {
|
if (randomInt(0, 1) === 1) {
|
||||||
flop = '-flop '
|
flop = '-flop '
|
||||||
}
|
}
|
||||||
|
if (flip === '' && flop === '' && rotate === '') {
|
||||||
|
//skip unrotated, unflipped and unflopped frames
|
||||||
|
continue
|
||||||
|
}
|
||||||
cmd = `convert ${framePath} ${rotate}${flip}${flop} ${framePath}`
|
cmd = `convert ${framePath} ${rotate}${flip}${flop} ${framePath}`
|
||||||
console.log(cmd)
|
console.log(cmd)
|
||||||
try {
|
try {
|
||||||
|
@ -643,6 +647,15 @@ async function main (arg : any) {
|
||||||
return process.exit(5)
|
return process.exit(5)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arg.spin) {
|
||||||
|
try {
|
||||||
|
await spinFrames()
|
||||||
|
} catch (err) {
|
||||||
|
log('Error spinning', err)
|
||||||
|
return process.exit(13)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (e) {
|
if (e) {
|
||||||
try {
|
try {
|
||||||
await subExec(e)
|
await subExec(e)
|
||||||
|
@ -678,6 +691,7 @@ program
|
||||||
.option('-t, --tmp [dir]', 'Specify tmp directory for exporting frames')
|
.option('-t, --tmp [dir]', 'Specify tmp directory for exporting frames')
|
||||||
.option('-a, --avconv', 'Specify avconv if preferred to ffmpeg')
|
.option('-a, --avconv', 'Specify avconv if preferred to ffmpeg')
|
||||||
.option('-R, --random', 'Randomize frames. Ignores pattern if included')
|
.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('-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')
|
.option('-q, --quiet', 'Suppresses all log messages')
|
||||||
.parse(process.argv)
|
.parse(process.argv)
|
||||||
|
|
Loading…
Reference in New Issue