Open-Source vs. Closed-Source LLMs: A Practical Web-to-Video Rendering Workflow

    This article examines the capability gap between open-source and closed-source large models and presents a reproducible workflow for rendering standard web pages into vertical videos. It covers practical differences in complex code generation, long-text understanding, and tool calling; the technical pain points of web-to-video production; environment setup with Puppeteer and ffmpeg; a frame-by-frame rendering script; output parameters; and methods for validating frame count, timestamps, and visual similarity. The goal is to show where open-source models are sufficient, where closed-source models still lead, and how to use a model-generated HTML/CSS/JavaScript page as the basis for automated video rendering.

    As large models continue to scale, some open-source models have reached trillion-parameter scale (specific models and release dates are subject to each vendor’s official announcements). This shows that the open-source ecosystem is improving quickly. At the same time, developers face a practical question: how large is the gap between open-source models and top closed-source models, and how should each be used in complex scenarios such as automated content production? This article answers the question in two parts: first, it summarizes the current state of the gap; second, it provides a reproducible practice plan for rendering standard web code into vertical video.

    1. The Current Gap Between Open-Source and Closed-Source Models

    The size of the gap depends on model version, evaluation set, and task type. The judgments below are based on everyday developer experience and are not intended as a universal ranking.

    Complex code generation

    Closed-source models usually maintain context better in complex business logic, long-span refactoring, and multi-file collaborative generation. Open-source models perform reliably on simple scripts and standard components, but when dealing with framework code that has complex dependencies, syntax errors and logic flaws appear more frequently. In practice, a model can first output a change plan, then generate files one by one, with the compiler and unit tests as a fallback.

    Long-text understanding

    When processing ultra-long inputs of hundreds of thousands of tokens, closed-source models tend to be more stable at key information extraction and cross-paragraph reasoning, with fewer omissions and fabricated details. Open-source models support long context windows, but deep understanding and information association still have room for improvement. For such tasks, it is better to retrieve by segment first and then pass the relevant paragraphs to the model, rather than inserting the entire document at once.

    Tool calling and agent capabilities

    How well a model follows parameter formats for function calls, and its decision logic across multi-turn tool calls, has a major impact on agent systems. Closed-source models are usually more precise at structured output and tool chaining. Open-source models occasionally produce mismatched parameter formats or fall into loops of repeated calls. From an engineering perspective, outputs should be validated against JSON Schema, and a maximum number of call rounds should be set to prevent infinite loops from consuming resources.

    Despite these gaps, open-source models have clear advantages in cost, data controllability through local deployment, and iteration speed. For many engineering tasks, they are already sufficient.

    2. Technical Pain Points and a New Approach for Web-to-Video

    When companies handle product operations, they often need to produce product launch videos, data growth animations, and narrated videos with subtitles. Traditional approaches have two problems.

    First, traditional editing tools rely on manually dragging keyframes on a timeline. This is time-consuming and difficult to reuse. Second, video generation libraries based on modern front-end frameworks such as React are feature-complete, but environment configuration is complex and there are many dependencies. Asking a large model to directly generate this kind of framework code involves high code complexity and many runtime errors, so generation often fails.

    One approach is to have the model write ordinary HTML, CSS, and JavaScript, then use a headless browser to take screenshots frame by frame, and finally encode them into MP4 with ffmpeg. HTML, CSS, and JavaScript account for a high proportion of model training data, so generation accuracy is relatively high. Web rendering technology is mature, and the frame-by-frame screenshot process is easy to control.

    This approach also has clear boundaries. It is suitable for design-heavy 2D animation, typography-based video, data chart animation, and narrated subtitles. It is not suitable for highly dynamic complex 3D scenes or real-time interactive video. The speed of frame-by-frame screenshots is limited by page complexity; the more frames, the slower the rendering.

    3. Hands-On: Setting Up the Rendering Environment

    Environment checklist

    • Node.js: 18 LTS or later is recommended; the exact requirement depends on the selected Puppeteer version.
    • npm: installed with Node.js.
    • Puppeteer: the headless browser control library used in this article. It automatically downloads a matching Chromium during installation.
    • ffmpeg: must include the libx264 encoder.
    • Disk space: reserve enough space for the Chromium download cache and output video.

    Installation commands

    1. node -v
    2. npm -v
    3. ffmpeg -version
    4. mkdir web2video && cd web2video
    5. npm init -y
    6. npm install puppeteer
    7. mkdir -p output check

    On Linux servers, missing system libraries can cause Chromium startup errors. Debian or Ubuntu users can first install common dependencies such as libnss3, libatk1.0-0, and libgbm1. Exact package names depend on the OS version.

    Common errors

    • ffmpeg not found: confirm that ffmpeg is in PATH, or write the absolute path to ffmpeg in the script.
    • No usable sandbox: in containers or root environments, you can add the —no-sandbox parameter. This reduces browser security isolation and should only be used with trusted pages and environments.
    • Chromium download failure: check the network proxy, or specify the cache directory with PUPPETEER_CACHE_DIR.
    • Missing libx264: run ffmpeg -encoders, search for libx264, and confirm that the encoder is available.

    Handling security interception

    When cleaning up an old node_modules directory, a bulk-deletion guard may be triggered, for example by a prompt indicating that cumulative deletions exceed 5,000 items. In this case, proceed in the following order.

    First, do not allow the operation yet. Second, review all deletion paths in the interception log and confirm that each one is inside the project’s dependency directory. Third, if any path includes project source code, configuration files, or other business directories, reject the operation directly. Fourth, after confirmation, prefer moving the old directory to a backup location outside the project rather than deleting it directly. After the new dependencies run stably, manually clean up the backup. Fifth, reinstall dependencies based on the lockfile with npm ci.

    Once a deletion operation is executed, ordinary methods can rarely recover the data. The loss of business files may cost far more than the time needed to reinstall dependencies. Therefore, the interception mechanism is only a last line of defense; backup before operation is more reliable.

    4. Rendering Script and Parameter Template

    The rendered page needs to provide a time-controllable entry point. The convention is as follows: the page exposes a seekTo(t) function, pauses all CSS animations and Web Animations, and seeks to second t. After the page loads, it should wait for fonts to be ready before screenshots begin.

    1. // Add this inside the rendered page (for example, in a script tag in index.html)
    2. window.seekTo = (t) => {
    3. document.getAnimations().forEach((a) => {
    4. a.pause();
    5. a.currentTime = t * 1000;
    6. });
    7. };

    Save the rendering script as render.js in the same directory as index.html:

    1. const fs = require('fs');
    2. const path = require('path');
    3. const { spawn } = require('child_process');
    4. const { pathToFileURL } = require('url');
    5. const puppeteer = require('puppeteer');
    6. const WIDTH = 1080;
    7. const HEIGHT = 1920;
    8. const FPS = 30;
    9. const DURATION = 20;
    10. const TOTAL_FRAMES = FPS * DURATION;
    11. (async () => {
    12. const browser = await puppeteer.launch({ headless: true });
    13. const page = await browser.newPage();
    14. await page.setViewport({ width: WIDTH, height: HEIGHT, deviceScaleFactor: 1 });
    15. await page.goto(pathToFileURL(path.resolve('index.html')).href, { waitUntil: 'load' });
    16. await page.evaluate(() => document.fonts.ready);
    17. const ff = spawn('ffmpeg', [
    18. '-y',
    19. '-f', 'image2pipe',
    20. '-framerate', String(FPS),
    21. '-i', '-',
    22. '-c:v', 'libx264',
    23. '-profile:v', 'high',
    24. '-pix_fmt', 'yuv420p',
    25. '-crf', '18',
    26. '-g', String(FPS * 2),
    27. '-movflags', '+faststart',
    28. 'output/promo.mp4',
    29. ], { stdio: ['pipe', 'inherit', 'inherit'] });
    30. for (let n = 0; n < TOTAL_FRAMES; n++) {
    31. await page.evaluate((t) => window.seekTo(t), n / FPS);
    32. const png = await page.screenshot({ type: 'png' });
    33. if (n === 149) {
    34. fs.writeFileSync('check/ref_frame149.png', png);
    35. }
    36. if (!ff.stdin.write(png)) {
    37. await new Promise((resolve) => ff.stdin.once('drain', resolve));
    38. }
    39. }
    40. ff.stdin.end();
    41. await new Promise((resolve) => ff.on('close', resolve));
    42. await browser.close();
    43. })();

    Run it with node render.js. The output parameters are as follows:

    Parameter Value Description
    Resolution 1080×1920 Vertical, device pixel ratio 1
    Duration 20 seconds 600 frames in total
    Frame rate 30fps Matches the FPS variable in the script
    Encoder libx264 H.264 encoding
    Profile high Compatible with most players
    Pixel format yuv420p Ensures normal playback in most players
    CRF 18 Lower values mean higher quality and larger files
    Keyframe interval 60 frames A keyframe about every 2 seconds, affecting seek precision when dragging the progress bar
    Output path output/promo.mp4 The output directory must be created before running

    Rendering time depends on page complexity, hardware performance, and resolution. It is recommended to record the hardware configuration, timing scope (whether the first Chromium download is included), and output parameters for each run so that comparisons are easier.

    5. How to Validate Frame Consistency

    The biggest risk in web-to-video rendering is dropped frames and rendering desynchronization. Note that MP4 uses lossy encoding, so the decoded image will not be pixel-identical to the original screenshot. Therefore, the validation goal is to confirm that frame count, timestamps, and visual similarity are within an acceptable range, not to require pixel-level consistency.

    1. Check the total frame count

    1. ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of csv=p=0 output/promo.mp4

    The result should be 600. If it is less than 600, frames have been dropped.

    2. Check timestamps

    1. ffprobe -v error -select_streams v:0 -show_entries frame=pts_time -of csv=p=0 output/promo.mp4

    The time difference between adjacent frames should be about 0.0333 seconds. If there are obvious gaps or jumps, the timeline has a problem.

    3. Extract frame 150 and compare

    1. ffmpeg -i output/promo.mp4 -vf "select=eq(n\,149)" -vframes 1 check/mp4_frame149.png

    Frame indexing starts at 0, so the 150th frame corresponds to index 149. The rendering script has already saved a reference screenshot as check/ref_frame149.png at frame 149.

    4. Calculate similarity

    1. ffmpeg -i check/ref_frame149.png -i check/mp4_frame149.png -lavfi ssim -f null -

    The closer the SSIM value in the command output is to 1, the more similar the images are. As a reference, an SSIM of no less than 0.98 and a PSNR of no less than 40 dB can be considered a pass. The exact threshold should be adjusted according to image content complexity and encoding parameters, and validated across multiple sample frames rather than only one frame.

    6. Conclusion

    In suitable scenarios, “large model generates standard web code, then a headless browser renders it frame by frame” is a feasible path. It avoids the code-generation difficulty of complex front-end video libraries and leverages the model’s strengths in HTML, CSS, and JavaScript. Open-source models still have gaps in complex code, long text, and tool calling, so generated results need compiler checks, structured validation, and manual spot checks. By following the environment checklist, safety process, and frame validation methods in this article, teams can compress the time required for one round of manual editing into code generation and rendering time, improving the efficiency of producing promotional materials.