jimeng-api-video-gen

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Jimeng 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

配置环境变量

~/.zshrc or ~/.zshenv

~/.zshrc or ~/.zshenv

export VOLC_ACCESSKEY="your_access_key_id" export VOLC_SECRETKEY="your_secret_access_key"
undefined
export VOLC_ACCESSKEY="your_access_key_id" export VOLC_SECRETKEY="your_secret_access_key"
undefined

Output 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
undefined
markdown
**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.mp4

API Configuration

API配置

ParameterValueDescription
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
https://visual.volcengineapi.com
API基础URL
Submit Action
CVSync2AsyncSubmitTask
提交异步生成任务
Query Action
CVSync2AsyncGetResult
查询任务结果
Version
2022-08-31
API版本
Service
cv
签名用服务名称
Region
cn-north-1
签名用区域

Generation Modes

生成模式

Pro Version (1080P HD)

Pro版本(1080P高清)

Modereq_keyDescription
ti2v_pro
jimeng_ti2v_v30_pro
Text-to-video + Image-to-video (first frame) Pro
模式req_key描述
ti2v_pro
jimeng_ti2v_v30_pro
文生视频 + 图生视频(首帧)Pro版

1080P Version

1080P版本

Modereq_keyDescription
t2v_1080p
jimeng_t2v_v30_1080p
Text-to-video 1080P
i2v_first_1080p
jimeng_i2v_first_v30_1080
Image-to-video (first frame) 1080P
i2v_first_tail_1080p
jimeng_i2v_first_tail_v30_1080
Image-to-video (first & last frame) 1080P
模式req_key描述
t2v_1080p
jimeng_t2v_v30_1080p
文生视频 1080P
i2v_first_1080p
jimeng_i2v_first_v30_1080
图生视频(首帧)1080P
i2v_first_tail_1080p
jimeng_i2v_first_tail_v30_1080
图生视频(首尾帧)1080P

720P Version

720P版本

Modereq_keyDescription
t2v_720p
jimeng_t2v_v30
Text-to-video 720P
i2v_first_720p
jimeng_i2v_first_v30
Image-to-video (first frame) 720P
i2v_first_tail_720p
jimeng_i2v_first_tail_v30
Image-to-video (first & last frame) 720P
i2v_recamera_720p
jimeng_i2v_recamera_v30
Image-to-video (camera movement) 720P
模式req_key描述
t2v_720p
jimeng_t2v_v30
文生视频 720P
i2v_first_720p
jimeng_i2v_first_v30
图生视频(首帧)720P
i2v_first_tail_720p
jimeng_i2v_first_tail_v30
图生视频(首尾帧)720P
i2v_recamera_720p
jimeng_i2v_recamera_v30
图生视频(运镜)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

时长选项

DurationUse Case
4sQuick clips, social media
5sDefault, general purpose
6sShort scenes
8sMedium-length content
10sLonger narratives
时长使用场景
4s短视频片段、社交媒体
5s默认值,通用场景
6s短场景
8s中等长度内容
10s较长叙事内容

FPS Options

FPS选项

FPSUse Case
24Cinematic look (default)
25PAL video standard
30Smooth motion, NTSC standard
FPS使用场景
24电影质感(默认)
25PAL视频标准
30流畅动效,NTSC标准

Authentication

身份验证

This skill uses Volcengine IAM v4 signature authentication (HMAC-SHA256). The signing process:
  1. Build canonical request with headers: `content-type;host;x-content-sha256;x-date`
  2. Calculate SHA256 hash of canonical request
  3. Derive signing key: secret_key → date → region → service → "request"
  4. Sign the string-to-sign with derived key
  5. Add `Authorization` header to request
Reference: HTTP请求示例
本Skill使用火山引擎IAM v4签名认证(HMAC-SHA256)。签名流程如下:
  1. 使用以下头构建规范请求:
    content-type;host;x-content-sha256;x-date
  2. 计算规范请求的SHA256哈希值
  3. 派生签名密钥:secret_key → 日期 → 区域 → 服务 → "request"
  4. 使用派生密钥对待签名字符串进行签名
  5. 在请求中添加
    Authorization

Error Codes

错误码

CodeMessageDescription
10000SuccessRequest successful
50411Pre Img Risk Not PassInput image failed content check
50511Post Video Risk Not PassOutput video failed content check
50412Text Risk Not PassInput text failed content check
50429Request Has Reached API LimitRate limit exceeded, retry later
50500Internal ErrorServer error
timeoutRequest timeoutIncrease JIMENG_VIDEO_API_TIMEOUT
代码信息描述
10000Success请求成功
50411Pre Img Risk Not Pass输入图片未通过内容审核
50511Post Video Risk Not Pass输出视频未通过内容审核
50412Text Risk Not Pass输入文本未通过内容审核
50429Request Has Reached API Limit超出速率限制,请稍后重试
50500Internal Error服务器错误
timeoutRequest 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分钟,取决于时长和生成模式

Reference Documentation

参考文档