Communitygithub.com

Kling AI 影片延伸

使用 Kling AI 的延續功能來延長影片長度。適合將短片段製作成較長影片或建構影片序列。可透過「klingai 延伸影片」、「kling ai 影片延續」等短語觸發。

Kling AI 影片延伸 是什麼?

這個技能讓 AI 助手能夠利用 Kling AI 的影片延伸功能,將已完成的影片任務無縫地延長。開發者可以通過呼叫 API 來指定要延長的原始影片任務 ID、描述延伸動作或場景的提示詞、以及延伸的秒數。技能提供了基本延伸和鏈式延伸兩種模式:基本延伸適用於簡單的單次延長,而鏈式延伸則可以通過多次呼叫來逐步建構更長的影片,例如從一個 5 秒的片段開始,經過三次 5 秒的延伸,最終生成 20 秒的完整影片。操作流程包括生成初始影片、提交延伸任務、輪詢任務狀態直到完成,並支援標準和專業兩種模式,每段 5 秒的延伸分別消耗 10 或 35 個積分。此外,技能還強調了錯誤處理、前提條件(如版權審查)和輸出規範,確保延伸任務符合政策和品質要求。

相容平台✓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-video-extension

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Kling AI 影片延伸 是做什麼的?

概述

通過附加額外的秒數來延長現有影片。延伸端點接收已完成的影片的 task_id,並生成無縫的延續內容。

端點: POST https://api.klingai.com/v1/videos/video-extend

請求參數

參數類型必填說明
task_idstring是已完成來源影片的任務 ID
promptstring否延伸的動作/場景描述
durationstring否延伸長度:"5"(預設)
modestring否"standard" 或 "professional"
model_namestring否預設值:"kling-v2-master"
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"}

# 步驟 1:生成初始的 5 秒影片
initial = requests.post(f"{BASE}/videos/text2video", headers=get_headers(), json={
    "model_name": "kling-v2-master",
    "prompt": "A rocket launching from a desert landscape, cinematic",
    "duration": "5",
    "mode": "standard",
}).json()
initial_task_id = initial["data"]["task_id"]

# 等待完成...
# (輪詢直到 task_status == "succeed")

# 步驟 2:再延伸 5 秒
extension = requests.post(f"{BASE}/videos/video-extend", headers=get_headers(), json={
    "task_id": initial_task_id,
    "prompt": "The rocket ascends through clouds into the stratosphere",
    "duration": "5",
    "mode": "standard",
}).json()
ext_task_id = extension["data"]["task_id"]

# 步驟 3:輪詢延伸任務
while True:
    time.sleep(15)
    result = requests.get(
        f"{BASE}/videos/video-extend/{ext_task_id}", headers=get_headers()
    ).json()
    if result["data"]["task_status"] == "succeed":
        extended_url = result["data"]["task_result"]["videos"][0]["url"]
        print(f"延伸後的影片:{extended_url}")
        break
    elif result["data"]["task_status"] == "failed":
        print(f"失敗:{result['data']['task_status_msg']}")
        break

鏈式多重延伸

def chain_extensions(initial_task_id: str, prompts: list[str],
                     duration: str = "5", mode: str = "standard") -> list[str]:
    """鏈式多重延伸以建構更長的影片。"""
    current_task_id = initial_task_id
    video_urls = []

    for i, prompt in enumerate(prompts):
        print(f"延伸 {i + 1}/{len(prompts)}:提交中...")

        # 提交延伸
        r = requests.post(f"{BASE}/videos/video-extend", headers=get_headers(), json={
            "task_id": current_task_id,
            "prompt": prompt,
            "duration": duration,
            "mode": mode,
        }).json()
        ext_task_id = r["data"]["task_id"]

        # 輪詢直到完成
        while True:
            time.sleep(15)
            result = requests.get(
                f"{BASE}/videos/video-extend/{ext_task_id}", headers=get_headers()
            ).json()
            status = result["data"]["task_status"]

            if status == "succeed":
                url = result["data"]["task_result"]["videos"][0]["url"]
                video_urls.append(url)
                current_task_id = ext_task_id  # 下一次延伸從此接續
                print(f"延伸 {i + 1} 完成:{url}")
                break
            elif status == "failed":
                raise RuntimeError(f"延伸 {i + 1} 失敗:{result['data']['task_status_msg']}")

    return video_urls

使用方式:建構一段 20 秒的影片

# 生成初始 5 秒
initial_r = requests.post(f"{BASE}/videos/text2video", headers=get_headers(), json={
    "model_name": "kling-v2-master",
    "prompt": "Morning sunrise over a mountain lake, mist rising",
    "duration": "5",
    "mode": "standard",
}).json()
initial_id = initial_r["data"]["task_id"]
# ... 輪詢直到完成 ...

# 鏈式延伸 3 次 = 5 + 5 + 5 + 5 = 總共 20 秒
extensions = chain_extensions(initial_id, [
    "Sun rises higher, birds begin flying across the lake",
    "A deer approaches the water's edge to drink",
    "Wide shot pulling back to reveal the full mountain range",
])

費用

每次延伸的費用與一次新的生成相同:

延伸長度標準模式專業模式
5 秒10 點數35 點數

一段 20 秒的影片(初始 + 3 次延伸)在標準模式下花費 40 點數。

錯誤處理

錯誤原因修正方法
無效的 task_id來源任務不存在確認 task_id 來自已完成的生成任務
來源未完成嘗試延伸一個仍在處理中的任務等待來源任務達到 succeed 狀態
延伸失敗提示詞與來源衝突讓延伸提示詞與原始場景保持一致

先決條件

  • 已完成且版權已清除或合成的來源草稿、已批准的延伸簡報、已授權的工作區與點數預算、政策審查、僅限草稿的目標、以及一個可回滾/移除的負責人。

操作說明

  1. 在建立延伸之前,確認來源所有權、完成狀態及已批准的連續性簡報;請勿使用私人、未授權或受政策限制的素材。
  2. 在批准的長度和點數上限內提交一個帶浮水印的草稿測試,然後驗證政策、版權、品質和目標控制。
  3. 若遇到連續性、政策、版權或預算偏離,立即暫停並刪除延伸任務,不要發布。
  4. 僅在獲得所有者批准後才進行推廣;保留一份經過編輯的收據,並在約定的保留期限後移除臨時資產。

輸出

生成一份延伸收據,內容包含來源任務參考、版權分類、模式/長度、點數估算、政策審查、草稿目標、批准人、保留/移除參考以及任務 ID。排除提示詞、身份資訊和資產 URL。

範例

source=synthetic-task-42; rights=cleared; duration=5s; mode=standard; policy=pass; destination=draft-only; cleanup=24h 可以安全進行審查。

資源

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".

相關技能