Tomoviee AI First-Last Frame to Video
Overview
Generate a 5-second video from two keyframe images:
- -
image: first frame - INLINECODE1 : last frame
API capability: INLINECODE2
Provider and Endpoint Provenance
Use this mapping to verify provenance before using production credentials:
- - Vendor portals:
https://www.tomoviee.ai and INLINECODE4 - Runtime API gateway host used by this skill: INLINECODE5
- Create endpoint: INLINECODE6
- Result endpoint: INLINECODE7
This skill sends runtime API requests only to openapi.wondershare.cc.
Credential Handling
- - Sensitive credentials required:
app_key and app_secret. - Credentials are only used to build
Authorization: Basic <base64(app_key:app_secret)>. - Credentials are kept in process memory only and are not written to disk by this skill.
- Do not hardcode credentials in source files or commit them to git.
Required Inputs
- - Credentials:
app_key, INLINECODE13 - Generation inputs:
prompt, image, INLINECODE16
Scope
- - This skill only covers
tm_tail2video_b (first-last frame to video). - Output duration is fixed to 5 seconds by API design.
- This skill does not implement text-to-video, image-to-video, or video continuation APIs.
Dependencies
- - Runtime dependency: INLINECODE18
- Install with: INLINECODE19
Quick Start
Install dependencies
CODEBLOCK0
Authentication helper
CODEBLOCK1
Python Client
CODEBLOCK2
API Usage
Basic Example
CODEBLOCK3
Parameters
- -
prompt (required): Motion guidance text. - INLINECODE21 (required): First frame image URL.
- INLINECODE22 (required): Last frame image URL.
- INLINECODE23 (optional):
720p or 1080p, default 720p. - INLINECODE27 (optional): only
5 is supported. - INLINECODE29 (optional):
16:9, 9:16, 4:3, 3:4, 1:1, original. - INLINECODE36 (optional): camera movement type
1-46. - INLINECODE38 (optional): callback URL.
- INLINECODE39 (optional): transparent callback parameter.
Image Constraints
- - File size: each image must be INLINECODE40
- Formats:
JPG, JPEG, PNG, INLINECODE44 - Recommended resolution: at least 720p source quality
Async Workflow
- 1. Create task and get INLINECODE45
- Poll with INLINECODE46
- Parse video URL from INLINECODE47
Status codes:
- -
1 queued - INLINECODE49 processing
- INLINECODE50 success
- INLINECODE51 failed
- INLINECODE52 cancelled
- INLINECODE53 timeout
Resources
- -
scripts/tomoviee_firstlast2video_client.py - main API client - INLINECODE55 - auth token helper
- INLINECODE56 - API reference and constraints
- INLINECODE57 - camera movement index reference
- INLINECODE58 - prompt writing guidance
External Resources
- - Developer portal (global): INLINECODE59
- API docs (global): INLINECODE60
- Developer portal (mainland): INLINECODE61
- API docs (mainland): INLINECODE62
Tomoviee AI 首尾帧生成视频
概述
从两个关键帧图像生成5秒视频:
API能力:tmtail2videob
提供商与端点来源
使用以下映射验证来源后再使用生产环境凭证:
- - 供应商门户:https://www.tomoviee.ai 和 https://www.tomoviee.cn
- 此技能使用的运行时API网关主机:https://openapi.wondershare.cc
- 创建端点:https://openapi.wondershare.cc/v1/open/capacity/application/tmtail2videob
- 结果端点:https://openapi.wondershare.cc/v1/open/pub/task
此技能仅向 openapi.wondershare.cc 发送运行时API请求。
凭证处理
- - 所需敏感凭证:appkey 和 appsecret。
- 凭证仅用于构建 Authorization: Basic key:appsecret)>。
- 凭证仅保留在进程内存中,此技能不会写入磁盘。
- 请勿在源文件中硬编码凭证或将其提交到git。
必需输入
- - 凭证:appkey、appsecret
- 生成输入:prompt、image、image_tail
范围
- - 此技能仅涵盖 tmtail2videob(首尾帧生成视频)。
- 根据API设计,输出时长固定为5秒。
- 此技能不实现文本转视频、图像转视频或视频续接API。
依赖项
- - 运行时依赖:requests>=2.31.0,<3.0.0
- 安装方式:pip install -r requirements.txt
快速开始
安装依赖
bash
pip install -r requirements.txt
认证辅助工具
bash
python scripts/generateauthtoken.py YOURAPPKEY YOURAPPSECRET
Python客户端
python
from scripts.tomovieefirstlast2videoclient import TomovieeFirstLast2VideoClient
client = TomovieeFirstLast2VideoClient(appkey, appsecret)
API使用
基本示例
python
taskid = client.firstlastto_video(
prompt=场景从首帧到尾帧自然过渡,动作流畅,
image=https://example.com/first-frame.jpg,
image_tail=https://example.com/last-frame.jpg,
resolution=720p,
duration=5,
aspect_ratio=original,
)
result = client.polluntilcomplete(task_id)
import json
videourl = json.loads(result[result])[videopath][0]
print(video_url)
参数
- - prompt(必需):运动引导文本。
- image(必需):首帧图像URL。
- imagetail(必需):尾帧图像URL。
- resolution(可选):720p 或 1080p,默认 720p。
- duration(可选):仅支持 5。
- aspectratio(可选):16:9、9:16、4:3、3:4、1:1、original。
- cameramoveindex(可选):摄像机运动类型 1-46。
- callback(可选):回调URL。
- params(可选):透明回调参数。
图像限制
- - 文件大小:每张图像必须小于 200M
- 格式:JPG、JPEG、PNG、WEBP
- 推荐分辨率:至少720p源质量
异步工作流
- 1. 创建任务并获取 taskid
- 使用 polluntilcomplete(taskid) 轮询
- 从 result 解析视频URL
状态码:
- - 1 排队中
- 2 处理中
- 3 成功
- 4 失败
- 5 已取消
- 6 超时
资源
- - scripts/tomovieefirstlast2videoclient.py - 主API客户端
- scripts/generateauthtoken.py - 认证令牌辅助工具
- references/videoapis.md - API参考和限制
- references/cameramovements.md - 摄像机运动索引参考
- references/prompt_guide.md - 提示词编写指南
外部资源
- - 开发者门户(全球):https://www.tomoviee.ai/developers.html
- API文档(全球):https://www.tomoviee.ai/doc/ai-video/first-and-last-frame-to-video.html
- 开发者门户(中国大陆):https://www.tomoviee.cn/developers.html
- API文档(中国大陆):https://www.tomoviee.cn/doc/ai-video/first-and-last-frame-to-video.html