CLI
miraiclip-templates render and describe.
@miraiclip/templates ships a miraiclip-templates command. It renders a template once per data row and prints a template's fields. Rendering needs @miraiclip/server-export and Chrome, as in Batch rendering.
npm install @miraiclip/templates @miraiclip/server-exportrender
npx miraiclip-templates render promo.miraiclip-template.json \
--data leads.csv --out "out/{index}-{name}.mp4" --quality high --concurrency 2Example output (sizes and times vary):
rendering 2 row(s) of "Promo" → out/{index}-{name}.mp4
[1/2] row 0 → out/0-Ada.mp4 (412 KB)
[2/2] row 1 FAILED: invalid data: data.discount: expected a number, got number
1/2 row(s) failed after 9.8s| Flag | Default | What it does |
|---|---|---|
<template.json> | required | The template file. Checked with parseTemplate |
--data <file> | required | Rows: .csv (header row), .ndjson or .jsonl, otherwise a JSON array |
--out <pattern> | required | Output path per row. {field} and {index} substitute, as in Output paths |
--format mp4|webm | the --out extension | Container. Required when --out doesn't end in .mp4 or .webm |
--quality draft|standard|high | standard | Quality preset |
--fps <n> | the template's | Output frame rate |
--width <px>, --height <px> | the composition size | Output size |
--concurrency <n> | 1 | Browsers working the rows in parallel |
--assets-dir <dir> | the template file's folder | Base folder for relative asset paths |
--browser <path> | MIRAICLIP_BROWSER, then installed Chrome | Chrome or Chromium binary. MP4 needs Google Chrome |
--stop-on-error | off | Stop starting rows after the first failure |
| Output | Where |
|---|---|
| Progress, one line per row | stderr |
| Exit code | 0 when every row rendered, 1 when any row failed or the arguments are invalid |
CSV cells are converted to each field's type: see Rows from CSV and NDJSON.
The CLI has no --asset id=path flag. Asset src values, including those in rows, resolve against --assets-dir unless they are http(s): or data: URLs. For explicit asset mappings, call renderTemplateBatch with assets.
describe
Prints the template summary from describeTemplate to stdout.
npx miraiclip-templates describe promo.miraiclip-template.jsontemplate "Promo" — 1280x720 @ 30fps, 3 clips, 2 tracks
Promo card
fields:
- name (text)
- accent (color, optional, default "#ff8c32")
- size (number, optional, default 40)
- discount (number)
- footage (asset, asset bg, optional)help
npx miraiclip-templates helphelp and render --help print the usage and exit with 0. With no command, the usage prints and the exit code is 1. A top-level --help (miraiclip-templates --help) is read as an unknown command.