Text to vertical video in 100+ styles: AI codes each scene (HTML/SVG/WebGL), renders a 9:16 MP4 with music and English/Vietnamese voice. MCP, CLI and REST for AI agents.
#!/usr/bin/env node
// So EDL với đáp án của clip tổng hợp (make-synth.mjs): câu trọn phải nằm trọn trong đoạn giữ,
// câu nói dở phải bị bỏ hết. node edit/test/check-truth.mjs <edits/<id>/edl.json> <synth.truth.json>
import fs from 'node:fs';
const [edlFile, truthFile] = process.argv.slice(2);
const edl = JSON.parse(fs.readFileSync(edlFile, 'utf8'));
const truth = JSON.parse(fs.readFileSync(truthFile, 'utf8'));
const covered = (a, b) => { let t = a; for (const k of edl.keep) if (k.start <= t + 0.02 && k.end > t) t = Math.max(t, k.end); return t >= b - 0.02; };
const kept = (a, b) => edl.keep.reduce((s, k) => s + Math.max(0, Math.min(b, k.end) - Math.max(a, k.start)), 0);
let bad = 0;
for (const l of truth) {
if (l.partial) {
const k = kept(l.start, l.end);
const ok = k < 0.05; bad += !ok;
console.log(`${ok ? 'PASS' : 'FAIL'} câu nói dở ${l.start}–${l.end} s bị bỏ (còn giữ ${k.toFixed(2)} s)`);
} else {
const ok = covered(l.start, l.end); bad += !ok;
console.log(`${ok ? 'PASS' : 'FAIL'} giữ trọn ${l.start}–${l.end} s "${l.text}"`);
}
}
console.log(bad ? `${bad} lỗi` : 'tất cả PASS');
process.exit(bad ? 1 : 0);