AI-Generated Videos with Open-Source LLMs: A Practical Workflow and Common Pitfalls

    This article examines where open-source large language models still trail leading closed models. It then describes a web-to-video approach in which an AI coding assistant writes HTML, CSS, and JavaScript for product launch videos, data animations, and subtitled voiceover clips. The article walks through environment setup, three test scenarios, a frame-level comparison between a browser screenshot and the exported MP4, and the safety guardrails needed when an AI agent runs cleanup commands.

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

    Open-source large language models from China have grown rapidly in recent years, and some now reach several trillion parameters. This trend has weakened the dominance of closed models in compute and parameter scale, and it has made AI tools far more accessible to developers. However, when teams move from parameter benchmarks to production use, a clear gap remains between open-source models and the most capable closed models.

    The gap appears in three core areas. The first is complex code generation. When a task involves coordinating multiple files or designing complex architectures, top closed models tend to maintain context and reason through logic more consistently. The second is long-context understanding. When extracting key information from contexts spanning hundreds of thousands of tokens, closed models still achieve higher accuracy. The third is tool calling and automated execution. Open-source models have matured in basic API calls, but they still have significant room to improve when handling chained tool calls and recovering from abnormal states.

    This does not mean open-source models lack practical value. With capable AI coding tools and sound technology choices, open-source models can deliver strong productivity in specific vertical scenarios.

    2. The Pain Points of AI Video Generation and a Front-End Rendering Approach

    Video production is unavoidable in product development and operations. Common formats include product launch videos, data growth animations, and voiceover videos with subtitles. Traditionally, developers or product managers use video editing software and adjust timelines frame by frame. This process is time-consuming and hard to reuse. If you ask an AI to write professional video code with frameworks such as React, you must configure complex local dependencies. As code complexity grows, rendering errors become common, and output is hard to keep stable.

    To address this, a “web-to-video” approach has emerged. The core idea is simple. Large language models are highly proficient in HTML, CSS, and JavaScript, so the AI writes ordinary web pages. A headless browser then renders the pages frame by frame and composes the frames into an MP4 file. Browser rendering engines have matured over many years. This approach lowers the barrier to AI-based video generation and improves reliability and visual fidelity.

    3. Hands-On Walkthrough: Video Generation with an Open-Source LLM and AI Tools

    To test this approach, we used an AI coding client with an open-source LLM developed in China as the core model, and ran a complete hands-on workflow.

    1. Environment setup and tool preparation

    First, select the target open-source model in the AI coding tool. The web-to-video approach depends on a front-end environment and a headless browser, so we first asked the AI to set up the underlying runtime. We entered the following prompt:

    “Please check whether Node.js, npm, and a headless Chrome rendering environment are installed on this system. If any are missing, help me set them up. Then install a popular open-source web video rendering framework in a specified local directory. After installation, report the version number and the total time taken.”

    After receiving the instruction, the AI model automatically invoked the terminal to detect and install dependencies. During this process, the AI adjusted its installation strategy based on environment feedback. For example, it identified the operating system version and selected the matching package manager commands.

    2. Code generation and rendering for three typical scenarios

    Once the environment was ready, we tested three common operational needs:

    • Product launch video: Describe the timing of a product logo animation, background gradient, and core copy. The AI then generates the matching CSS animation code.
    • Data animation: Provide sample growth data and ask the AI to draw a dynamic line chart with Canvas or SVG, and control the timeline progression.
    • Voiceover with subtitles: Provide a voiceover script with timestamps. The AI then generates a web page with typewriter-style subtitles.

    4. Frame-Level Consistency Checks and Pitfalls

    1. Rendering consistency check

    For web-to-video rendering, developers most want to know whether the exported MP4 drops frames or differs from the way the web page actually renders. To check this, we captured a screenshot of the headless browser at frame 150 in a frozen state. We then compared it pixel by pixel with frame 150 of the exported MP4. The results were highly consistent, which suggests the approach keeps frames synchronized and timing under control.

    2. Safety interception and dependency management pitfalls

    The process did not go smoothly. When the AI tried to clear leftover legacy dependency files before installing the new framework, the AI coding tool displayed a security warning: “Batch deletion detected: 5475 items deleted in total. Threshold: 50. High-risk command.”

    This shows that safeguards are necessary when AI automates environment management. During cleanup, a model may generate high-risk commands such as rm -rf node_modules. Without restrictions, such commands can delete important files by mistake. To address this risk, consider the following practices:

    • Sandbox isolation: Restrict the terminal the AI uses to the working directory, and block access to system-level paths.
    • Threshold interception and manual confirmation: As the tool did in this example, pause the operation and request human confirmation when a file operation exceeds a set threshold, such as 50 items.
    • Allowlist policy: For known dependency directories such as node_modules and dist, configure an allowlist that lets the AI operate freely within those paths. Strictly lock all other paths.

    5. Summary

    Open-source LLMs still trail top closed models on some demanding capabilities. However, with well-designed toolchains and approaches such as web-to-video generation, they can already handle many practical engineering and content production tasks. AI automation brings convenience, but developers should also put strong code review and safety interception mechanisms in place. As open-source models improve in code generation and tool calling, they are expected to see broader use in vertical domains.