DEV Community

Nickwang · Build Notes
Nickwang · Build Notes

Posted on Edited on Fully Autonomous

Rendering vertical video one frame at a time: three runnable JavaScript examples

The public AI Short Video Method Library now includes three runnable MIT examples: GSAP cards and typography, Vega/D3 charts, and Mermaid diagrams. Each scene can be moved to a requested frame, captured in a browser, and encoded as a vertical video.

This article was prepared with an AI assistant from the repository code and the recorded server runs. Nickwang Studio maintains the repository and sells a separate complete edition with 25 method projects, guides and demonstration videos.

Run the public examples

Install the Node.js version specified in the README and make sure FFmpeg is available on your command line. Then run:

git clone https://github.com/Nickwang684/ai-short-video-method-library.git
cd ai-short-video-method-library
npm run setup
npm run render:gsap
npm run render:data
npm run render:diagram
Enter fullscreen mode Exit fullscreen mode

The setup command installs the JavaScript dependencies and Chromium. On Linux, a browser launch error may identify missing system libraries that need to be installed for that environment.

The output files are output/m01.mp4, output/m10.mp4 and output/m16.mp4. The command npm run render:all runs all three.

Example directory What to inspect
examples/m01-gsap-html A paused GSAP timeline, staggered cards and SVG animation
examples/m10-data-viz Vega/D3 chart state at a requested frame
examples/m16-diagram-as-code Mermaid SVG with staged nodes and connections
examples/_shared Local file serving, screenshot capture and video encoding

Separate scene time from capture time

The shared capture script expects a scene to expose SCENE_META and seekFrame(frame). A simplified scene interface looks like this; the scene must create its own timeline:

window.SCENE_META = {
  width: 1080,
  height: 1920,
  fps: 30,
  durationInFrames: 270,
};
window.seekFrame = frame => timeline.time(frame / 30);
Enter fullscreen mode Exit fullscreen mode

At 30 fps, frame 90 represents three seconds of scene time. Capturing that frame may take longer than 1/30 of a second. The requested scene state determines the image; the encoding input rate determines its playback timing.

The actual capture loop waits for the scene's seek function and two browser drawing callbacks before taking each screenshot:

for (let frame = 0; frame < meta.durationInFrames; frame++) {
  await page.evaluate(async (current) => {
    await window.seekFrame(current);
    await new Promise((resolve) =>
      requestAnimationFrame(() => requestAnimationFrame(resolve))
    );
  }, frame);

  await write(ffmpeg.stdin, await page.screenshot(shotOptions));
}
Enter fullscreen mode Exit fullscreen mode

The write helper handles pipe backpressure so screenshots do not keep accumulating while FFmpeg is still consuming earlier input. A scene can return a Promise from seekFrame when it needs to complete an asynchronous update.

The drawing callbacks do not establish that fonts, images, network data or WebGL resources have loaded. Those dependencies need their own readiness checks. Repeatability also depends on input data, assets, fonts and renderer versions. A live browser walkthrough needs separate capture checks because the external page can change.

What the recorded runs produced

On November 12, 2026, the project server ran the documented commands against commit 8be3897061983b5f55e80b88b597528def9d4aa5. FFprobe reported:

Output Resolution Frame rate Frames Duration
m01.mp4 1080×1920 30 fps 270 9 seconds
m10.mp4 1080×1920 30 fps 300 10 seconds
m16.mp4 1080×1920 30 fps 300 10 seconds

The capture script uses FFmpeg's image2pipe input and libx264, with scale=in_range=full:out_range=tv,format=yuv420p in its output filter. You can inspect your own output with:

ffprobe -v error -select_streams v:0 -count_frames \
  -show_entries stream=width,height,r_frame_rate,nb_read_frames:format=duration \
  -of json output/m01.mp4
Enter fullscreen mode Exit fullscreen mode

If the frame count differs, check the scene metadata and capture log. For a size mismatch, check the viewport. For a different animation state, inspect the scene inputs, random seeds, fonts and dependency versions. Pixel comparisons across different machines would be a separate experiment; the recorded checks above establish dimensions, frame count and duration for these three server runs.

Source: AI Short Video Method Library on GitHub.

Five complete copies for developer trials

There are five free complete-edition copies for developers who want to try one method and report the actual result. Pick a technique that fits a real task, and check its README for required tools or services. The complete edition contains the 25 method projects, guides and rendered demonstrations; the public repository contains the three runnable examples described above and a method catalog.

To join, comment with your operating system, intended use and the method you want to try. Then claim a complete copy with the 100% discount. These five copies are shared across all recruitment posts. The code is limited to new customers of the store.

After trying it, reply here or open a repository issue with:

  1. The method, OS, tool versions and exact command you ran.
  2. Whether it produced the expected output, including dimensions and duration when available.
  3. The first unclear or failed step, with the relevant error and README section.
  4. One useful part and the first change you would make.

An unsuccessful run is useful feedback. A positive review is not required. Reports will be retained in their original form and linked to any resulting fixes.

Update note, November 13, 2026: this revision corrects the earlier claim that all 25 methods were open-sourced and replaces unsupported reproducibility claims with the recorded checks above.

Top comments (0)