$npx -y skills add QinghongLin/data2story-skill --skill openrouter-image2videoAnimate a still image into a short video via OpenRouter. Default model google/veo-3.1-fast.
| 1 | # openrouter-image2video |
| 2 | |
| 3 | Image + motion-prompt → video via OpenRouter. Default model: `google/veo-3.1-fast`. |
| 4 | |
| 5 | 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. |
| 6 | |
| 7 | 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. |
| 8 | |
| 9 | ## Usage |
| 10 | |
| 11 | 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. |
| 12 | |
| 13 | ```bash |
| 14 | export OPENROUTER_API_KEY=sk-or-v1-... |
| 15 | |
| 16 | # From a local image you already generated with text2image |
| 17 | python3 TOOL_DIR/scripts/generate_video_from_image.py \ |
| 18 | --image PROJECT_DIR/assets/teaser.png \ |
| 19 | --prompt "slow parallax push-in, soft drift of ambient particles, no camera shake" \ |
| 20 | --duration 5 \ |
| 21 | --aspect-ratio 16:9 \ |
| 22 | --download PROJECT_DIR/assets/teaser.mp4 |
| 23 | |
| 24 | # Or from a remote URL |
| 25 | python3 TOOL_DIR/scripts/generate_video_from_image.py \ |
| 26 | --image-url "https://example.com/still.png" \ |
| 27 | --prompt "subtle camera dolly forward, gentle depth-of-field shift" \ |
| 28 | --download PROJECT_DIR/assets/scene.mp4 |
| 29 | ``` |
| 30 | |
| 31 | ## Flags |
| 32 | |
| 33 | | Flag | Default | Description | |
| 34 | |---|---|---| |
| 35 | | `--prompt` | required | Motion prompt — describe what should move and how | |
| 36 | | `--download` | required | Output MP4 path | |
| 37 | | `--image` | one of `--image` / `--image-url` required | Local image path (PNG/JPG); will be base64-encoded | |
| 38 | | `--image-url` | one of `--image` / `--image-url` required | Remote image URL | |
| 39 | | `--model` | `google/veo-3.1-fast` | Any OpenRouter image-to-video-capable model | |
| 40 | | `--duration` | `5` | Seconds | |
| 41 | | `--aspect-ratio` | `16:9` | `16:9`, `9:16`, `1:1`, `4:3`, `3:4`, `21:9`, `9:21` | |
| 42 | | `--resolution` | `720p` | Model-dependent (e.g. `480p`, `720p`, `1080p`) | |
| 43 | | `--frame-role` | `first` | `first` or `last` — anchor frame role for the input image | |
| 44 | | `--generate-audio` | off | Generate audio with video (if model supports) | |
| 45 | | `--poll-interval` | `5` | Seconds between polls | |
| 46 | | `--max-wait` | `600` | Max total wait time | |
| 47 | |
| 48 | ## Flow |
| 49 | |
| 50 | 1. `POST /api/v1/videos` with body: |
| 51 | ```json |
| 52 | { |
| 53 | "model": "google/veo-3.1-fast", |
| 54 | "prompt": "...motion prompt...", |
| 55 | "aspect_ratio": "16:9", |
| 56 | "duration": 5, |
| 57 | "resolution": "720p", |
| 58 | "frame_images": [ |
| 59 | { |
| 60 | "type": "image_url", |
| 61 | "frame_type": "first_frame", |
| 62 | "image_url": {"url": "data:image/png;base64,..." } |
| 63 | } |
| 64 | ] |
| 65 | } |
| 66 | ``` |
| 67 | The `--frame-role first|last` flag maps to `frame_type: "first_frame"|"last_frame"`. |
| 68 | 2. `GET /api/v1/videos/{id}` every 5s until `status == "completed"` |
| 69 | 3. `GET /api/v1/videos/{id}/content` → raw MP4 bytes |
| 70 | |
| 71 | ## Notes |
| 72 | |
| 73 | - Veo 3.1 Fast is optimized for low-latency image-to-video. Typical render ≈ 60-180s for a 5s 720p clip. |
| 74 | - The motion prompt should describe motion only, not the subject (the subject comes from the image). |
| 75 | - For subjects with prominent faces, keep motion subtle to avoid uncanny artifacts. |
| 76 | - 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. |