Communitygithub.com

Kling AI 画像動画化

Kling AIを使用して静止画像をアニメーション動画に変換します。画像の動画化、モーション追加、I2Vパイプライン構築に使用します。'klingai image to video'、'kling ai animate image'、'klingai img2vid'、'animate picture klingai'などのフレーズでトリガーします。

Kling AI 画像動画化 とは?

このスキルは、Kling AIの画像動画化(Image-to-Video)APIを利用して、静止画像から動画を生成するための包括的なガイドを提供します。主に `/v1/videos/image2video` エンドポイントを使用し、モーションプロンプト、カメラ制御、ダイナミックマスク(モーションブラシ)、スタティックマスク、開始と終了を指定するテール画像など、多彩なパラメータをサポートしています。開発者は、Python スクリプト内で JWT 認証を扱い、APIリクエストを送信し、タスクの完了をポーリングする流れを理解できます。このスキルは、Claude Code などの AI エージェントプラットフォーム上で動作し、画像の一部分だけを動かす、カメラワークを加える、特定の領域を固定するといった高度なモーション制御を可能にします。また、エラーハンドリング、画像要件、各機能の排他ルールについても詳しく説明しており、本番環境で安全かつ効果的に使用するための実践的な手順を提供します。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace/tree/HEAD/plugins/saas-packs/klingai-pack/skills/klingai-image-to-video

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Kling AI 画像動画化 は何をしますか?

概要

/v1/videos/image2video エンドポイントを使用して静止画像をアニメーション化します。モーションプロンプト、カメラ制御、ダイナミックマスク(モーションブラシ)、スタティックマスク、および開始から終了へのトランジションのためのテール画像をサポートしています。

エンドポイント: POST https://api.klingai.com/v1/videos/image2video

リクエストパラメータ

パラメータ型必須説明
model_namestringはいkling-v1-5、kling-v2-1、kling-v2-master など
imagestringはいソース画像のURL(JPG、PNG、WebP)
promptstringいいえアニメーションの動作説明
negative_promptstringいいえ除外する内容
durationstringはい"5" または "10" 秒
aspect_ratiostringいいえ"16:9" デフォルト
modestringいいえ"standard" または "professional"
cfg_scalefloatいいえプロンプトへの準拠度(0.0~1.0)
image_tailstringいいえ最終フレーム画像URL(マスク/カメラとは排他)
camera_controlobjectいいえカメラの動き(マスク/image_tailとは排他)
static_maskstringいいえ固定領域用マスク画像URL
dynamic_masksarrayいいえモーションブラシの軌跡
callback_urlstringいいえ完了通知用Webhook

基本的な画像動画化

import jwt, time, os, requests

BASE = "https://api.klingai.com/v1"

def get_headers():
    ak, sk = os.environ["KLING_ACCESS_KEY"], os.environ["KLING_SECRET_KEY"]
    token = jwt.encode(
        {"iss": ak, "exp": int(time.time()) + 1800, "nbf": int(time.time()) - 5},
        sk, algorithm="HS256", headers={"alg": "HS256", "typ": "JWT"}
    )
    return {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}

# 風景写真をアニメーション化
response = requests.post(f"{BASE}/videos/image2video", headers=get_headers(), json={
    "model_name": "kling-v2-1",
    "image": "https://example.com/landscape.jpg",
    "prompt": "雲が空をゆっくりと流れ、優しい風が木々をそよがせる",
    "negative_prompt": "静止、凍結、ぼやけ",
    "duration": "5",
    "mode": "standard",
})

task_id = response.json()["data"]["task_id"]

# 結果をポーリング
while True:
    time.sleep(15)
    result = requests.get(
        f"{BASE}/videos/image2video/{task_id}", headers=get_headers()
    ).json()
    if result["data"]["task_status"] == "succeed":
        print(f"動画: {result['data']['task_result']['videos'][0]['url']}")
        break
    elif result["data"]["task_status"] == "failed":
        raise RuntimeError(result["data"]["task_status_msg"])

開始から終了へのトランジション(image_tail)

image_tail を使用して最初と最後のフレームの両方を指定します。Kling はそれらの間のモーションを補間します。

response = requests.post(f"{BASE}/videos/image2video", headers=get_headers(), json={
    "model_name": "kling-v2-master",
    "image": "https://example.com/sunrise.jpg",        # 最初のフレーム
    "image_tail": "https://example.com/sunset.jpg",    # 最後のフレーム
    "prompt": "太陽が空を横切るタイムラプス",
    "duration": "5",
    "mode": "professional",
})

