Communitygithub.com

umiyosh/motion-render

テーマを渡されたら、それを説明するアニメーション動画を Claude Motion で作り、ナレーション(Gemini TTS)とテーマに合う BGM(Lyria)を付けて MP4 にする。「〇〇を説明する動画を作って」「〇〇の紹介動画」「/motion-render 〇〇」、既存の Motion の動画を MP4 にしたいときに使う。

motion-render 是什么?

motion-render is a Claude Code agent skill that テーマを渡されたら、それを説明するアニメーション動画を Claude Motion で作り、ナレーション(Gemini TTS)とテーマに合う BGM(Lyria)を付けて MP4 にする。「〇〇を説明する動画を作って」「〇〇の紹介動画」「/motion-render 〇〇」、既存の Motion の動画を MP4 にしたいときに使う。.

兼容平台✓Claude Code~Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/umiyosh/motion-render/tree/HEAD/skills/motion-render

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Motion Render

/motion-render <theme> – with a single phrase, create an animated video explaining the theme, add narration and BGM, and output an MP4 file.

Narration and BGM are always added. Do not create a video without audio. When converting an existing Motion video to MP4, also write scene-appropriate narration and generate BGM.

How to Decide: Decide Without Asking

Claude decides everything except the theme. Only follow what the user explicitly specifies. Do not stop to ask questions.

ItemDefault
Duration~60 seconds (6–9 scenes). Final length is determined by narration length
Visual style / color schemeDecide based on the theme. If the user's organization has a standard design system, use its color scheme
Voice / speech rateKore, 1.1x speed
BGMWrite prompt for Lyria based on the theme's atmosphere (see "BGM" below)
Output directory$MOTION_RENDER_OUT_DIR if specified, otherwise current directory. If current directory is a git repository, use a non-working directory like ~/Movies

Motion's Artifact type requires asking about Style, Colors, and Length during creation, but this skill treats it as if the user asked to "decide and handle it" and decides without asking.

0. Preparation (Check First, Every Time)

