图生视频
更新时间:2025-01-14
本接口用于创建图生视频任务,包括:
- 单图生视频
- 首尾帧视频
- 参考生视频
注意事项:
-
图片尺寸大小格式有限制
- 图片大小小于50M,格式只支持 JPG/JPEG/PNG, 图片长宽比需要小于1:4或者4:1
- 参考生任务时,图片尺寸不能小于 128*128,比例需要小于 1:16 或者 16:1
- 提示文本长度限制为 1024 个字符
- 图像 URL 需要确保公网可访问
- 分辨率 512 对应清晰度为 360p,720p 对应清晰度为 720p,1080p 对应清晰度为 1080p
图片上传流程:
请求结构
POST /v2/aigc/image_to_video HTTP/1.1
connection: keep-alive
host: vod.bj.baidubce.com
content-type: application/json
x-bce-request-id: <bce-request-id>
x-bce-date: <utc-date-string>
authorization: <bce-authorization-string>
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数 | 类型 | 是否必需 | 描述 |
---|---|---|---|
model | string | 是 | 模型名称, 支持:
|
modelV10TaskInput | ImageToVideoV10TaskInput | 否 | V10 模型的特定输入参数 |
modelV15TaskInput | ImageToVideoV15TaskInput | 否 | V15 模型的特定输入参数 |
返回头域
除公共头域,无其它特殊头域。
返回参数
参数 | 类型 | 描述 |
---|---|---|
taskId | string | 任务id |
请求示例
图生视频请求示例
请求内容
POST /v2/aigc/image_to_video HTTP/1.1
host: vod.bj.baidubce.com
accept: */*
connection: keep-alive
content-type: application/json
x-bce-request-id: 6bae5cb3-97d1-4b1a-b8b6-0ad577c1d481
x-bce-date: 2024-03-24T13:08:44Z
authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2024-03-24T13:08:44Z/1800/host;x-bce-date/7e21c9cf1e4e2cc6921a407a388fe98df122c53b9f509043d841be76eb09a1f9
{
"model": "V15",
"modelV15TaskInput": {
"duration": 4,
"image": {
"imageUrl": "https://vod-resource.cdn.bcebos.com/videos/head.jpeg"
},
"prompt": "两个人拥抱",
"resolution": "512"
}
}
头尾帧生成视频示例
请求内容
POST /v2/aigc/image_to_video HTTP/1.1
host: vod.bj.baidubce.com
accept: */*
connection: keep-alive
content-type: application/json
x-bce-request-id: 6bae5cb3-97d1-4b1a-b8b6-0ad577c1d481
x-bce-date: 2024-03-24T13:08:44Z
authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2024-03-24T13:08:44Z/1800/host;x-bce-date/7e21c9cf1e4e2cc6921a407a388fe98df122c53b9f509043d841be76eb09a1f9
{
"model": "V15",
"modelV15TaskInput": {
"duration": 4,
"headtailImages": {
"tailImage": {
"imageUrl": "https://vod-resource.cdn.bcebos.com/videos/head.jpeg"
},
"headImage": {
"imageUrl": "https://vod-resource.cdn.bcebos.com/videos/tail.jpeg"
}
},
"prompt": "两个人拥抱",
"resolution": "720p",
"movementAmplitude": "auto"
}
}
参考生成视频示例
请求内容
POST /v2/aigc/image_to_video HTTP/1.1
host: vod.bj.baidubce.com
accept: */*
connection: keep-alive
content-type: application/json
x-bce-request-id: 6bae5cb3-97d1-4b1a-b8b6-0ad577c1d481
x-bce-date: 2024-03-24T13:08:44Z
authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2024-03-24T13:08:44Z/1800/host;x-bce-date/7e21c9cf1e4e2cc6921a407a388fe98df122c53b9f509043d841be76eb09a1f9
{
"model": "V15",
"modelV15TaskInput": {
"duration": 4,
"characterImages": [
{
"imageUrl": "https://vod-resource.cdn.bcebos.com/videos/character1.5_1.png"
},
{
"imageUrl": "https://vod-resource.cdn.bcebos.com/videos/character1.5_2.png"
},
{
"imageUrl": "https://vod-resource.cdn.bcebos.com/videos/character1.5_3.png"
}
],
"prompt": "女孩的手心漂浮着一只半透明金鱼,镜头逐渐拉近,镜头顺时针旋转",
"resolution": "512",
"movementAmplitude": "auto"
}
}