Build, debug, extend, localize, or publish the automated tutorial videos — the workbench that drives the real Linux app under Xvfb (virtual mic, live Voxtral transcription, task-agent proposals), records the screen, narrates with Gemini TTS, fast-forwards waits, composes MP4s via OpenMontage, and uploads finished videos to Cloudflare R2 for docs-site embedding. Use when asked to "build/regenerate the tutorial video(s)", add a tutorial scenario, add a tutorial locale, fix a broken tutorial run, adapt the pipeline, or upload/publish a video.
Install
npx skillscat add matthiasn/lotti/tutorial-videos Install via the SkillsCat registry.
Tutorial Video Workbench
Architecture and rationale live in tools/tutorial_videos/README.md — read
it first. This skill is the operational runbook.
Build videos
make tutorial_video TUTORIAL_LOCALE=de # one locale (~5-8 min)
make tutorial_video TUTORIAL_LOCALE=de TUTORIAL_DEVICE=mobile # phone-shaped window, `_mobile`-suffixed output
make tutorial_videos_all # all TUTORIAL_LOCALESTUTORIAL_DEVICE (desktop|mobile, default desktop) picks the capture
window size — see the README's "Desktop vs. mobile" section for the
breakpoint rationale and the tutorialDeviceIsMobile() test hook.
Preconditions (fail fast if missing):
.envat repo root withGEMINI_API_KEY,MELIOUS_API_KEY,MELIOUS_BASE_URL. If absent, the keys can be extracted from the dev
app'sai_config.sqliteprovider rows (never print or commit them).- Sibling
../OpenMontagecheckout at the commit pinned intools/tutorial_videos/config/openmontage.pin, bootstrapped viamake -C ../OpenMontage setup. Xvfb,ffmpeg,pactl,paplay,x11-utilsinstalled; Flutter viafvm.
Output lands in build/tutorial_videos/<scenario>_<locale>.mp4. Verify with
frame extraction (ffmpeg -ss <t> -frames:v 1) and check: cursor visible and
gliding, HUD clock top-center, transcript/proposals on screen, narration
audible at step starts (volumedetect), duration ≈ warped timeline total.
Publish to R2
make tutorial_video_publish TUTORIAL_SCENARIO=create_task_from_audio TUTORIAL_LOCALE=de
make tutorial_video_publish TUTORIAL_SCENARIO=create_task_from_audio TUTORIAL_LOCALE=de TUTORIAL_DEVICE=mobileUploads build/tutorial_videos/<scenario>_<locale>.mp4 (or, withTUTORIAL_DEVICE=mobile, <scenario>_<locale>_mobile.mp4) to Cloudflare R2
at the matching tutorial-videos/... key and prints its public r2.dev URL —
this is the URL the docs-site TutorialVideo component builds fromTUTORIAL_VIDEO_BASE_URL/tutorialVideoBaseUrl. TUTORIAL_DEVICE must
match whatever --device the video was built with, or publish will look for
a file that was never produced. Full one-time Cloudflare setup (API token,
enabling the bucket's public r2.dev URL) and the .env variable list are in
the README's "Publishing to Cloudflare R2" section — read it before the
first publish.
boto3 (needed only by publish, not by build/tts/validate) is not installed
into the system Python on this host (PEP 668). Either run publish throughtools/tutorial_videos/.venv (.venv/bin/python3 -m tutorial_videos publish --scenario ... --locale ..., created via python3 -m venv .venv && .venv/bin/pip install boto3 pyyaml), or install boto3 into whatever
Python make tutorial_video_publish resolves to.
The pipeline in one paragraph
python3 -m tutorial_videos build (run from tools/tutorial_videos/) does:
Gemini-TTS pre-pass (cached by content hash → durations manifest) → Xvfb +
virtual-mic null sink + ffmpeg x11grab capture → fvm flutter drive runsintegration_test/tutorial/<scenario>_tutorial_test.dart against the real
app (penguin demo world + Melious/Voxtral/Qwen agent config seeded, UI
language via MANUAL_LANGUAGE settings row) → the test emitstimeline.json (step boundaries, wait spans, zero epoch) → timewarp.py
plans fast-forward segments for the waits (narration never overlaps) →compose.py warps the capture and drives the pinned OpenMontage headlessly
(narration placement + mux) → ffprobe validation.
Debugging a failing run
- The run log tail shows the failing step and a
Diagnostics:line
(current route, detail stack, key widget presence). - Look at the failure screenshot first:
build/tutorial_videos/failure_<context>.pngis captured at the moment of
every timeout — it almost always explains the failure instantly. - Reproduce faster without video: run the same test via
flutter drive
directly (see the doc comment inintegration_test/tutorial/tutorial_harness.dartfor the env contract);
Xvfb + sink setup must matchsession.py. - Common causes, in order of historical frequency: a finder matching an
offstage duplicate (scope to the visible page +.hitTestable()), a
scroll helper given a non-vertical scrollable, a modal/dialog blocking
the UI (onboarding, discard-recording), the agent'sautomaticUpdatesEnabledflag not sticking (set-and-verify), cloud
latency beyond apumpUntiltimeout.
Adding a locale
- Add the locale's text to
tools/tutorial_videos/config/scenarios/<scenario>.yaml:title,dictionary, every step'snarration, the dictation step'sdictation_text. Write informal register (du/tu) per repo l10n rules;
keep the penguin vocabulary. - Add per-stream
stylelines for the locale inconfig/voices.yaml
(style prompts in the target language — Voxtral/Gemini behave better). python3 -m tutorial_videos validate --scenario <s> --locale <l>must
pass, then build. The app UI localizes itself viaLOTTI_MANUAL_LOCALE
(same mechanism as manual screenshots; for a wholly new app locale, run
theadd-flutter-docusaurus-localeskill first).- Localized finder strings in the test (
localized(en:, de:)/manualScreenshotText) need the new locale only if its UI labels are
used as finders — prefer keys over text finders where possible.
Adding a scenario
- New YAML in
config/scenarios/<name>.yaml— schema documented increate_task_from_audio.yaml(unique step ids, exactly onedictation: truestep, per-locale text,min_durationfloors). - New
integration_test/tutorial/<name>_tutorial_test.dartbuilt onTutorialAppHarness+TutorialDriver. Copy the structure ofcreate_task_from_audio_tutorial_test.dart:- one
driver.step(id, action)per YAML step, ids matching exactly; - interactions via
driver.tapLikeUser(cursor glide), waits viadriver.pumpUntil*(records fast-forwardable wait spans), scrolling
viadriver.scrollIntoViewwith a vertical scrollable finder; - anything that must be SEEN gets asserted via visible widgets, not just
the DB; - wire the
diagnosticsandonTimeouthooks for failure screenshots.
- one
- Iterate with builds; expect the first runs to fail — read the failure
screenshots, they carry the answer.
Non-negotiable gotchas
The full list with rationale is in the README's "Hard-won constraints" —
the ones that bite hardest: flutter drive not flutter test (no window
otherwise); GDK_BACKEND=x11 + empty WAYLAND_DISPLAY (or the app opens on
the real desktop); Voxtral prompts in the audio's language (else it
translates); automaticUpdatesEnabled set-and-verify (initial wake clobbers
early writes); 16ms pump cadence during holds (else animations render
choppy); timeline starts after startup settles; assert transcript keywords,
not exact strings.
Adapting / extending
- App Store preview:
config/scenarios/app_store_preview.yamlis the
narration ofmake store_preview_ios, not a tutorial — nevermake tutorial_videoit. Its step ids must stay the_beatIdsofintegration_test/store_preview_test.dart(tests/test_app_preview.py
guards it), and all four lines together must leave the beats under 30 s
(python3 -m tutorial_videos.app_preview pacingfails first if not).
See the README's "The App Store preview reuses the narration". - Compositor changes: all OpenMontage API usage is isolated in
tutorial_videos/om_compose_driver.py; bump the pin inconfig/openmontage.pindeliberately and re-verify determinism
(compose twice, compareffmpeg -f framemd5of the streams — never file
hashes). - TTS vendor: implement the
TtsEngineprotocol (tts/base.py) next totts/gemini.py; voices/styles per locale inconfig/voices.yaml. - Speed/pacing knobs:
timewarp.py(MAX_SPEED, lead-in, narration
gap); per-step floors in the scenario YAML. - Character overlay (future): render transparent PNG frames via the
character film-strip harness and composite as an extra layer keyed totimeline.jsonstep ids.