openrouter-image2video

$npx mdskill add QinghongLin/data2story-skill/openrouter-image2video

Animate a still image into a short video via OpenRouter.

  • Animates a still image with subtle motion like camera pan or parallax.
  • Depends on OpenRouter API and a Python script for base64 encoding.
  • Uses a user-provided image and motion prompt to generate the video.
  • Downloads the resulting video file to a specified local path.

SKILL.md

.github/skills/openrouter-image2videoView on GitHub ↗
---
name: openrouter-image2video
description: Animate a still image into a short video via OpenRouter. Default model google/veo-3.1-fast.
---

# openrouter-image2video

Image + motion-prompt → video via OpenRouter. Default model: `google/veo-3.1-fast`.

Use this when you already have a strong still image and want to bring it to life with subtle motion (camera pan, parallax, gentle animation) while preserving the composition. For motion-from-scratch, use `openrouter-text2video` instead.

The script accepts either a remote image URL or a local image path; local files are base64-encoded and inlined into the request as a data URL.

## Usage

Resolve `TOOL_DIR` = the directory containing this `SKILL.md`. Commands below use `TOOL_DIR` as a symbolic placeholder; replace it with the resolved, quoted path before running Bash.

```bash
export OPENROUTER_API_KEY=sk-or-v1-...

# From a local image you already generated with text2image
python3 TOOL_DIR/scripts/generate_video_from_image.py \
  --image PROJECT_DIR/assets/teaser.png \
  --prompt "slow parallax push-in, soft drift of ambient particles, no camera shake" \
  --duration 5 \
  --aspect-ratio 16:9 \
  --download PROJECT_DIR/assets/teaser.mp4

# Or from a remote URL
python3 TOOL_DIR/scripts/generate_video_from_image.py \
  --image-url "https://example.com/still.png" \
  --prompt "subtle camera dolly forward, gentle depth-of-field shift" \
  --download PROJECT_DIR/assets/scene.mp4
```

## Flags

| Flag | Default | Description |
|---|---|---|
| `--prompt` | required | Motion prompt — describe what should move and how |
| `--download` | required | Output MP4 path |
| `--image` | one of `--image` / `--image-url` required | Local image path (PNG/JPG); will be base64-encoded |
| `--image-url` | one of `--image` / `--image-url` required | Remote image URL |
| `--model` | `google/veo-3.1-fast` | Any OpenRouter image-to-video-capable model |
| `--duration` | `5` | Seconds |
| `--aspect-ratio` | `16:9` | `16:9`, `9:16`, `1:1`, `4:3`, `3:4`, `21:9`, `9:21` |
| `--resolution` | `720p` | Model-dependent (e.g. `480p`, `720p`, `1080p`) |
| `--frame-role` | `first` | `first` or `last` — anchor frame role for the input image |
| `--generate-audio` | off | Generate audio with video (if model supports) |
| `--poll-interval` | `5` | Seconds between polls |
| `--max-wait` | `600` | Max total wait time |

## Flow

1. `POST /api/v1/videos` with body:
   ```json
   {
     "model": "google/veo-3.1-fast",
     "prompt": "...motion prompt...",
     "aspect_ratio": "16:9",
     "duration": 5,
     "resolution": "720p",
     "frame_images": [
       {
         "type": "image_url",
         "frame_type": "first_frame",
         "image_url": {"url": "data:image/png;base64,..." }
       }
     ]
   }
   ```
   The `--frame-role first|last` flag maps to `frame_type: "first_frame"|"last_frame"`.
2. `GET /api/v1/videos/{id}` every 5s until `status == "completed"`
3. `GET /api/v1/videos/{id}/content` → raw MP4 bytes

## Notes

- Veo 3.1 Fast is optimized for low-latency image-to-video. Typical render ≈ 60-180s for a 5s 720p clip.
- The motion prompt should describe motion only, not the subject (the subject comes from the image).
- For subjects with prominent faces, keep motion subtle to avoid uncanny artifacts.
- If you also want a defined ending state, supply two images via `frame_images` with roles `first` and `last`. The current script wires only one anchor frame; extend `body["frame_images"]` to add a second.

More from QinghongLin/data2story-skill

