Skip to content
dreamina-video-first-frame logo

首帧生视频工具

dreamina-video-first-frame

将图片作为首帧生成视频 (gen_video)

NeverSight/skills_feed0installs215starsOther

SKILL.md

Full skill instructions

首帧生视频工具

API 端点

POST https://jimeng.jianying.com/​mweb/​v1/​aigc_draft/​generate

Python 示例

import requests
import hashlib
import time
import uuid
import json
import random

def generate_sign(uri_path):
    device_time = int(time.time())
    sign_str = f"9e2c|{uri_path[-7:]}|7|5.8.0|{device_time}||11ac"
    sign = hashlib.md5(sign_str.encode()).hexdigest()
    return sign, device_time

def image_to_video(sessionid, image_uri, prompt, width=1536, height=1536, 
                   duration_ms=5000, resolution="720p", 
                   model="dreamina_ic_generate_video_model_vgfm_3.0_fast"):
    """
    首帧生视频 - 基于图片生成视频
    
    Args:
        sessionid: 登录 sessionid
        image_uri: 首帧图片 URI
        prompt: 视频运动描述
        width: 图片宽度
        height: 图片高度
        duration_ms: 视频时长毫秒 (3000-10000)
        resolution: 分辨率 "720p" 或 "1080p"
        model: 模型名称
    """
    uri = "/​mweb/​v1/​aigc_draft/​generate"
    sign, device_time = generate_sign(uri)
    
    component_id = str(uuid.uuid4())
    submit_id = str(uuid.uuid4())
    seed = random.randint(1000000000, 9999999999)
    
    aspect_ratio = f"{width}:{height}"
    if width == height:
        aspect_ratio = "1:1"
    elif width > height:
        aspect_ratio = "16:9"
    else:
        aspect_ratio = "9:16"
    
    draft_content = {
        "type": "draft",
        "id": str(uuid.uuid4()),
        "min_version": "3.2.5",
        "min_features": [],
        "is_from_tsn": True,
        "version": "3.3.8",
        "main_component_id": component_id,
        "component_list": [{
            "type": "video_base_component",
            "id": component_id,
            "min_version": "1.0.0",
            "aigc_mode": "workbench",
            "metadata": {
                "type": "",
                "id": str(uuid.uuid4()),
                "created_platform": 3,
                "created_time_in_ms": str(int(time.time() * 1000))
            },
            "generate_type": "gen_video",
            "abilities": {
                "type": "",
                "id": str(uuid.uuid4()),
                "gen_video": {
                    "type": "",
                    "id": str(uuid.uuid4()),
                    "text_to_video_params": {
                        "type": "",
                        "id": str(uuid.uuid4()),
                        "video_gen_inputs": [{
                            "type": "",
                            "id": str(uuid.uuid4()),
                            "min_version": "3.0.5",
                            "prompt": prompt,
                            "first_frame_image": {
                                "type": "image",
                                "id": str(uuid.uuid4()),
                                "source_from": "upload",
                                "platform_type": 1,
                                "image_uri": image_uri,
                                "width": width,
                                "height": height,
                                "uri": image_uri
                            },
                            "video_mode": 2,
                            "fps": 24,
                            "duration_ms": duration_ms,
                            "resolution": resolution,
                            "idip_meta_list": []
                        }],
                        "video_aspect_ratio": aspect_ratio,
                        "seed": seed,
                        "model_req_key": model,
                        "priority": 0
                    }
                }
            },
            "process_type": 1
        }]
    }
    
    headers = {
        "Content-Type": "application/​json",
        "Appid": "513695",
        "Appvr": "5.8.0",
        "Pf": "7",
        "Origin": "https://jimeng.jianying.com",
        "Referer": "https://jimeng.jianying.com",
        "Cookie": f"sessionid={sessionid}",
        "Device-Time": str(device_time),
        "Sign": sign,
        "Sign-Ver": "1"
    }
    
    data = {
        "extend": {
            "root_model": model,
            "m_video_commerce_info": {
                "benefit_type": "basic_video_operation_vgfm_v_three",
                "resource_id": "generate_video",
                "resource_id_type": "str",
                "resource_sub_type": "aigc"
            }
        },
        "submit_id": submit_id,
        "draft_content": json.dumps(draft_content),
        "http_common_info": {"aid": 513695}
    }
    
    resp = requests.post(
        f"https://jimeng.jianying.com{uri}",
        params={
            "aid": 513695, 
            "device_platform": "web", 
            "region": "cn",
            "da_version": "3.3.8",
            "web_version": "7.5.0"
        },
        headers=headers,
        json=data
    )
    return resp.json()

参数说明

字段类型必填说明
image_uristring是首帧图片 URI
promptstring是视频运动描述
duration_msint否时长毫秒 3000-10000,默认 5000
resolutionstring否分辨率 720p/​1080p,默认 720p
modelstring否模型名称,默认 vgfm_3.0_fast

模型选项

模型说明
dreamina_ic_generate_video_model_vgfm_3.0_fast视频 3.0 Fast (推荐)
dreamina_ic_generate_video_model_vgfm_3.0视频 3.0 标准版

关键参数

  • generate_type: gen_video
  • gen_type: 10
  • video_mode: 2 (首帧模式)
  • fps: 24

描述要点

  • 镜头运动:推拉、摇移、跟随、升降、变焦
  • 主体动作:自然连续,幅度适中
  • 背景动态:风吹、光影变化、人群流动
  • 镜头需遵循首帧角度

使用流程

  1. 上传首帧图片获取 image_uri
  2. 调用图生视频 API
  3. 轮询查询结果 (视频生成较慢,建议 10 秒间隔)
  4. 下载视频文件

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View