モーションブラシ(dynamic_masks)

画像内の特定の要素に動きのパスを描画します。v2.6 では画像あたり最大6つのモーションパスを設定できます。

response = requests.post(f"{BASE}/videos/image2video", headers=get_headers(), json={
    "model_name": "kling-v2-6",
    "image": "https://example.com/person-standing.jpg",
    "prompt": "人物が自然に前に歩く",
    "duration": "5",
    "dynamic_masks": [
        {
            "mask": "https://example.com/person-mask.png",  # 白色 = 選択領域
            "trajectories": [
                {"x": 0.5, "y": 0.7, "t": 0.0},   # 開始位置(正規化 0-1)
                {"x": 0.5, "y": 0.5, "t": 0.5},   # 中間点
                {"x": 0.5, "y": 0.3, "t": 1.0},   # 終了位置
            ]
        }
    ],
})

スタティックマスク(領域固定)

画像の特定の領域を静止させたまま、残りの部分をアニメーション化します。

response = requests.post(f"{BASE}/videos/image2video", headers=get_headers(), json={
    "model_name": "kling-v2-master",
    "image": "https://example.com/scene.jpg",
    "prompt": "川の水が流れ、鳥が飛んでいる",
    "duration": "5",
    "static_mask": "https://example.com/buildings-mask.png",  # 白色 = 固定
})

排他ルール

これらの機能は単一のリクエスト内で組み合わせることはできません:

機能セット A機能セット B
image_taildynamic_masks、static_mask、camera_control
dynamic_masks / static_maskimage_tail、camera_control
camera_controlimage_tail、dynamic_masks、static_mask

画像要件

制約値
フォーマットJPG、PNG、WebP
最大サイズ10 MB
最小解像度300x300 px
最大解像度4096x4096 px
マスクフォーマット白(選択)/ 黒(除外)のPNG

エラーハンドリング

エラー原因修正
400 無効な画像URLにアクセスできない、または形式が間違っている画像URLが公開アクセス可能であることを確認
400 相互排他互換性のない機能を組み合わせたリクエストごとに1つの機能セットのみを使用
task_status: failed画像が複雑すぎる、または品質が低いより高解像度で鮮明なソースを使用
マスク不一致マスクの寸法がソースと異なるマスクがソース画像の寸法と一致することを確認

前提条件

  • ランタイムシークレットマネージャーに保存されたKling API認証情報、承認済みのモデルと期間許可リスト、およびジョブごとのクレジット予算。
  • 合成または権利処理済みのソース画像、および任意のマスクまたはテール画像。識別可能な人物に対する同意の記録と、アセットの変換許可が必要。
  • プライベートステージングバケットとレビュー担当者。新しい生成物は、ポリシー、品質、公開の承認が記録されるまで、ドラフトのみで透かし入りとすること。

手順

  1. 承認済み許可リストからソースとマスクの参照を解決する。信頼できないURL、出典不明のアセット、文書化された同意なしに識別可能な人物を含むアセットは拒否する。
  2. クレジットを使用する前に、フォーマット、寸法、機能の相互排他性、プロンプトの長さ、要求された期間を検証する。自動チェックには合成フィクスチャを使用する。
  3. 安定したジョブキーを使用してリクエストの重複を排除し、コンテンツポリシーチェックに合格した場合のみ送信する。タスクとソースはプライベートステージングストレージに保持する。
  4. 短く透かし入りのサンドボックスカナリアを1回実行する。大規模または公開レンダリングの所有者承認を要求する前に、モーション、ポリシー結果、ソースの忠実性、クレジット予算を確認する。
  5. 承認後、ダイジェストによって正確なタスク結果をプロモートする。失敗または撤回時は、下流の公開を停止し、ステージングされたメディアと一時URLを削除し、以前に承認されたアセットまたはジョブ状態に戻す。
  6. 不透明なジョブとアセットのダイジェスト、ポリシーと承認の結果、予算の結果、保持期限、ロールバック参照のみを含む、編集済みのレシートを記録する。

出力

不透明なタスク識別子、モデルと期間、ステータス、出力ダイジェストまたはプライベートステージングURL、カナリア/承認状態、およびクリーンアップまたはロールバック参照を含む結果を返す。ソース画像、マスクURL、プロンプト、顔データ、認証情報、または編集されていないプロバイダー応答をログやレシートに含めないでください。

例

