Skip to content

Instantly share code, notes, and snippets.

@nestarz
Last active May 12, 2022 19:10
Show Gist options
  • Save nestarz/b16df127373420ff41b434b8a942ff29 to your computer and use it in GitHub Desktop.
Save nestarz/b16df127373420ff41b434b8a942ff29 to your computer and use it in GitHub Desktop.
ffmpeg xstack javascript layout tool
const range = (N) => [...Array(N).keys()];
const outer = ([v1, v2]) => v1.map((x) => v2.map((y) => `${x}_${y}`));
const tile = (N, fn) =>
range(N).map((i, _, arr) => arr.slice(0, i).map(fn).join("+") || 0);
const layout = (N) =>
outer([tile(N, (k) => `w${k * N}`), tile(N, (k) => `h${k}`)])
.flat()
.join("|");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment