#!/usr/bin/env node // caption-burn.mjs — burn styled captions onto a video + attach an audio track. // // This ffmpeg build has NO libass, so captions are drawn in node-canvas over a // raw-frame pump (same approach as pop/menuband/bin/finalize-vo.mjs), then the // audio (VO) is muxed in by the encoder. Portrait-friendly defaults. // // Usage: node marketing/bin/caption-burn.mjs [W H FPS] import { readFileSync } from "node:fs"; import { spawn } from "node:child_process"; import { once } from "node:events"; import { createCanvas, registerFont } from "canvas"; import { spawnFFmpegEncode } from "../../pop/lib/preview-shared.mjs"; const [VIDEO, AUDIO, SRT, OUT, wArg, hArg, fpsArg, crfArg] = process.argv.slice(2); if (!VIDEO || !AUDIO || !SRT || !OUT) { console.error("usage: caption-burn.mjs