Docs/Skills and code/skill video-visual-production

.claude/skills/video-visual-production/scripts/preview-scene.js

Code25 lines1.6 KBSkill: video-visual-production

What the file says about itself

See one scene as a PNG in about a second, without rendering any video. Use it to check an edit before a rebuild. node preview-scene.js --sheet <beat-sheet.json> --scene B1.06 [--at 0.9] [--t 5.5] --at is a fraction of the scene (default…

#!/usr/bin/env node
// See one scene as a PNG in about a second, without rendering any video. Use it to check an edit before a rebuild.
//   node preview-scene.js --sheet <beat-sheet.json> --scene B1.06 [--at 0.9] [--t 5.5]
// --at is a fraction of the scene (default 0.95, the fully built state); --t is seconds into the scene.
const fs = require('fs');
const path = require('path');
const U = require('./lib/util');

const sheetPath = U.fromRoot(U.arg('sheet', ''));
const sheet = U.readJSON(sheetPath);
const vdir = path.dirname(sheetPath);
const bdir = U.buildDir(sheet.slug, sheet.beat);
const r1 = U.run(process.execPath, [path.join(__dirname, 'timeline.js'), '--sheet', sheetPath]);
if (r1.status !== 0) U.die(r1.stdout + r1.stderr);
const tl = U.readJSON(path.join(vdir, `timeline-${sheet.beat}.json`));
const id = U.arg('scene', '');
const sc = tl.scenes.find((s) => s.id === id || s.id.endsWith('.' + id));
if (!sc) U.die('no scene ' + id);
const t = U.arg('t', null) != null ? parseFloat(U.arg('t')) : sc.dur_s * parseFloat(U.arg('at', '0.95'));
const frame = Math.min(sc.end - 1, sc.start + Math.round(t * tl.fps));
const dir = path.join(bdir, 'preview');
const r2 = U.run(process.execPath, [path.join(U.SKILL, 'render', 'render.js'), '--timeline', path.join(vdir, `timeline-${sheet.beat}.json`), '--assets', path.join(bdir, 'assets'), '--stills', String(frame), '--stills-dir', dir]);
if (r2.status !== 0) U.die(r2.stdout + r2.stderr);
U.say(`${sc.id} (${sc.type}) at ${((frame - sc.start) / tl.fps).toFixed(2)} s of ${sc.dur_s.toFixed(1)} s -> ${path.join(dir, 'f_' + String(frame).padStart(5, '0') + '.png')}`);

Shown as it is in the repository at build time (2026-11-03); the home directory appears as <home>. If this page and the file differ, the file is right. Back to the catalogue.