SkillDescription
analystExhaustively profile a dataset and list ALL possible analyses — distributions, correlations, rankings, trends, group comparisons, anomalies. Reads detective.json for context. Runs after the Detective/Scout, before the Editor. Outputs analyst.json with ana_xx IDs and chart-ready data_tables.
auditorAudit a generated Data2Story blog for build correctness across ALL modalities by ACTUALLY RENDERING it in a real headless browser (when available) — catching blank/0-width charts, broken/oversized media, desktop+mobile overflow, and dead interactions that source inspection cannot see — then having vision agents review the screenshots, playtesting every interactive, and walking the flagship capability contract. Plus VIEW every image for a wrong/AI-faked subject. Fixes layout in place; sends content-correctness problems back to the owning role. Use at Stage 6 after the Programmer assembles index.html and before the Critic; re-runs each revision round. Triggers: a built index.html exists, or you need to confirm charts/media/interactions actually render.
cinematographerDesign the MANDATORY cinematic scroll experience (every blog ships one): a full-bleed, scroll-driven background — primarily from the Scout's verified real imagery — plus the global motion choreography, so the narrative unfolds like a film as the reader scrolls. Owns the BACKGROUND layer + page-level motion (not the Designer's per-section visuals, not the Interaction centerpiece — it stages them inside the scroll). Outputs cinematographer.json (cin_xx scenes). There is no off path: a topic with no sourceable real imagery falls back to a generative-atmosphere or data-driven-spine background, never to a bare column.
copywriterName the piece — re-write the masthead (headline + standfirst + kicker), every section title, and every figure/photo/table caption to a research-driven titling standard, killing the AI-tell patterns (the 'flat statement. flat counter-statement.' two-beat above all) a competent default falls into. Reads editor.md/json + analyst.json + the resolved topic_profile; writes copywriter.json — STRINGS ONLY (masthead{headline,standfirst,kicker}, items{edt_xx:{title}, des_xx:{caption}}), each backed by a real ana_*. Names, never edits: it touches no finding, no number, no data-* id, no layout — so the Verify layer is untouched and the Programmer renders the masthead + figcaptions from copywriter.json verbatim. Runs at Stage 3.5, after the Editor, before the Designer.
criticReview a finished Data2Story blog against the 5 quality rubric dimensions (visual_design, narrative_pacing, data_method_transparency, claim_data_alignment, insight_value), score each 1-7 with on-page evidence, and emit critic.json with pass/fail + targeted, surgical send-back instructions. Verifies every load-bearing claim/asset against its traceability chain before scoring; applies the caveat-survival, honest-accuracy, and third-party-attribution caps. Does NOT rewrite content — scores and sends back. Use at Stage 6.5 after the Auditor and after verify.py has produced verifier.json; re-runs each revision round. Triggers: a built index.html plus verifier.json exist, or you need to judge whether the article is actually good.
data2storyData Journalist Agent (Data2Story) — orchestrator: turn a dataset into a blog. Runs detective → analyst → editor → designer → programmer → auditor → inspector in sequence. Creates a versioned project folder for each run.
data2story-proUse to turn a dataset into a verifiable multimedia blog (a data story / data-driven article / interactive dashboard from a dataset). Orchestrator for the Data Journalist Agent (Data2Story): a 7-team newsroom (14 agents) running detective → scout → analyst → imagineer → editor → copywriter → designer → interaction → hero → cinematographer → programmer → auditor → critic → inspector in sequence. Trigger when the user hands over a dataset (CSV/JSON/folder/path) and wants a published story, blog post, or interactive report built from it. Creates a versioned project folder per run.
dataviz-craftA shared reference library for editorial-grade data-visualization craft — Vega-Lite-first with a D3 fallback for charts Vega-Lite can't express. Read by the Designer at chart selection (intent → ranked chart type), the Programmer at implementation (editorial Vega-Lite recipes, annotation layers, axis/label de-clutter, encoding craft), and the Auditor/Critic for chart-quality review. It encodes the FT Visual Vocabulary intent taxonomy, the Cleveland–McGill channel-accuracy ordering, the BBC bbplot de-clutter ruleset, and colorblind-safe encoding rules. Not a pipeline stage — a craft source, like frontend-design.
designerRead editor.md, editor.json, and analyst.json. Make data-driven creative visual decisions for every section — teaser, charts, images, videos, audio, maps, and interactive demos when they fit the data. Generate selected assets. No HTML. Outputs designer.json with des_xx IDs.
detectiveResearch external context for a dataset — domain background, history, related studies, and why this data matters. Outputs detective.json (structured findings with det_xx IDs) before any analysis begins.