Foldline

v1.2.0
io.github.alireza12t/foldline Checked 8 hours ago Published 21 days ago

Render HTML canvas animations to MP4 fast on a Mac, with 66 code-made film styles for agents.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

find_styles Find film styles

Search the 66 film styles by words (name, category, use, demo film). Returns one short line per style. Leave query empty to list all.

ParameterTypeDescription
querystringWords to match, e.g. "paper", "news", "3d", "kids".

get_style Get a style prompt

Returns a style's STYLE.md: its look, rules and prompt. include_demo adds DEMO.md (how its demo film was made), which is long.

ParameterTypeDescription
slug *stringStyle folder, e.g. "art-deco". Use find_styles to look one up.
include_demoboolean

read_guide Read a guide

Reads one of the library guides. Without a section it returns the table of contents only, so you can ask for just the part you need. Guides: agents (how to direct and produce a film), director (story, sound, rhythm, camera, checks), technique (page contract, voice, music, mix), my-styles (making a style your own), tools (every command and flag), instruments (sampled instruments), readme, notice (licences).

ParameterTypeDescription
guide *string
fullbooleanReturn the whole guide. Long; prefer a section.
sectionstringHeading text (or part of it) to return, with its subsections.

render_stills Render review stills

Renders JPEG stills of a film at given seconds, to look at before a full render. Returns the file paths. With sheet=true it also makes one contact sheet and returns it as an image, which is cheaper to look at than many stills.

ParameterTypeDescription
demo *stringFolder that holds the film's index.html (absolute path, or relative to the library root).
outstringFolder for the stills. Default <demo>/stills.
qstringQuery string passed to the page as location.search, e.g. 'lang=en&cut=b'.
rangestringstart:end:step in seconds, e.g. "0:30:5".
sheetbooleanAlso make a contact sheet (needs the Python environment) and return it inline.
sheet_colsinteger
sizestringFrame size WxH, even numbers. Default 1920x1080; 1080x1920 for a vertical Short.
timesarraySeconds to render, e.g. [0, 2.5, 10].

render_video Render the film to MP4

Renders every frame of a film to an H.264 MP4 at low priority, with the in-page hardware encoder by default. Before saving, it checks the file: every rendered frame decodes and the soundtrack runs from the start to the end of the film; a short or misaligned file fails. Returns the output path, frame count, time and encoder (enc=wc is the fast path), not the progress log. Sends progress if the client asks for it.

ParameterTypeDescription
demo *stringFolder that holds the film's index.html (absolute path, or relative to the library root).
allow_short_audiobooleanSet true only when the soundtrack is meant to end before the film: it is then left short instead of padded. Default false.
audiostringSound file to mux in (AAC 192k). A soundtrack shorter than the film is padded with silence; a longer one is cut at the end. For a mastered mix use mux_audio instead.
encoderstringauto (default) tries WebCodecs, then VideoToolbox, then x264.
fpsnumberDefault 24.
mbpsnumberBitrate for the WebCodecs path. Default 20.
outstringOutput mp4. Default <demo>/out/video.mp4. Each parallel render needs its own out.
qstringQuery string passed to the page as location.search, e.g. 'lang=en&cut=b'.
sizestringFrame size WxH, even numbers. Default 1920x1080; 1080x1920 for a vertical Short.
workersintegerParallel browser workers. Default 3.

check_reading Check on-screen text timing

Checks that every on-screen text stays fully in frame long enough to read (the page must expose window.TEXTS(t)). Returns only the failures and a count.

ParameterTypeDescription
demo *stringFolder that holds the film's index.html (absolute path, or relative to the library root).
cjk_cpsnumberCJK characters per second. Default 4.5.
latin_cpsnumberLatin characters per second. Default 15.
qstringQuery string passed to the page as location.search, e.g. 'lang=en&cut=b'.
sizestringFrame size WxH, even numbers. Default 1920x1080; 1080x1920 for a vertical Short.
stepnumberSeconds between checks. Default 0.04.

export_events Export sound cues

Exports the page's window.DUR and window.EV (sound and cue events) to JSON for the mix. Returns the path and the number of events.

ParameterTypeDescription
demo *stringFolder that holds the film's index.html (absolute path, or relative to the library root).
outstringDefault <demo>/events.json.
qstringQuery string passed to the page as location.search, e.g. 'lang=en&cut=b'.
sizestringFrame size WxH, even numbers. Default 1920x1080; 1080x1920 for a vertical Short.

make_voice Make voice lines (TTS)

Turns lines of text into trimmed WAV files and dur.json. engine "kokoro" is offline (default); "edge" is Microsoft Edge TTS, online; "qwen" is Qwen3-TTS on MLX (Mac with Apple silicon, local, free; voices ryan, aiden, vivian, serena, uncle_fu, dylan, eric, ono_anna, sohee; per-line instruct; numbers spelled out; every take checked for a cut end and by Whisper, bad takes redone). Returns each line's duration. Needs the voice tier (setup.sh deps voice), or for qwen the qwen tier (setup.sh deps qwen; the model, about 3.1 GB, downloads on first use).

ParameterTypeDescription
lines *array
out_dir *stringFolder for <id>.wav and dur.json. lines.json is written there too.
enginestring

check_voice Check voice lines with speech-to-text

Runs Whisper over every <id>.wav and compares it with the text. Writes words.json (word timestamps). Returns only the lines that failed and a count.

ParameterTypeDescription
lines_json *stringThe lines.json used for the voice.
voices_dir *string
langstring

mux_audio Mux and master sound

Puts a mix under the video: two-pass loudness to -14 LUFS, true peak -1.2 dB, optional film grain. A mix shorter than the video is padded with silence, a longer one cut at the end. Before handing over, it checks the frame count and that the sound starts and ends with the picture. Returns the output path and the measured loudness.

ParameterTypeDescription
audio *stringThe mix, e.g. mix.wav.
out *string
video *string
fpsnumberDefault 24.
grainnumberFilm grain, 0 for none. Default 2.

make_subtitles Make an SRT file

Writes an .srt subtitle file from cues.

ParameterTypeDescription
cues *array
out *stringPath of the .srt.

fetch_assets Download optional big assets

Downloads assets that are not shipped with Foldline into its library folder: the Kokoro voice model (voice), the HDRI skies that 3D styles light with (hdri), or a sampled instrument library (instruments).

ParameterTypeDescription
what *string
libstringFor instruments: which library.