Miraiclip SDK
Templates

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-export

render

npx miraiclip-templates render promo.miraiclip-template.json \
  --data leads.csv --out "out/{index}-{name}.mp4" --quality high --concurrency 2

Example 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
FlagDefaultWhat it does
<template.json>requiredThe template file. Checked with parseTemplate
--data <file>requiredRows: .csv (header row), .ndjson or .jsonl, otherwise a JSON array
--out <pattern>requiredOutput path per row. {field} and {index} substitute, as in Output paths
--format mp4|webmthe --out extensionContainer. Required when --out doesn't end in .mp4 or .webm
--quality draft|standard|highstandardQuality preset
--fps <n>the template'sOutput frame rate
--width <px>, --height <px>the composition sizeOutput size
--concurrency <n>1Browsers working the rows in parallel
--assets-dir <dir>the template file's folderBase folder for relative asset paths
--browser <path>MIRAICLIP_BROWSER, then installed ChromeChrome or Chromium binary. MP4 needs Google Chrome
--stop-on-erroroffStop starting rows after the first failure
OutputWhere
Progress, one line per rowstderr
Exit code0 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.json
template "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 help

help 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.

On this page