This skill uses the motion-render command for rendering and composition. If installed as a Claude Code plugin, the plugin provides motion-render and the user does nothing. If installed as a standalone skill (via skills CLI, etc.), use the skill's directory (the "Base directory for this skill" passed to Claude, referred to as <skill>).

  1. Run motion-render --version and compare with the version in <skill>/package.json. If the same, proceed.
  2. If the command is missing or the version differs, run npm install -g "<skill>". If this fails due to permissions or sandbox restrictions, instruct the user to reinstall it as a Claude Code plugin (see README's "Installation"; additional work will then be unnecessary).
  3. Without GEMINI_API_KEY, narrate and bgm will fail. If they fail, instruct the user to obtain an API key from Google AI Studio, add export GEMINI_API_KEY=... to their shell configuration, and restart Claude Code.
  4. If Chromium fails to start with bootstrap_check_in ... Permission denied when running motion-render stills etc., it is because it is running inside the Claude Code sandbox. Instruct the user to add the following to ~/.claude/settings.json (Claude cannot change its own permission settings): "sandbox": { "excludedCommands": ["motion-render:*"] } and "permissions": { "allow": ["Bash(motion-render:*)"] }

On the first run of stills or build, Chromium (~210 MB) will be downloaded automatically.

Prerequisites

  • Run motion-render by itself. Adding anything around it like | grep, &&, FOO=1 motion-render will cause it to run inside the sandbox and Chromium will fail to start. The same applies to narrate and bgm, which use the network.
  • Create the working directory <work> in the scratchpad (or working directory if no scratchpad) with a lowercase English name representing the theme.

Working Directory

<work>/
  script.json   # Script (written by Claude)
  timing.json   # Scene durations (written by narrate)
  audio/        # <scene_id>.wav, bgm.mp3, mix.m4a
  film/         # Video data retrieved from Motion (extracted by prepare)

Format of script.json:

{
  "title": "Workload Identity Federation",
  "bgm": "Calm, focused electronic music for a cloud security explainer: soft pulsing synth, light percussion, 100 BPM",
  "scenes": [
    { "id": "title", "name": "Title", "narration": "With Workload Identity Federation, ..." },
    { "id": "token", "name": "Token Issuance", "narration": "..." }
  ]
}
  • id uses lowercase letters, numbers, and -. Must match the scene id in Motion.
  • narration is the text to be read by TTS. Write proper nouns and acronyms as they are (e.g., GitHub Actions). Screen text remains in its original form.
  • Optional: voice, speed, bgmVolume (default 0.15), lead, tail, endHold

Procedure

1. Write the Storyboard and Script

Divide the theme into one event per scene. For explaining a mechanism, the following structure works well:

  • Place appearing elements (e.g., GitHub Actions, Token, Google Cloud STS, Service Account) as cards in the scene.
  • Depict interactions (tokens, requests) as chips moving between cards. Show order with a numbered flow diagram and highlight the current step.
  • At the beginning, state "what this is about"; at the end, state "what the result is" in one sentence.
  • Narration per scene is 1–2 sentences (5–9 seconds when spoken).

Prioritize accuracy. If unsure about any part of the mechanism explanation, verify it with official documentation before writing.

2. Create Narration (Determines Scene Durations)

motion-render narrate <work>

This produces timing.json with the start time and duration of each scene. Use these values directly for Motion scene dur.

3. Create Motion Video

  1. Use Artifact’s quickstart (intent: "other") or list (scope: "types") to find the Motion type’s type_url, then create it with a title.
  2. Follow the returned Motion type instructions to create scenes. However:
    • Do not ask questions (see "How to Decide" above).
    • The scene id and dur in scenes.json must match those in timing.json.
    • Do not create Motion’s built-in BGM (score.js). This skill handles the audio.
  3. You may create BGM in parallel: motion-render bgm <work>

4. Retrieve and Review Video Data

  1. Use Artifact’s read with paths: ["index.html", "artifact-type/app.js", "artifact-type/app.css"], out_dir: <work>/film
  2. Use ArtifactData’s list (collection: "modules") and get (film/script) saving to out_dir: <work>/store
  3. motion-render prepare <work>/store <work>/film
  4. motion-render stills <work>/film <work>/stills <comma-separated mid-scene times in seconds> to see all scenes. If there are unnatural line breaks, overflow, or overlap in headings, fix the Motion side and redo step 4.

5. Create MP4

motion-render build <work> [<output.mp4>]

Place narration at the start of each scene, overlay BGM at constant volume, and create MP4. It will stop if narration or BGM is missing.

6. Verify and Report

  • Use ffprobe to check that the file has both video and audio tracks and the correct duration.
  • Report: output path, duration, scene flow, BGM atmosphere, Motion URL. If you did not listen to the audio, note that you did not.

BGM

In script.json’s bgm field, write an English prompt that matches the theme’s atmosphere. Be specific about instruments, tempo, and mood.

Theme TypePrompt Example
Technical mechanism / securitycalm focused electronic, soft pulsing synth, light percussion, ~100 BPM
News / announcementmodern news broadcast theme, driving synth arpeggio, tight electronic drums, ~120 BPM
Product introduction / upbeat topicwarm upbeat, marimba and electric piano, light shaker, ~110 BPM
Retrospective / mellowgentle ambient piano, soft pads, slow

If the user says the BGM is "lame" etc., rewrite bgm and redo motion-render bgm → motion-render build. No need to re-render the video (the build command renders each time, but no changes on the Motion side are needed).

When Converting an Existing Motion Video to MP4

Also add audio when given a URL. Retrieve the video data (step 4), and for each scene in scenes.json, write narration that fits within that scene’s duration (approx. 7–8 characters per second; use the same id as in scenes.json). build will place narration at the actual scene start time in the video and warn if any narration doesn’t fit within the scene. If warnings appear, trim the script or increase speed and redo from narrate.

Files

  • scripts/cli.mjs: motion-render command
  • scripts/audio.mjs: Gemini TTS / Lyria calls (with 90-second timeout and retries) and audio mixing
  • scripts/work.mjs: Validation of script.json and calculation of timing.json
  • scripts/render.mjs: Opens player and returns frames. Blocks external communication during rendering and enables Chromium sandbox

相关技能