Communitygithub.com

story-video

Turn a short Japanese practice story into an illustrated MP4 for a Japanese learner. Each sentence gets its own image, generated locally with ComfyUI + SDXL, keeping the same characters from start to finish. The audio is a narration WAV (made by the learner with any Japanese TTS, or made here). Japanese subtitles are synced with Anki Miner and delivered as a separate .srt next to the MP4, never burned into the picture. Use when the user asks for a video of a story ("make a video of the story", "story video", "pictures for the story", or the same in their own language), or wants a graded reader, practice story or listening exercise told as a picture story.

¿Qué es story-video?

story-video is a Claude Code agent skill that turn a short Japanese practice story into an illustrated MP4 for a Japanese learner. Each sentence gets its own image, generated locally with ComfyUI + SDXL, keeping the same characters from start to finish. The audio is a narration WAV (made by the learner with any Japanese TTS, or made here). Japanese subtitles are synced with Anki Miner and delivered as a separate .srt next to the MP4, never burned into the picture. Use when the user asks for a video of a story ("make a video of the story", "story video", "pictures for the story", or the same in their own language), or wants a graded reader, practice story or listening exercise told as a picture story.

Compatible con~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mattias/story-video/tree/HEAD/skills/story-video

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Story video

The learner is studying Japanese and may speak any language. They want their practice stories as a picture story: one image per sentence that shows what is being said, the narration as audio, and Japanese subtitles as a separate .srt. The video does not need to be animated. It must hang together from start to finish: the same characters, the same world. Talk to the user in the language they write to you in. Never assume anyone's pronouns.

SKILL = the folder this file is in. The scripts are in SKILL\scripts\. Run them with PowerShell 7 (pwsh), never with Windows PowerShell 5, which garbles Japanese in the script text. From Bash: pwsh -NoProfile -File "<script>" -Dir "<WORK>".

Requirements

WhatNotes
Windows + an NVIDIA GPUTested on 16 GB VRAM: about 5 s per 1344×768 image at 30 steps. SDXL needs about 8 GB or more.
ComfyUI (Windows portable)COMFYUI_ROOT = the folder that holds run_nvidia_gpu.bat (default C:\ComfyUI_windows_portable). From the GitHub releases of comfyanonymous/ComfyUI, ComfyUI_windows_portable_nvidia.7z.
Image modelsd_xl_base_1.0.safetensors in COMFYUI_ROOT\ComfyUI\models\checkpoints\ (Hugging Face stabilityai/stable-diffusion-xl-base-1.0). Another SDXL checkpoint works with gen_images.ps1 -Checkpoint <file>.
ffmpeg / ffprobeOn PATH
Anki MinerFor the .srt (AnkiMiner.exe --api sync, Audiobook sync), installed under %LOCALAPPDATA%\Programs\AnkiMiner. Without it, write the .srt by hand from known timings, or use any forced aligner.
A Japanese TTSAny voice that writes a WAV.

If something is missing, tell the user what and where, and ask before downloading anything (ComfyUI is about 2 GB, the SDXL model about 7 GB).

Steps

1. Work folder, text and audio

  • WORK = a new folder for this video, next to the story if the story is a file (e.g. <story folder>\video-<short ascii name>\).
  • WORK\story.txt: the title on line 1, then one sentence per line, exactly as spoken (no speaker tags such as 【friend】, no markdown).
  • WORK\story.wav: the narration, which must read the title first, just like the .txt. If the user has none, ask which TTS and voice to use.
  • Sync: sync_srt.ps1 -Wav WORK\story.wav -Txt WORK\story.txt writes WORK\story.srt. It requires ok: true, grade A and as many cues as lines. If it fails, check first that the .txt matches what is actually said (is the title included?).

2. Picture script: WORK\scenes.json

Start from SKILL\scenes.example.json. One scene per cue, with id "00", "01", … in the same order as the .srt (00 = the title).

  • cast: fix 2–4 recurring characters once and use them as {hero} and so on in the prompts. Give each one one or two strong, unique traits (hair colour, beard / clean-shaven, a garment in a unique colour) with weight (…:1.2). If the story has a narrator who retells something ("I watched…", "my friend said…"), let the narrator open and close the video, and illustrate the content of the story in between.
  • Each scene shows what the sentence says, with its key word as the motif (昼食 → they eat lunch, 回収 → someone is carried away, 供給 → empty supply crates). Weight the concrete motif (…:1.3). This is what makes the video useful for learning: the picture explains the word.
  • At most 1–2 characters per image. SDXL mixes up traits when there are 3 or more (everyone gets a beard, hair colours swap). If a group is needed, show it from behind or at a distance.
  • Always state the setting ("in a dark stone dungeon"), or SDXL drifts into a kitchen or outdoors.
  • No recreations of existing works: generic characters only, never a show's or game's own character designs, even if the story is about that show.
  • Avoid violence and gore. Describe death, injury and the like softly (a covered stretcher, a glowing magic circle).
  • seed: 1001, 1002, … (any number; it only keeps an image reproducible).

3. Images

  1. comfy.ps1 -Action start (wait for "running").
  2. gen_images.ps1 -Dir WORK creates images\00.png ….
  3. sheet.ps1 -Dir WORK, then look at WORK\sheet.png. Check each image against its sentence: is the motif there, are the right characters there, is the setting right?
  4. For images that miss: rewrite that scene's prompt (fewer characters, a stronger motif, an explicit setting), then gen_images.ps1 -Dir WORK -Only "04,08" -Variants 3 → sheet.ps1 -Dir WORK -Only "04,08" → look at WORK\variants.png (one row per scene, v1 v2 v3 from left to right). Copy the best one: images\variants\04_v2.png → images\04.png. Do at most 2 rounds per image, then pick the best you have.
  5. comfy.ps1 -Action stop once the images are done (frees the GPU).

4. Video

  • assemble.ps1 -Dir WORK -Out "<title>.mp4". Each image is shown from its cue's start until the next cue starts, at 1920×1080. There are no subtitles in the picture: the script copies story.srt to <title>.srt beside the MP4 (same base name, so players such as VLC and mpv load it automatically, or the user drags it in).
  • Look at WORK\check.png (a frame from the middle): the image matches the sentence and there is no text in the picture.
  • Give the user the MP4 and the <title>.srt.

5. Report

Give the file paths, length, number of images and voice. Name any images that are weak (e.g. a character who looks different) and how to swap one: change the prompt in scenes.json, run gen_images.ps1 -Only NN, then assemble.ps1 again. Keep variants.png and images\variants\ so the user can pick differently.

Pitfalls

  • Locales with decimal commas: all times passed to ffmpeg must use InvariantCulture (the scripts handle this).
  • ComfyUI's /history can return an empty subfolder. The scripts join the path without it.
  • A ComfyUI process started as a background task reports a failed or killed exit when comfy.ps1 -Action stop stops it. That is expected, not a fault.

Skills relacionados