{"slug": "codetovideo-local-web-app-demo-generator-using-4b-models-and-ffmpeg", "title": "Codetovideo – Local web app demo generator using 4B models and FFmpeg", "summary": "A developer released CTV (codetovideo), a free, fully local open-source tool that turns any web app into a demo or promo video by having an OpenAI-compatible LLM write only a scene plan while Playwright records the real app and FFmpeg and Remotion assemble the output. The tool was built on Ollama with the 4B-parameter qwen3.5:4b model and also ran with Gemini 2.5 and 3.5 through their OpenAI-compatible APIs, producing 480p to 4K MP4s with no cloud, telemetry, or stock/TTS/image APIs. CTV requires Node.js 20+ (22 recommended) and ships a desktop Electron app plus a CLI, with a three-step example app in the repo.", "body_md": "**Point it at any web app, write one sentence, get a demo or promo video. The AI directs; a real program records. Free, fully local, no audio.**\n\n[Quick start](#quick-start) · [Formats](#formats-backgrounds-quality) · [How it works](#how-it-works) · [Honest status](#honest-status) · [**Help wanted**](#help-wanted) · [Manual](https://github.com/Anatomik5/codetovideo/blob/main/docs/MANUAL.md)\n\n<sub>▶ Made end to end by CTV with `qwen3.5:4b` running locally and **no manual editing**; the neon backdrop was drawn by the model itself (`--backdrop generate`). Click the animation to play the [full video](https://github.com/Anatomik5/codetovideo/blob/main/docs/demo.mp4).</sub>\n\nI was tired of three things:\n\n1. **AI hallucinates when it generates video.** Text-to-video models invent buttons, screens and features that do not exist.\n2. **I cannot do video editing,** and I do not want to learn timelines and keyframes just to show my own product.\n3. **Tools that turn code into a nice demo are paid.** I did not want another subscription.\n\nSo CTV flips the roles: **the AI is only the director; the program is real.**\n\n- Your LLM reads the repo and your prompt and writes a *plan* : scenes, titles, captions, pacing, colors.\n- Everything you see on screen is a **real recording of your real app** , driven by[Playwright](https://playwright.dev) through ordinary DOM / ARIA semantics. Nothing on screen can be hallucinated, because it is the real thing.\n- [FFmpeg](https://ffmpeg.org) and[Remotion](https://remotion.dev) assemble the result: deterministic, local, free.\n\nYou bring **any OpenAI-compatible LLM**: a free API key, or a small model on your own machine. I built it on **Ollama + `qwen3.5:4b`** (a weak 4B model, and it was enough) and also ran it with **Gemini 2.5 and 3.5** through their OpenAI-compatible API, which worked too.\n\n- **One prompt, one `.mp4`.** Say the language in the prompt (\"in English\", \"на русском\", \"auf Deutsch\") and titles/captions follow.\n- **Two formats:** a*demo* walkthrough and a*corporate-promo* look with camera moves and call-outs.[Details](#formats-backgrounds-quality) .\n- **480p to 4K** , genuinely sharper at higher settings.\n- **Runs entirely on your machine, even in a closed environment.** With a local model nothing ever leaves your computer: no cloud, no telemetry, no stock/TTS/image APIs. Demo and promo videos of an internal or private app are fine to make offline, even on a small model.\n- **Self-healing local Ollama.** If it is installed but not running, CTV starts it and keeps the model warm.\n- **Language-free navigation.** No per-site selectors, button texts or word lists in the code. DOM / ARIA / geometry decide*how* to act, your LLM decides what a button*means* .\n- **Multi-step uploads.** Several`--upload` files are fed to the app one per step, in order.\n- **Pacing from the prompt.** \"Scroll slowly\" really changes scroll duration, step size and hold time.\n- **Non-destructive editing.** Change one scene (title, caption, colors, background, or even re-shoot it) without touching the rest.\n- **Desktop app** for setup, generation and edits (Electron, not a localhost web page)**and** a full CLI.\n\nRequirements: **Node.js 20+** (22 recommended). For the free local route, install [Ollama](https://ollama.com).\n\n```\ngit clone https://github.com/Anatomik5/codetovideo.git\ncd codetovideo\nnpm install          # also downloads Chromium for Playwright\nollama pull qwen3.5:4b\nnpm run app          # opens the desktop app\n```\n\nWindows: double-click `start-app.vbs` (no console window; installs on first run). macOS / Linux: `./start-app.sh` *(unverified, please report)*.\n\nIn the app: choose **Ollama (local, free)**, model `qwen3.5:4b`, leave the key empty. You do not need to start Ollama yourself.\n\nThe repo ships a tiny three-step example app:\n\n```\nnpx ts-node scripts/demo-pipeline.ts \\\n  --file examples/hello-wizard/server.js \\\n  --upload examples/hello-wizard/sample.csv \\\n  --model \"qwen3.5:4b\" --base-url \"http://localhost:11434/v1\" \\\n  --prompt \"Show the full workflow from upload to export, in English\"\nnpx ts-node scripts/demo-pipeline.ts \\\n  --file \"path/to/your/project/or/launch-file\" \\\n  --upload \"data/sample.xlsx\" \\\n  --format promo --quality 1080 \\\n  --model \"gemini-2.5-flash\" --base-url \"https://generativelanguage.googleapis.com/v1beta/openai/\" --api-key \"$KEY\" \\\n  --prompt \"Quick, energetic overview: import, review, export. Captions in English.\"\n```\n\nAlready running app? Use `--url http://localhost:3000` instead of `--file`. Free cloud keys work too (Gemini, OpenRouter, Groq, ...); put them in `.env` (see [`.env.example`](https://github.com/Anatomik5/codetovideo/blob/main/.env.example)) or pass `--api-key`.\n\n| Option | Values | What it does | \n|---|---|---|\n| `--format` | `demo` (default) | Walkthrough: browser window on an **animated backdrop** (strokes flicker, light sweeps travel through the artwork), badge + subtitle per scene. | \n|  | `promo` | Corporate-ad look: clean gradient, floating tilted window, camera pushes toward the real action, a **zoomed call-out cropped from the recording** , word-by-word captions, logo end card. | \n| `--backdrop` (demo) | `auto` (default for cloud models) | Model draws an SVG; if it is too sparse, a neutral motif fills the edges. | \n|  | `generate` | The model draws everything. Best with strong models. | \n|  | `motif` (default for local models) | The model only *picks* a motif family (circuit, lattice, waves, skyline, constellation); the built-in generator draws it. Fast, ideal for small models. | \n| `--quality` | `480` …`2160` | Output height in px (default 720). The browser is captured at a matching real device scale factor, so higher is sharper, and slower. | \n\nBoth formats are **silent** by design.\n\nEvery run is saved as a *session* (`out/sessions/<id>/`: `manifest.json`, `clips/scene_NN.mp4`, `props.json`, `final.mp4`).\n\n```\n# change a title (re-renders only the affected frames)\nnpx ts-node scripts/demo-pipeline.ts --edit-scene 2 --edit-prompt \"Change this scene's title to Cost Breakdown\"\n\n# re-shoot only scene 3\nnpx ts-node scripts/demo-pipeline.ts --edit-scene 3 --edit-prompt \"Re-shoot this step and scroll down to the table\"\n```\n\nYour LLM decides which mode the instruction needs:\n\n- **Text / style (mode A):** titles, captions, colors, background. Clips are untouched; when only that scene's text changed, only the key-frame-aligned range is rendered and the rest is stitched back with`ffmpeg -c copy` .\n- **Re-shoot (mode B):** Playwright restarts the app, silently replays the earlier steps, records**only** that scene, and the other clips stay as they were.\n\n<sub>Editable source: [`docs/architecture.drawio`](https://github.com/Anatomik5/codetovideo/blob/main/docs/architecture.drawio) · regenerate with `node scripts/build-diagram.cjs`.</sub>\n\n1. **Repo study:** file tree (no caches, venvs, binaries), README, manifests, launch scripts.\n2. **AI director:** one structured plan: title, intro/outro, scenes (`title` ,`caption` ,`targetGoal` ), pacing, palette, background brief and motif, in the language you asked for. A health-checked client makes small local models reliable (JSON repair, compact retries,`keep_alive` , one context size so Ollama never reloads the model).\n3. **Process executor:** frees ports, starts your app directly (no shell), finds its URL, always tears the process tree down.\n4. **Scene-aware browser agent:** decides each step from the live DOM, moves a visible cursor, uploads files, fills required fields, clicks forward, scrolls at most a couple of times per screen so it never loops; stops with a clear`stopReason` if it cannot continue. Button*meaning* comes from your LLM, cached per label.\n5. **Scene editor:** the session store described above.\n6. **Compose:** clips are concatenated without cutting motion; Remotion renders the chosen format at the chosen size.\n\n| Flag | Meaning | \n|---|---|\n| `--file` /`--repo` | Project folder or launch file. CTV studies the repo, starts the app, finds its URL. | \n| `--url` | URL of an already running web app (skips launching). | \n| `--launch \"<cmd>\"` | Command that starts the app. Overrides the model's proposal (see [Security](#security-and-privacy) ). | \n| `--port` | Preferred port of the launched app. | \n| `--prompt` | Free-form instructions in any language: scenario, caption language, style, colors, pacing. | \n| `--upload` | File to upload in the app. Repeat for several; used in order. | \n| `--model``--base-url``--api-key` | Your LLM ( `LLM_MODEL` ,`LLM_BASE_URL` ,`LLM_API_KEY` also work). Ollama needs no key. | \n| `--theme` | `auto` ·`dark` ·`light` | \n| `--format``--backdrop``--quality` | See [above](#formats-backgrounds-quality) . | \n| `--out` | Output `.mp4` (default`out/demo.mp4` ). | \n| `--project-dir` /`--session` | Saved session to edit (default: newest in `out/sessions/` ). | \n| `--edit-scene <n\\|id>``--edit-prompt \"…\"` | Scene (1-based or id like `beat_3` ) and what to change. | \n| `--re-render-only` | Rebuild the final video from saved clips and manifest; no browser. | \n| `--max-steps <n>``--no-render` | Developer aids for quick smoke tests. | \n\n**CTV is alpha.** It works end to end, but on a very small test surface. Please read this before you invest time:\n\n- **Tested on:** Windows 11; Ollama with`qwen3.5:4b` ; Gemini 2.5 and 3.5 via the OpenAI-compatible API (author's own runs); one real Next.js + FastAPI app and the bundled example.**Not tested:** macOS, Linux, other providers, most real-world apps.\n- **Navigation is heuristic.** Logins, multi-tab flows, drag-and-drop, canvas apps, iframes and shadow DOM will probably defeat it. It stops with a`stopReason` instead of looping, but \"stops\" is not \"works\".\n- **Small models give small results.** A 4B model writes serviceable but generic captions, sometimes splits scenes oddly, and its background drawings are often sparse (hence the motif fallback). Bigger models should do better; I have not verified how much.\n- **Web UIs only.** No native desktop apps.\n- **Re-shooting one scene** can show a small cursor/scroll jump at the cut.\n- **Slow on CPU.** A ~75 s video at 720p takes a few minutes to render; 1080p and above take much longer.\n- **Remotion's license is not plain MIT.** Companies above a small size need a paid license. See[THIRD_PARTY.md](https://github.com/Anatomik5/codetovideo/blob/main/THIRD_PARTY.md) . \"Free\" here means*no per-use fees* , not \"no license terms anywhere\".\n- **Quality bar of the output** is \"decent first cut\", not a replacement for a human editor.\n- **Tests:** unit tests for the pure helpers plus a type check (`npm run check` ). No automated end-to-end tests and no hosted CI yet.\n- **No audio / narration.** Out of scope for now.\n\nIf any of this bites you, [open a run report](https://github.com/Anatomik5/codetovideo/issues/new?template=run_report.yml): that is exactly the feedback the project needs.\n\nI built CTV alone because I was annoyed, and it has outgrown what one person on one machine can test. **If this idea is useful to you, please help make it solid.** Concretely:\n\n- 🙋 **Run it on your app and send a [run report](https://github.com/Anatomik5/codetovideo/issues/new?template=run_report.yml)** , even (especially) when it fails. This is the single most valuable contribution.\n- 🙋 **macOS and Linux testers.**\n- 🙋 Try **bigger / other models** (Gemini, OpenRouter, Groq, local 7B-14B) and tell us what changes.\n- 🙋 Improve **scene planning prompts** and**caption quality** for small models.\n- 🙋 `.srt` subtitle export, more promo templates, vertical (9:16) formats, installers, Docker image.\n- Design discussion: a **free local TTS** option and an alternative renderer without Remotion's license constraint.\n\nThe full list with context is in [ROADMAP.md](https://github.com/Anatomik5/codetovideo/blob/main/ROADMAP.md); ground rules are in [CONTRIBUTING.md](https://github.com/Anatomik5/codetovideo/blob/main/CONTRIBUTING.md). Small PRs and honest bug reports are equally welcome. ⭐ A star helps others find the project.\n\n- CTV **launches your app and clicks through it like a user.** Do not point it at systems with real data or side effects.\n- Repo excerpts and page labels go **only to the LLM endpoint you configure.** Local model = nothing leaves your machine. No telemetry, no other network calls.\n- Model-proposed start commands are **ignored unless they are a plain call to a known dev runtime** (python, node, npm, uvicorn, cargo, ...). Use`--launch` for anything else. Treat untrusted repositories as untrusted code anyway.\n- The desktop app stores your API key encrypted with the OS keychain when available.\n\nDetails and how to report a vulnerability: [SECURITY.md](https://github.com/Anatomik5/codetovideo/blob/main/SECURITY.md).\n\n**Is it really free?** CTV has no per-use cost: your own LLM or a free API key, plus local tools. Mind Remotion's license for commercial use and your provider's free-tier limits.\n\n**Why not just use a text-to-video model?** Those invent UI. CTV only shows what your app actually does.\n\n**Why not just screen-record?** You can! CTV adds the director: it plans scenes, drives the app, times captions to the real clicks, and lets you edit one scene later without redoing everything.\n\n**Which model should I use?** Start with `qwen3.5:4b` via Ollama (what it was built on). For better plans and captions use a stronger model; for the demo background, pick `--backdrop generate` with strong models or `motif` with small ones.\n\n**Can it narrate?** Not yet; videos are silent by design for now.\n\n**My app needs a login.** Not supported out of the box. Run the app logged in or with a demo account via `--url`, and tell us how it went.\n\n```\napp/                       desktop app (Electron): main.js, preload.js, index.html\nscripts/demo-pipeline.ts   the whole pipeline + CLI\nscripts/build-diagram.cjs  regenerates docs/architecture.*\nsrc/                       Remotion compositions: DynamicDemoScene (demo), PromoScene (promo)\nexamples/hello-wizard/     tiny app to try CTV with\ntests/                     unit tests (npm test)\ndocs/                      manual, architecture diagram, demo, translations\nout/sessions/              your saved sessions (git-ignored)\n```\n\n[CONTRIBUTING.md](https://github.com/Anatomik5/codetovideo/blob/main/CONTRIBUTING.md) · [CODE_OF_CONDUCT.md](https://github.com/Anatomik5/codetovideo/blob/main/CODE_OF_CONDUCT.md) · [SECURITY.md](https://github.com/Anatomik5/codetovideo/blob/main/SECURITY.md) · [CHANGELOG.md](https://github.com/Anatomik5/codetovideo/blob/main/CHANGELOG.md) · [ROADMAP.md](https://github.com/Anatomik5/codetovideo/blob/main/ROADMAP.md) · [THIRD_PARTY.md](https://github.com/Anatomik5/codetovideo/blob/main/THIRD_PARTY.md)\n\nTranslations: [Русский](https://github.com/Anatomik5/codetovideo/blob/main/docs/ru/README.md) *(community-style translation, may lag behind this file)*.\n\nCTV is released under the [MIT License](https://github.com/Anatomik5/codetovideo/blob/main/LICENSE): **use it for free, for any purpose, modify it and share it.** The dependencies keep their own licenses, most importantly Remotion's (companies above a small size need its commercial license): see [THIRD_PARTY.md](https://github.com/Anatomik5/codetovideo/blob/main/THIRD_PARTY.md).", "url": "https://wpnews.pro/news/codetovideo-local-web-app-demo-generator-using-4b-models-and-ffmpeg", "canonical_source": "https://github.com/Anatomik5/codetovideo", "published_at": "2026-11-24 23:09:11+00:00", "updated_at": "2026-11-24 23:15:08.745567+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "developer-tools", "generative-ai", "ai-agents"], "entities": ["CTV", "codetovideo", "Playwright", "FFmpeg", "Remotion", "Ollama", "qwen3.5:4b", "Gemini 2.5"], "also_reported_by": [], "takeaway": "CTV keeps the LLM as director only — it writes a scene plan while Playwright drives the real app via DOM/ARIA semantics and FFmpeg/Remotion render the video, so a 4B qwen3.5:4b model on local Ollama was enough to produce a full demo with no manual editing.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/codetovideo-local-web-app-demo-generator-using-4b-models-and-ffmpeg", "markdown": "https://wpnews.pro/news/codetovideo-local-web-app-demo-generator-using-4b-models-and-ffmpeg.md", "text": "https://wpnews.pro/news/codetovideo-local-web-app-demo-generator-using-4b-models-and-ffmpeg.txt", "jsonld": "https://wpnews.pro/news/codetovideo-local-web-app-demo-generator-using-4b-models-and-ffmpeg.jsonld"}}