How to Make Stickman Short Videos with an AI Coding Assistant: A Low-Cost Reproduction Guide
Generative video models are expensive to run at scale, drift in character consistency, and require full regeneration for small script edits. This guide explains how to render stickman videos with code instead: using a SKILL.md spec to constrain an AI coding assistant, a deterministic frame-based rendering engine, and Playwright plus FFmpeg for export. It covers environment setup, directory structure, prompt design, cost estimation, and common pitfalls.
1. Three Problems with Generative Video Models at Production Scale
Short-video teams targeting overseas audiences need stable output while keeping budgets under control. Calling generative video models directly usually leads to three problems.
Costs scale with rerolls. Generative video is billed per second or per generation. Generating repeatedly until you get a satisfactory result drains a monthly budget quickly. When operations require multiple pieces of content per day, cost grows roughly in proportion to output.
Character inconsistency across shots. When the same character appears in different shots, the face, clothing, and body shape often fail to match. Viewers can spot the drift at a glance, which makes it hard to build a recognizable character IP.
Changing one line means regenerating everything. The typical workflow is publish, review the data, revise the copy, and republish. In generative video, changing a single line of dialogue can affect lip sync, pacing, and camera movement, so the entire video has to be regenerated.
2. The Code-Rendering Approach and Its Boundaries
A stickman consists of nothing but lines, joints, and geometric shapes, all of which can be fully described in code. This approach has three advantages.
- Determinism. The same input produces the same frames, with no need for repeated rerolls.
- Editability. To change a line of dialogue, you only edit the copy array and its timestamps; character motion and camera logic stay untouched.
- Low marginal cost. Rendering happens in a local browser and mainly consumes local CPU time.
In this workflow, the AI coding assistant is responsible for writing the code. Its output quality still fluctuates, so it must be constrained by a spec file. The next section explains how.
This method fits stickman explainers, line animations, geometric diagrams, and data motion graphics. Live-action footage, photorealistic visuals, complex lighting, and nuanced facial expressions are out of scope; those still require generative video or real shooting.
3. Comparing the Three Approaches
| Dimension | Generative video model | Raw code (no spec) | Code rendering with a Skill |
|---|---|---|---|
| Billing | Per second or per generation, price depends on the platform | Billed per model call | Billed per model call; see Section 7 for estimates |
| Character consistency | Prone to drift across shots | Proportions vary each time | Skeleton proportions locked by formulas |
| Output stability | Different result every reroll | Random quality each time | Same input, same frames |
| Changing one line | Usually requires full regeneration | Often requires restructuring the page | Only edit the script copy array |
In the original tests, the raw-code version finished in about a minute and the page ran, but the head-to-body ratio was distorted, the arm lines were crooked, and the animation logic was coupled with the page structure. The test sample was small, so treat the conclusion as indicative only. Readers can rerun the same test themselves.
4. Preparing the Environment
Use the following versions and verify them before starting.
- Node.js: 20 LTS or 22 LTS; 18 is the minimum supported. Check with
node -v. - FFmpeg: 6.0 or later, callable directly from the command line. Check with
ffmpeg -version. - Browser: Chrome or Edge 120 or later. You can also use the Chromium bundled with Playwright, which is easier to pin to a fixed version.
- Playwright: Pin a specific version in package.json, for example 1.47.2, and commit package-lock.json.
5. Directory Structure and the Skill Spec File
Create a spec folder in the project root with this structure:
project-root/├── .claude/│ └── skills/│ └── stickman-animator/│ ├── SKILL.md # Spec document│ ├── engine.js # Skeleton and joint rendering library│ └── export.js # Export script, captures frames one by one├── script.json # Shots and copy└── index.html # Page entry, exposes the renderAt function
SKILL.md is the most critical file. Here is a minimal template:
# stickman-animator## Character- Fixed as "a programmer stickman wearing black-rimmed glasses"- Line color #222222, background #FFFFFF## Skeleton proportions (based on head radius r)- Head radius: r = 40 px- Torso length: 5r- Upper arm, forearm: 2.5r each- Thigh, shin: 3r each- These proportions must not be modified## Animation rules- Frame rate: 60fps- Duration: 15 seconds, 900 frames total (60 × 15)- Easing: easeInOutCubic- Joint interpolation: linearly interpolate joint angles first, then apply easing## Shot structure- Shot 1: 0–5 s; Shot 2: 5–10 s; Shot 3: 10–15 s- Subtitle timing is defined in script.json and synced with the shots
engine.js handles drawing and interpolation; the business code only passes in shot data. The interface can be designed with these signatures:
// engine.jsexport function createStage({ width, height, fps }) { /* returns canvas context and size info */ }export function drawStickman(ctx, pose, { r }) { /* draws one stickman per the skeleton proportions */ }export function interpolatePose(poseA, poseB, t) { /* t in [0, 1], returns the intermediate pose */ }export function renderAt(stage, scene, frameIndex) { /* draws the frame at frameIndex */ }
The render function must depend only on the frame index. Do not use Date.now, Math.random, or setTimeout, otherwise the same input will not produce the same output.
The export.js flow is: launch a headless browser, open index.html, call renderAt frame by frame, and save screenshots. FFmpeg then assembles the screenshots into a video. Below is a simplified sketch; you need to fill in argument parsing yourself:
// export.js (simplified sketch)import { chromium } from 'playwright';import fs from 'node:fs';import path from 'node:path';const TOTAL = 900; // 60fps × 15 secondsconst outDir = path.resolve('out/frames');fs.mkdirSync(outDir, { recursive: true });const browser = await chromium.launch({ headless: true });const page = await browser.newPage({ viewport: { width: 1280, height: 720 } });await page.goto('file://' + path.resolve('index.html'));for (let i = 0; i < TOTAL; i++) {await page.evaluate((f) => window.renderAt(f), i);const name = String(i).padStart(4, '0') + '.png';await page.screenshot({ path: path.join(outDir, name) });}await browser.close();
6. Prompt and Minimal Run Commands
A prompt for the AI coding assistant can look like this:
First read .claude/skills/stickman-animator/SKILL.md and strictly follow its skeleton proportions and animation rules.Task: generate a 15-second, 60fps stickman explainer page based on script.json.Constraints:1. Only modify the scenes and subtitles fields; do not modify the drawing logic in engine.js;2. All animation must be driven by renderAt(frame); setTimeout and requestAnimationFrame are forbidden;3. After generating index.html, run the export and confirm the output frame count is 900.
The full run sequence is:
npm installnode .claude/skills/stickman-animator/export.jsffmpeg -y -framerate 60 -i out/frames/%04d.png -c:v libx264 -pix_fmt yuv420p -crf 18 out/video.mp4
The first step installs dependencies, the second captures frames into out/frames, and the third assembles them into out/video.mp4. After assembly, use ffprobe to check the frame rate and duration, confirming roughly 60fps and 15 seconds.
7. Cost Estimation
The original text’s claim of “a few dimes” lacked a calculation basis. The estimate below is redone with explicit assumptions. Replace these assumptions with the actual unit prices of your own platform.
Assume one complete task—including reading the Skill, generating code, and fixing errors—consumes about 30,000 input tokens and 15,000 output tokens. Assume the model is priced at $1 per million input tokens and $4 per million output tokens. The cost per call is then:
- Input: 30,000 tokens ÷ 1,000,000 × $1 = $0.03
- Output: 15,000 tokens ÷ 1,000,000 × $4 = $0.06
- Total: about $0.09
If a video needs two rounds of fixes at similar consumption, the total is about $0.27. So under these assumptions, the cost per video is roughly $0.1 to $0.3.
When revising dialogue, if you only change the copy and timestamps in script.json, you just need to re-export—no model call is necessarily required, and the main cost is local rendering time.
Generative video is billed per second. The original text gave no comparison price, so this article makes no claim about a specific percentage of savings. Readers can compare their own platform’s pricing against the actual spend of this approach.
8. Risks and Common Issues
- Rendering time. 900 frames means 900 screenshots. Duration depends on machine performance and resolution and must be measured. If a single frame takes 100 ms, one video takes about 90 seconds.
- Missing CJK fonts. If Chinese characters show as boxes, the system lacks the corresponding font. Install Noto Sans CJK and specify font-family in CSS.
- Linux sandbox errors. In some environments Chromium fails to launch; try adding the
--no-sandboxflag. This flag weakens isolation, so only use it for trusted local pages—never load content from unknown sources with it. - FFmpeg not found. Check whether FFmpeg is on the system PATH and confirm with
ffmpeg -version. - Wrong frame count. Check that fps × duration equals 900. If the output frame count is low, real time has likely leaked into renderAt.
- Licensing. Fonts and assets need license verification. Prefer fonts under licenses that explicitly allow commercial use, such as the SIL Open Font License.
- Code review. Model-generated export scripts and rendering logic need human review, especially file paths and deletion operations.
9. Conclusion
This method suits content that is highly deterministic and visually simple, such as stickman explainers and line motion graphics. Its value lies in giving every output a consistent baseline and making revisions a matter of editing configuration.
Implementation can follow three steps. First write SKILL.md, then keep engine.js stable, and finally put shots and copy into script.json. As long as these three parts stay separate, revising content never requires regenerating the entire video.