安全な自動チェックには、合成の風景フィクスチャとプライベートカナリアを使用します:

source=fixture:synthetic-landscape-v3; rights=cleared; mode=standard;
duration=5; canary=watermarked-sandbox; policy=pass; approval=pending;
publish=false; contacts_exported=0; receipt=asset-sha256:opaque

同意、ポリシー、品質、所有者の承認がすべて記録されるまで、実際の顧客の写真を代用したり、カナリアを公開したりしないでください。

リソース

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

jeremylongshore/tons-of-skills-marketplace

Use when asked to structure a landing page for positioning, plan a conversion-optimized page layout, or design a launch page. Examples: "landing page for product launch", "conversion-optimized layout for SaaS

jeremylongshore/tons-of-skills-marketplace

Use when asked to design growth-optimized landing pages, activation funnel layouts, or experiment-friendly page structures. Examples: "growth-optimized landing", "activation funnel layout", "A/B testable page

jeremylongshore/tons-of-skills-marketplace

Use when asked to structure a landing page, design page layout for conversion, or plan landing page information architecture. Examples: "landing page structure for SaaS", "conversion-optimized layout

jeremylongshore/tons-of-skills-marketplace

Generate polished demo videos from a single prompt. Use when the user asks to create a demo video, product walkthrough, feature showcase, or animated presentation. Trigger with "make a demo video", "create a product video", "demo walkthrough", or "feature showcase video".

jeremylongshore/tons-of-skills-marketplace

Track cryptocurrency portfolio with real-time valuations, allocation analysis, and P&L tracking. Use when checking portfolio value, viewing holdings breakdown, analyzing allocations, or exporting portfolio data. Trigger with phrases like "show my portfolio", "check crypto holdings", "portfolio allocation", "track my crypto", or "export portfolio".

jeremylongshore/tons-of-skills-marketplace

Runs the full release workflow for the current project. Commits any uncommitted changes, pushes to remote, creates and merges a PR if on a feature branch, determines the next semver version from conventional commits, creates an annotated git tag and GitHub release with generated notes, cleans up merged branches, and returns to a clean main. Use when the user says promote, ship, release, commit and push, tag and release, or get back to main.

jeremylongshore/tons-of-skills-marketplace

Agent skill at plugins/productivity/content-multiplier/skills/channel-formats/SKILL.md

jeremylongshore/tons-of-skills-marketplace

Operate an evidence-backed editorial queue, balance topic and format coverage, schedule approved drafts, and reconcile backlog state with the publishing system. Use when choosing or scheduling the next blog work. Trigger with "show the editorial calendar" or "pick the next topic".

jeremylongshore/tons-of-skills-marketplace

Configure CI/CD pipeline for AppFolio property management integrations. Trigger: "appfolio CI".

jeremylongshore/tons-of-skills-marketplace

Diagnose and fix common AppFolio API integration errors. Trigger: "appfolio error".

jeremylongshore/tons-of-skills-marketplace

Build property management dashboard with AppFolio API data. Trigger: "appfolio property dashboard".

jeremylongshore/tons-of-skills-marketplace

Automate tenant management and lease operations with AppFolio. Trigger: "appfolio tenant management".

jeremylongshore/tons-of-skills-marketplace

Collect AppFolio API debug evidence for support tickets. Trigger: "appfolio debug".

jeremylongshore/tons-of-skills-marketplace

Deploy AppFolio integration service to cloud infrastructure. Trigger: "deploy appfolio".

jeremylongshore/tons-of-skills-marketplace

Query AppFolio properties, units, and tenants via REST API. Trigger: "appfolio hello world".

jeremylongshore/tons-of-skills-marketplace

Configure AppFolio Stack API authentication with OAuth 2.0. Use when setting up property management API access, registering as an AppFolio Stack partner, or configuring client credentials for API calls. Trigger: "install appfolio", "setup appfolio", "appfolio auth", "appfolio API key".

jeremylongshore/tons-of-skills-marketplace

Set up local development for AppFolio property management API integration. Trigger: "appfolio local dev".

jeremylongshore/tons-of-skills-marketplace

Production readiness checklist for AppFolio integrations. Trigger: "appfolio production checklist".

jeremylongshore/tons-of-skills-marketplace

Handle AppFolio API rate limits with throttling and backoff. Trigger: "appfolio rate limit".

jeremylongshore/tons-of-skills-marketplace

Reference architecture for AppFolio property management integration. Trigger: "appfolio architecture".

関連スキル