jimeng-api-video-gen
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJimeng API Video Generation
Jimeng API视频生成
Generate high-quality AI videos using Volcengine's Jimeng Video 3.0 Pro API with text prompts or input images.
通过文本提示词或输入图片,使用火山引擎的Jimeng Video 3.0 Pro API生成高质量AI视频。
Configure Environment Variables
配置环境变量
bash
undefinedbash
undefined~/.zshrc or ~/.zshenv
~/.zshrc or ~/.zshenv
export VOLC_ACCESSKEY="your_access_key_id"
export VOLC_SECRETKEY="your_secret_access_key"
undefinedexport VOLC_ACCESSKEY="your_access_key_id"
export VOLC_SECRETKEY="your_secret_access_key"
undefinedOutput Behavior (Important)
输出行为(重要)
After video generation succeeds, you MUST display the video directly to the user!
When generation completes, output in the following format:
```markdown
Generated Video:
Download Video
Generation Info:
- Prompt: [User's original prompt]
- Duration: [Video length in seconds]
- Mode: [Generation mode used]
- FPS: [Frames per second]
- Save Path: [Local file path, if applicable] ```
视频生成成功后,你必须直接向用户展示视频!
生成完成后,请按照以下格式输出:
markdown
**Generated Video:**
[Download Video](VIDEO_URL)
**Generation Info:**
- Prompt: [User's original prompt]
- Duration: [Video length in seconds]
- Mode: [Generation mode used]
- FPS: [Frames per second]
- Save Path: [Local file path, if applicable]Example Output
示例输出
```markdown
Generated Video:
Generation Info:
- Prompt: A golden retriever running through a field of sunflowers, warm afternoon sunlight
- Duration: 5 seconds
- Mode: t2v_720p
- FPS: 24
- Save Path: /generated_videos/dog_sunflowers.mp4
undefinedmarkdown
**Generated Video:**
[Download Video](https://example.com/video.mp4)
**Generation Info:**
- Prompt: A golden retriever running through a field of sunflowers, warm afternoon sunlight
- Duration: 5 seconds
- Mode: t2v_720p
- FPS: 24
- Save Path: /generated_videos/dog_sunflowers.mp4API Configuration
API配置
| Parameter | Value | Description |
|---|---|---|
| Endpoint | `https://visual.volcengineapi.com\` | API base URL |
| Submit Action | `CVSync2AsyncSubmitTask` | Submit async generation task |
| Query Action | `CVSync2AsyncGetResult` | Query task result |
| Version | `2022-08-31` | API version |
| Service | `cv` | Service name for signing |
| Region | `cn-north-1` | Region for signing |
| 参数 | 值 | 描述 |
|---|---|---|
| Endpoint | | API基础URL |
| Submit Action | | 提交异步生成任务 |
| Query Action | | 查询任务结果 |
| Version | | API版本 |
| Service | | 签名用服务名称 |
| Region | | 签名用区域 |
Generation Modes
生成模式
Pro Version (1080P HD)
Pro版本(1080P高清)
| Mode | req_key | Description |
|---|---|---|
| | Text-to-video + Image-to-video (first frame) Pro |
| 模式 | req_key | 描述 |
|---|---|---|
| | 文生视频 + 图生视频(首帧)Pro版 |
1080P Version
1080P版本
| Mode | req_key | Description |
|---|---|---|
| | Text-to-video 1080P |
| | Image-to-video (first frame) 1080P |
| | Image-to-video (first & last frame) 1080P |
| 模式 | req_key | 描述 |
|---|---|---|
| | 文生视频 1080P |
| | 图生视频(首帧)1080P |
| | 图生视频(首尾帧)1080P |
720P Version
720P版本
| Mode | req_key | Description |
|---|---|---|
| | Text-to-video 720P |
| | Image-to-video (first frame) 720P |
| | Image-to-video (first & last frame) 720P |
| | Image-to-video (camera movement) 720P |
| 模式 | req_key | 描述 |
|---|---|---|
| | 文生视频 720P |
| | 图生视频(首帧)720P |
| | 图生视频(首尾帧)720P |
| | 图生视频(运镜)720P |
Command-Line Options
命令行选项
```
scripts/generate_video.py PROMPT [OPTIONS]
Arguments:
PROMPT Text prompt for video generation (required)
Options:
--mode MODE Generation mode (default: t2v_720p)
Pro: ti2v_pro
1080P: t2v_1080p, i2v_first_1080p, i2v_first_tail_1080p
720P: t2v_720p, i2v_first_720p, i2v_first_tail_720p, i2v_recamera_720p
--duration SECS Video duration: 4, 5, 6, 8, 10 (default: 5)
--fps FPS Frames per second: 24, 25, 30 (default: 24)
--image URL Input image URL for image-to-video (first frame)
--tail-image URL Tail image URL for first & last frame mode
--seed INT Random seed for reproducibility
--output PATH Download video to file
--json Output raw JSON response
Environment Variables:
VOLC_ACCESSKEY Access Key ID (required)
VOLC_SECRETKEY Secret Access Key (required)
JIMENG_VIDEO_API_URL API endpoint (default: https://visual.volcengineapi.com)
JIMENG_VIDEO_API_TIMEOUT Request timeout seconds (default: 300)
JIMENG_VIDEO_POLL_INTERVAL Polling interval seconds (default: 5)
JIMENG_VIDEO_MAX_POLL_ATTEMPTS Max polling attempts (default: 120)
```
scripts/generate_video.py PROMPT [OPTIONS]
Arguments:
PROMPT Text prompt for video generation (required)
Options:
--mode MODE Generation mode (default: t2v_720p)
Pro: ti2v_pro
1080P: t2v_1080p, i2v_first_1080p, i2v_first_tail_1080p
720P: t2v_720p, i2v_first_720p, i2v_first_tail_720p, i2v_recamera_720p
--duration SECS Video duration: 4, 5, 6, 8, 10 (default: 5)
--fps FPS Frames per second: 24, 25, 30 (default: 24)
--image URL Input image URL for image-to-video (first frame)
--tail-image URL Tail image URL for first & last frame mode
--seed INT Random seed for reproducibility
--output PATH Download video to file
--json Output raw JSON response
Environment Variables:
VOLC_ACCESSKEY Access Key ID (required)
VOLC_SECRETKEY Secret Access Key (required)
JIMENG_VIDEO_API_URL API endpoint (default: https://visual.volcengineapi.com)
JIMENG_VIDEO_API_TIMEOUT Request timeout seconds (default: 300)
JIMENG_VIDEO_POLL_INTERVAL Polling interval seconds (default: 5)
JIMENG_VIDEO_MAX_POLL_ATTEMPTS Max polling attempts (default: 120)Video Specifications
视频规格
Duration Options
时长选项
| Duration | Use Case |
|---|---|
| 4s | Quick clips, social media |
| 5s | Default, general purpose |
| 6s | Short scenes |
| 8s | Medium-length content |
| 10s | Longer narratives |
| 时长 | 使用场景 |
|---|---|
| 4s | 短视频片段、社交媒体 |
| 5s | 默认值,通用场景 |
| 6s | 短场景 |
| 8s | 中等长度内容 |
| 10s | 较长叙事内容 |
FPS Options
FPS选项
| FPS | Use Case |
|---|---|
| 24 | Cinematic look (default) |
| 25 | PAL video standard |
| 30 | Smooth motion, NTSC standard |
| FPS | 使用场景 |
|---|---|
| 24 | 电影质感(默认) |
| 25 | PAL视频标准 |
| 30 | 流畅动效,NTSC标准 |
Authentication
身份验证
This skill uses Volcengine IAM v4 signature authentication (HMAC-SHA256). The signing process:
- Build canonical request with headers: `content-type;host;x-content-sha256;x-date`
- Calculate SHA256 hash of canonical request
- Derive signing key: secret_key → date → region → service → "request"
- Sign the string-to-sign with derived key
- Add `Authorization` header to request
Reference: HTTP请求示例
本Skill使用火山引擎IAM v4签名认证(HMAC-SHA256)。签名流程如下:
- 使用以下头构建规范请求:
content-type;host;x-content-sha256;x-date - 计算规范请求的SHA256哈希值
- 派生签名密钥:secret_key → 日期 → 区域 → 服务 → "request"
- 使用派生密钥对待签名字符串进行签名
- 在请求中添加头
Authorization
参考:HTTP请求示例
Error Codes
错误码
| Code | Message | Description |
|---|---|---|
| 10000 | Success | Request successful |
| 50411 | Pre Img Risk Not Pass | Input image failed content check |
| 50511 | Post Video Risk Not Pass | Output video failed content check |
| 50412 | Text Risk Not Pass | Input text failed content check |
| 50429 | Request Has Reached API Limit | Rate limit exceeded, retry later |
| 50500 | Internal Error | Server error |
| timeout | Request timeout | Increase JIMENG_VIDEO_API_TIMEOUT |
| 代码 | 信息 | 描述 |
|---|---|---|
| 10000 | Success | 请求成功 |
| 50411 | Pre Img Risk Not Pass | 输入图片未通过内容审核 |
| 50511 | Post Video Risk Not Pass | 输出视频未通过内容审核 |
| 50412 | Text Risk Not Pass | 输入文本未通过内容审核 |
| 50429 | Request Has Reached API Limit | 超出速率限制,请稍后重试 |
| 50500 | Internal Error | 服务器错误 |
| timeout | Request timeout | 请求超时,请增大JIMENG_VIDEO_API_TIMEOUT的值 |
Input/Output Limits
输入/输出限制
Input Images (for image-to-video):
- Format: JPEG, PNG only
- Max size: 15MB per image
- Max resolution: 4096×4096
Output:
- Format: MP4
- URL validity: 24 hours
- Generation time: 2-10 minutes depending on duration and mode
输入图片(用于图生视频):
- 格式:仅支持JPEG、PNG
- 单张最大大小:15MB
- 最大分辨率:4096×4096
输出:
- 格式:MP4
- URL有效期:24小时
- 生成时间:2-10分钟,取决于时长和生成模式