Open-Source vs Closed-Source LLMs: Capability Gaps and a Frontend Video Rendering Workflow
This article compares open-source and closed-source LLMs across code generation, long-text understanding, and tool calling, then presents a practical video rendering workflow that uses AI-generated HTML/CSS/JavaScript, headless-browser frame capture, and FFmpeg encoding.
As large-scale open-source models continue to be released, developers are paying more attention to what these models can actually do in real engineering work. This article first compares the gap between open-source and closed-source models across three core capabilities, then uses a video rendering case to demonstrate how open-source models perform in an engineering scenario.
1. Capability Gaps Between Open-Source and Closed-Source Models
The core capabilities of large models determine the upper limit of engineering work. The table below lists common tasks, current observations, and applicable boundaries for three capability areas.
| Capability area | Common tasks | Current observation | Applicable boundary |
|---|---|---|---|
| Code generation | Single-module business code, page layout, routine scripts | Open-source models can already output usable, standards-compliant code | Cross-file architecture design and global dependency analysis still require manual review |
| Long-text understanding | Long document retrieval, cross-paragraph causal reasoning | Context windows can already hold large codebases and long documents | Detail recall and the stability of deep reasoning need to be validated with your own data |
| Tool calling | Function Calling, multi-step task decomposition, exception retry | Models can complete basic calls and simple task chains | Call-chain stability depends on strict prompt constraints and fault-tolerant design |
This article does not list specific model names or benchmark scores. Model versions update quickly, and public leaderboard results may not reflect your business scenario. When selecting a model, test candidate models on your own task set, record the model name, version, sampling parameters, test cases, and pass rate, and then make a decision.
2. Why Use Web Pages to Render Video
When producing product launch videos, data animations, and talking-head videos, there are two common approaches, and each has clear pain points.
The first is to use traditional editing software and drag the timeline frame by frame, which is time-consuming and expensive to modify. The second is to use frontend frameworks such as React to generate video code, but these projects have many dependencies, and slightly complex code is prone to errors and difficult to troubleshoot.
The approach used in this article is to have AI generate ordinary HTML, CSS, and JavaScript pages directly, then use a headless browser to capture screenshots frame by frame, and finally encode them into MP4 with FFmpeg. This way, the code AI needs to generate is simpler, there are fewer dependencies, and the rendering process is easier to reproduce.
3. Hands-On Steps
1. Prepare the Runtime Environment
You need the following tools:
- Node.js 18 or a later LTS version
- npm, installed with Node.js
- FFmpeg, used to combine an image sequence into a video
Run the following commands in the terminal to confirm the versions and initialize the project:
node -vnpm -vffmpeg -versionmkdir video-render && cd video-rendernpm init -ynpm install puppeteer
npm install puppeteer downloads Chromium, so network access is required. FFmpeg can be installed through the system package manager, for example brew install ffmpeg on macOS and sudo apt install ffmpeg on Ubuntu. Windows users can download it from the FFmpeg official website and add the directory containing the executable files to PATH.
You can ask AI to help check the environment with the following prompt:
Please check whether Node.js, npm, and FFmpeg are available on this machine. If the versions do not meet the requirements, provide the installation commands for the corresponding system. Then initialize the project in the video-render directory and report the version numbers and time consumed for each tool.
Pitfall guide: confirm the scope before deleting dependency directories. AI may clean node_modules or old caches when reinstalling dependencies. When a tool shows a blocking prompt such as “batch deletion, high risk,” handle it as follows:
- Check the absolute paths listed in the dialog and confirm that they point only to node_modules or cache directories.
- Back up package.json and package-lock.json before deletion.
- Do not approve deletion operations that contain wildcards or may match parent directories or business code directories.
2. Capture Assets and Generate an Animated Page
Only read pages from your own website or websites for which you have obtained authorization, and confirm the usage rights of assets before use. Do not directly reuse unauthorized fonts, images, trademarks, or copy.
After confirming authorization, you can ask AI to extract CSS variables from the page as colors and font sizes, and then generate an animated page:
Please read the source code of an authorized product page, extract the CSS variables in :root as colors and font sizes, and summarize the core copy. Use native HTML, CSS, and JS to generate a vertical 9:16 animated page of about 20 seconds, including camera cuts, text fade-in animations, and a final Logo ending. The page must provide a window.seekToFrame(frame) method that sets the animation state to the corresponding time point by frame number at 30 fps, without relying on setTimeout or CSS real-time animation.
Frame-by-frame rendering requires the animation state to be fully determined by the frame number. If the animation depends on real time, the image captured for each screenshot may be inconsistent. Here is an example:
<script>const FPS = 30;window.seekToFrame = (frame) => {const t = frame / FPS; // current time in secondsconst title = document.querySelector('.title');title.style.opacity = Math.min(t / 1.5, 1); // fade in within 1.5 seconds};</script>
If the generated page fails inspection, you can submit the error information and page source code to the model for correction. After two consecutive failed corrections, it is recommended to write the key animation parts manually.
3. Render Frame-by-Frame Screenshots
The script below includes page load waiting, paint waiting, screenshot retry, and resource release. Replace the page URL with the absolute path to the animated page.
const puppeteer = require('puppeteer');const fs = require('fs');const path = require('path');const WIDTH = 1080;const HEIGHT = 1920;const FPS = 30;const TOTAL_FRAMES = 600; // 20 seconds × 30 fpsconst PAGE_URL = 'file:///absolute/path/to/animation.html';const FRAMES_DIR = path.resolve('./frames');// Wait for two requestAnimationFrame calls to ensure the state set by seekToFrame has been paintedasync function waitForPaint(page) {await page.evaluate(() => new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve))));}// Retry when a screenshot fails, and throw an error after the retry limitasync function screenshotWithRetry(page, file, retries = 3) {for (let attempt = 1; ; attempt++) {try {await page.screenshot({ path: file });return;} catch (err) {if (attempt >= retries) throw err;}}}async function renderVideo() {fs.mkdirSync(FRAMES_DIR, { recursive: true });const browser = await puppeteer.launch();try {const page = await browser.newPage();// The remaining render loop uses waitForPaint, screenshotWithRetry, and resource cleanup.
