I maintain Corvus, an open-source reverse proxy with a
built-in web application firewall. People kept asking for "a quick video", and I had two problems:
I don't want to be on camera, and I don't want a video that's out of date after the next release.
So the video is a build artifact. A handful of scripts start a demo instance, fill it with traffic,
click through the console, read a script with a local AI voice and put it all together with ffmpeg.
Here's the result:
Everything ran on one Windows laptop (RTX 3050 Ti, 4 GB) and cost nothing. Here's how each part
works, and what tripped me up.
1. A demo instance that looks alive
An empty dashboard makes a bad video. I started Corvus with Docker Compose next to three
traefik/whoami containers as fake backends, seeded it through
its HTTP API (five sites, three security rules, an access queue with 50 seats) and then ran a small
Python traffic generator:
- visitors: browser user agents fetching normal pages,
-
scanners:
/.env,/.git/config,/wp-login.php,../../etc/passwd, SQL injection in the query string, from addresses that change every few requests, -
a brute-force bot posting to
/login, - 90 shoppers keeping sessions open on the shop, so the waiting room fills up.
Two details made it believable:
-
Every client has its own IP. The generator sends
X-Forwarded-Forand the Docker network is configured as a trusted proxy, so the gateway sees hundreds of clients instead of one. I only used the documentation ranges from RFC 5737 (192.0.2.0/24,198.51.100.0/24,203.0.113.0/24), so no real address appears on screen. - Let it run first. After ten minutes the charts are full, automatic bans have kicked in and the alerts banner has something to say.
2. Recording through the Chrome DevTools Protocol
No screen recorder and no Playwright: Node 22 has fetch and WebSocket built in, which is enough
to drive headless Chrome over the DevTools Protocol. The useful calls:
await send("Emulation.setDeviceMetricsOverride", { width: 1600, height: 900, deviceScaleFactor: 1.2, mobile: false });
await send("Page.startScreencast", { format: "jpeg", quality: 92, maxWidth: 1920, maxHeight: 1080 });
on("Page.screencastFrame", (p) => {
save(p.data, p.metadata.timestamp); // keep the timestamp!
send("Page.screencastFrameAck", { sessionId: p.sessionId });
});
A 1600×900 viewport at 1.2× scale gives 1920×1080 frames with text a little larger than a normal
desktop, which reads better on a phone.
The "user" is JavaScript injected into the page: find a button by its text, move a fake cursor (a
blue dot with a CSS transition) to it, pulse it, click. Typing sets the input's value one character
at a time through the native setter, so React notices:
const set = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value").set;
for (const ch of text) { v += ch; set.call(el, v); el.dispatchEvent(new Event("input", { bubbles: true })); await sleep(50); }
The intro and outro cards (a terminal full of attack requests, the logo, the links) are plain HTML
pages with CSS animations, recorded the same way.
Things that cost me an hour each
-
Screencast frames only arrive when something changes, so you get a variable frame rate. Keep
each frame's timestamp and give it to ffmpeg's concat demuxer as
duration, then resample withfps=30. Otherwise static parts are skipped and the clip is too short. -
Showing other sites through the gateway. I needed the browser to open
http://shop.example.comand land on the local gateway.--host-resolver-rulesgave me a blank page; what works is--proxy-server=http=127.0.0.1:29080(HTTP only, so the console on HTTPS is not proxied). And Chrome quietly upgraded the URL to HTTPS until I added--disable-features=HttpsUpgrades,HttpsFirstBalancedModeAutoEnable. -
Language. The waiting page came out in Korean, because that's my system language.
--lang,Emulation.setLocaleOverrideandNetwork.setUserAgentOverridewithacceptLanguagefixed it. -
Freezing a moment. The bot challenge page solves its proof of work in about a second, too fast
to show.
Fetch.enablewith a pattern for the verification request, and never answering the paused request, keeps the "Checking your browser" page on screen as long as the scene needs.
3. A voice that isn't mine
Kokoro is an 82M-parameter open-weight TTS model (Apache-2.0)
that runs comfortably on a small GPU, or on the CPU. I rendered the same three sentences in seven
voices, picked am_michael, and generated one WAV per scene:
from kokoro import KPipeline
pipe = KPipeline(lang_code="a") # American English
audio = np.concatenate([a for _, _, a in pipe(text, voice="am_michael")])
sf.write(f"audio/{scene}.wav", audio, 24000)
The narration decides the timing, not the other way round: each scene is recorded for the length of
its voice clip plus half a second before and 0.7 s after. Change a sentence, re-render that scene,
and everything still lines up.
Two small things helped the voice: write numbers and domains the way they should be spoken
("corvus gateway dot org"), and keep sentences short. A ten-word sentence sounds natural; a
thirty-word one sounds like a train announcement.
(I installed it in its own venv. With PyTorch 2.5, a recent transformers silently disables
PyTorch and Kokoro fails with a confusing "requires the PyTorch library" error; pinning
transformers<4.50 fixed it.)
4. Captions and sound with ffmpeg
-
Captions: the scene text, split into sentences, timed in proportion to their length, written
as an ASS file with a semi-transparent box, burned in with
-vf subtitles=captions.ass. The same cues go into an.srtfor YouTube. -
Sound effects: no music, just a soft whoosh between scenes and a quiet tick on every click.
Both are generated with NumPy (filtered noise with an envelope, a decaying 1.8 kHz sine), so there
is nothing to license. The recorder logs a
console.debugon every click and listens toRuntime.consoleAPICalled, which gives exact click times for the ticks. - Mixing is NumPy too: an empty array the length of the video, each clip added at its offset.
What I'd do differently
-
The frame rate. Headless screencast delivered 10–15 frames per second when the page changed,
which makes the cursor a little steppy. For the next video I'll try capturing with
HeadlessExperimental.beginFramefor a fixed frame rate. - A script first, then the demo data. I wrote the narration, then noticed the charts didn't show what it described. Seed the data for the story you want to tell.
The whole thing is about 800 lines of Python, JavaScript and HTML, and a new version of the video is one
command away. If you maintain an open-source project and avoid video because of the editing, try
treating it like a test: a fixture, a script, and an artifact at the end.
Corvus is free and open source: corvusgateway.org ·
GitHub. Questions about the pipeline are welcome in the
comments.
Top comments (21)
The "video as a build artifact" framing is what sold me — especially letting the narration set the timing, so re-recording one scene doesn't shift everything else. The CDP details are the useful part: the variable-frame-rate screencast trap and the --proxy-server workaround for shop.example.com are exactly the kind of thing that costs an hour each. Did the 10–15 fps screencast ever make the fake cursor look laggy in the final video, or did the fps=30 resample smooth that out enough?
Thank you so much for reading it this closely, and for the kind words. Honestly, your question points at the part I'm least happy with.
The
fps=30resample doesn't really smooth anything. It only repeats frames to fill the gaps, so the cursor still moves at whatever rate the screencast delivered, and if you watch closely you can see it step a little. What helped a bit was making the cursor's CSS transition fairly slow (about half a second), so each move still gets several frames. I also triedminterpolate, but it smeared the text in the UI, so I went back.If I make another version, I'd like to try one of these:
HeadlessExperimental.beginFrame, to render at a steady 30 fps instead of taking whatever the screencast sendsI haven't tried either yet, so I'm not sure which works better in practice. If you've done something similar, I'd really appreciate any tips. Thanks again for the thoughtful question!
The "keep the timestamp!" fix is the exact seam where ffmpeg.wasm falls over — buffering 1080p JPEGs hits the wasm32 4 GiB wall fast. We went the other way on captions: local Whisper word timestamps instead of timing by sentence length, which kills the drift on long pauses. Did you measure the end-to-end render time? Curious how much is capture vs assembly.
Thank you so much for reading the post and for taking the time to share your experience, I really appreciate it!
The ffmpeg.wasm limit is a great point, and something I hadn't thought about. I think I just got lucky: everything runs locally with native ffmpeg, and the frames go straight to disk as JPEGs, so nothing has to stay in memory.
Your question made me curious too, so I timed a full rebuild today. For the 1:43 video it took about 4 min 50 s on my laptop (RTX 3050 Ti):
So capture is a bit over half, and there's clearly room to improve by reusing one browser.
And thank you for the Whisper tip! Word timestamps sound much better than my sentence-length guess. You're right about the drift, too: in a couple of scenes the caption moves on slightly before the voice does. I'd love to try your approach. If you've written about your setup anywhere, I'd be happy to read it.
Thanks for timing it — the split is telling. The 103s of "real-time playback" is just your 1:43 runtime playing back, which is the floor for screencast capture; the avoidable part is launching a fresh Chrome for each of the 12 parts. Reusing one browser/context across parts should eat most of that overhead.
On the captions: the drift fix is letting Whisper predict where each phrase actually starts and stops, rather than dividing a sentence's duration by its length — so a long pause doesn't drag everything after it out of sync. Haven't written this one up yet, but it's on our list. And your native-ffmpeg path sidesteps the wasm memory wall entirely since frames go straight to disk — a real perk of not being in a tab.
Thank you, that's a really helpful way to look at it. You're right, the real-time part is just the floor, and the per-part Chrome launches are pure overhead. Reusing one browser across all the parts is going on my list for the next version, it should be an easy win.
And thanks for explaining the Whisper approach. Letting it find where each phrase actually starts makes so much more sense than my "split the sentence by its length" shortcut, especially with pauses. I'd really enjoy reading it if you do write it up someday, please share the link if you do!
I really appreciate you taking the time for these thoughtful comments. It's been a fun conversation, and I learned a lot from it.
Will do — we'll write it up and post the link here once it's live. Honestly, we learned a lot from your side of this too; easily one of the nicest threads we've been part of on here. Thanks for the detailed replies, and good luck with the beginFrame experiment!
Thank you, that's so kind of you to say! It's been one of my favorite threads too, and I learned a lot from your Whisper idea. I'm really looking forward to your write-up, so please do share the link when it's live. Good luck with it, and thanks again for all the thoughtful comments!
I haven't built a video pipeline like this, so I don't have tips from experience — my ffmpeg use is basically quick screen-recording trims. Of your two options, the beginFrame one sounds more promising to me, since it fixes the unsteady frame rate at the source instead of patching the cursor afterwards. Keen to hear which one you try first.
Thank you for sharing your view, that's really helpful! And I like your reasoning: fixing the frame rate at the source feels cleaner than patching the cursor afterwards, and it would also smooth out anything else that moves, like charts and scrolling, not just the cursor.
So I'll try
beginFramefirst. I'll post an update here once I've given it a go, whether it works out or not. Thanks again for joining the conversation!Running the traffic generator for ten minutes before recording is the step I'd copy first, and sticking to the RFC 5737 ranges means no real address ever lands on screen. On your script first, then the data note, one cheap guard: before each scene records, have the script ask the API for the numbers the narration mentions, like bans or seats in the queue, and fail the build if they don't match. Then a stale fixture can't contradict the voice.
Thank you, this is a really good one, and you made me go and look at my recorder.
The narration deliberately avoids numbers ("addresses that keep attacking are banned", not "42 addresses"), partly so it can't go stale. But your point still applies to what's on screen: the recorder currently does things like
if (row) point(row), so if the bans table were empty, it would happily record an empty table while the voice says "banned automatically". Nothing would fail; the video would just quietly be wrong.So I'll take your guard and adapt it: each scene in
scenes.jsongets a precondition, checked against the API right before it records. For example, at least a few active bans for the protect scene, blocked events for the monitor scene, and visitors actually waiting for the queue scene. If one doesn't hold, the build stops. It's a few lines and it turns "looks fine to me" into something the script checks.Thanks again for reading it that closely!
Preconditions per scene in scenes.json is a cleaner version of what I suggested. Checking that the bans table actually has rows before it records catches the case that worries me most, a video that looks fine and is quietly wrong. And since the narration avoids numbers, the check only has to prove the screen isn't empty, so it won't break every time the traffic generator has a slow minute. When a precondition fails, do you plan to have the build wait and recheck for a bit, or stop straight away?
Wait a bit, then stop. The traffic generator keeps running, so a short recheck (say up to 30 seconds) covers a slow minute, and if it's still empty after that something is actually broken. Thanks for thinking it through with me!
Thirty seconds and then a hard stop sounds right, since a generator that keeps running should fill the table well inside that window. When a precondition does fail, I'd have the build print which scene it was and what the API actually returned, so the message reads like a failed test rather than a puzzle. Then a month from now you can tell straight away whether the traffic generator died or the screen itself changed.
The inversion that stood out to me is letting the narration set the timing rather than cutting the voice to fit the footage — re-rendering one scene without re-shooting everything is exactly what makes this a build artifact rather than a video project. The detail about giving each client its own IP via X-Forwarded-For is a nice touch too; it is the sort of thing that makes the demo feel real. One question: what happens when a scene's UI interaction takes longer than its narration — do you pad the audio, or slow the interaction down?
Thank you for reading it so carefully, and for the kind words about the X-Forwarded-For trick!
Honestly, neither: in this version the narration wins. Each scene is recorded for exactly the length of its voice clip plus a short lead-in and tail, and the click-through script runs alongside it. If the interaction were slower, the recording would simply stop before it finished.
So I made the interactions fit instead: faster typing (about 50 ms per character), shorter pauses, and when a scene had too much to show, I split it into two parts with separate recordings (the security rules list, then the challenge page). I checked every scene with a contact sheet of one frame per second to catch anything cut off.
A nicer approach would be to let the recorder wait for the interaction to finish and then hold the last frame or add a short silence, so a slow scene stretches instead of getting cut. That's on my list for the next version. Thanks for the great question!
Love this. Scripted product videos have a big advantage people overlook: when the UI changes, you rerun the script instead of re-recording everything. Adding a short pause on each key screen and zooming slightly into the element being explained makes these feel much more like a human-made walkthrough.
Thank you! The zoom idea is a great one, I'll try it on the next render.
a video that rebuilds itself on the next release is the only kind worth making. the traffic generator doing the acting is the detail that sells it.
Thank you! The traffic generator was my favorite part to write, so I'm really glad it came through. Thanks for reading!