Wan 画像動画生成モデルは、マルチモーダル入力 (テキスト、画像、音声) を受け付けます。最大 15 秒、解像度 1080P までの動画を生成できます。
基本設定:2~15 秒の長さ (整数値のみ) を選択します。解像度は 480P、720P、1080P の 3 つのオプションから選択します。このモデルは、プロンプトの書き換えとウォーターマークの追加もサポートしています。
音声機能:自動吹き替えまたは音声のアップロードをサポートし、音声と動画の同期を実現します。(wan2.5 および wan2.6 でサポート)
マルチショットナラティブ:複数のショットで動画を生成し、ショット間で主な被写体の一貫性を保ちます。(wan2.6 のみでサポート)
クイックリンク:オンラインで試す (シンガポール | バージニア | 北京) | API リファレンス
はじめに
入力プロンプト | 入力開始フレーム | 出力動画 (音声付きマルチショット動画) |
カメラがウミガメの下からゆっくりと上に移動します。カメはのんびりと泳ぎ、腹部の詳細がはっきりと見えます。 |
|
API を呼び出す前に、API キーを取得し、API キーを環境変数として設定してください。SDK を使用するには、DashScope SDK をインストールしてください。
Python SDK
DashScope Python SDK のバージョンが 1.25.8 以降であることを確認してください。
SDK のバージョンが古すぎると、「url error, please check url!」などのエラーが発生する可能性があります。SDK のインストールをご参照ください。
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
# 以下はシンガポールリージョンの URL です。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/model-studio/image-to-video-api-reference をご参照ください
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'
# API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください
api_key = os.getenv("DASHSCOPE_API_KEY", "YOUR_API_KEY")
print('please wait...')
rsp = VideoSynthesis.call(api_key=api_key,
model='wan2.6-i2v-flash',
prompt='The camera slowly moves up from below the sea turtle. The turtle swims leisurely, and the details of its belly are clearly visible.',
img_url="https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260121/zlpocv/wan-i2v-haigui.webp",
resolution="720P",
duration=10,
shot_type="multi",
prompt_extend=True,
watermark=True)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print("video_url:", rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' % (rsp.status_code, rsp.code, rsp.message))Java SDK
DashScope Java SDK のバージョンが 2.22.6 以降であることを確認してください。
SDK のバージョンが古すぎると、「url error, please check url!」などのエラーが発生する可能性があります。SDK のインストールをご参照ください。
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;
public class Image2Video {
static {
// 以下はシンガポールリージョンの URL です。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/model-studio/image-to-video-api-reference をご参照ください
Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
}
// 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください:apiKey="sk-xxx"
// API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static void image2video() throws ApiException, NoApiKeyException, InputRequiredException {
VideoSynthesis vs = new VideoSynthesis();
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.6-i2v-flash")
.prompt("The camera slowly moves up from below the sea turtle. The turtle swims leisurely, and the details of its belly are clearly visible.")
.imgUrl("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260121/zlpocv/wan-i2v-haigui.webp")
.duration(10)
.resolution("720P")
.shotType("multi")
.promptExtend(true)
.watermark(true)
.build();
System.out.println("please wait...");
VideoSynthesisResult result = vs.call(param);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
image2video();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}curl
ステップ 1:タスクを作成してタスク ID を取得
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.6-i2v-flash",
"input": {
"prompt": "The camera slowly moves up from below the sea turtle. The turtle swims leisurely, and the details of its belly are clearly visible.",
"img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260121/zlpocv/wan-i2v-haigui.webp"
},
"parameters": {
"resolution": "720P",
"prompt_extend": true,
"watermark": true,
"duration": 10,
"shot_type":"multi"
}
}'ステップ 2:タスク ID を使用して結果を取得
前の API 呼び出しで返された task_id の値で {task_id} を置き換えます。
curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"提供状況
サポートされるモデルはリージョンによって異なり、各リージョンには独立したリソースがあります。呼び出しを行う際は、モデル、エンドポイント、API キーがすべて同じリージョンに属していることを確認してください。そうでない場合、呼び出しは失敗します。
サポートされるモデル:
グローバル
グローバルデプロイモードでは、アクセスポイントとデータストレージは米国 (バージニア) リージョンにあり、モデル推論の計算リソースは世界中で動的にスケジュールされます。
モデル | 特徴 | 入力モダリティ | 出力動画の仕様 |
wan2.6-i2v | 音声付き動画 マルチショットナラティブ、音声と動画の同期 | テキスト、画像、音声 | 解像度オプション:720P、1080P 動画の長さ:5s、10s、15s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
国際
国際デプロイモードでは、アクセスポイントとデータストレージはシンガポールリージョンにあり、モデル推論の計算リソースは中国本土を除く世界中で動的にスケジュールされます。
モデル | 特徴 | 入力モダリティ | 出力動画の仕様 |
wan2.6-i2v-flash | 音声付き動画、音声なし動画 マルチショットナラティブ、音声と動画の同期 | テキスト、画像、音声 | 解像度オプション:720P、1080P 動画の長さ:[2s, 15s] 定義済み仕様:30fps、MP4 (H.264 エンコーディング) |
wan2.6-i2v | 音声付き動画 マルチショットナラティブ、音声と動画の同期 | テキスト、画像、音声 | 解像度オプション:720P、1080P 動画の長さ:5s、10s、15s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
wan2.5-i2v-preview | 音声付き動画 音声と動画の同期 | テキスト、画像、音声 | 解像度オプション:480P、720P、1080P 動画の長さ:5s、10s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
wan2.2-i2v-flash | 音声なし動画 2.1 モデルより 50% 高速。 | テキスト、画像 | 解像度オプション:480P、720P、1080P 動画の長さ:5s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
wan2.2-i2v-plus | 音声なし動画 2.1 モデルと比較して安定性と成功率が向上。 | テキスト、画像 | 解像度オプション:480P、1080P 動画の長さ:5s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
wan2.1-i2v-plus | 音声なし動画 | テキスト、画像 | 解像度オプション:720P 動画の長さ:5s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
wan2.1-i2v-turbo | 音声なし動画 | テキスト、画像 | 解像度オプション:480P、720P 動画の長さ:3s、4s、5s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
米国
米国デプロイモードでは、アクセスポイントとデータストレージは米国 (バージニア) リージョンにあり、モデル推論の計算リソースは米国内に制限されます。
モデル | 特徴 | 入力モダリティ | 出力動画の仕様 |
wan2.6-i2v-us | 音声付き動画 マルチショットナラティブ、音声と動画の同期 | テキスト、画像、音声 | 解像度オプション:720P、1080P 動画の長さ:5s、10s、15s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
中国本土
中国本土のデプロイモードでは、アクセスポイントとデータストレージは北京リージョンにあり、モデル推論の計算リソースは中国本土に制限されます。
モデル | 特徴 | 入力モダリティ | 出力動画の仕様 |
wan2.6-i2v-flash | 音声付き動画、音声なし動画 マルチショットナラティブ、音声と動画の同期 | テキスト、画像、音声 | 解像度オプション:720P、1080P 動画の長さ:[2s, 15s] 定義済み仕様:30fps、MP4 (H.264 エンコーディング) |
wan2.6-i2v | 音声付き動画 マルチショットナラティブ、音声と動画の同期 | テキスト、画像、音声 | 解像度オプション:720P、1080P 動画の長さ:5s、10s、15s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
wan2.5-i2v-preview | 音声付き動画 音声と動画の同期 | テキスト、画像、音声 | 解像度オプション:480P、720P、1080P 動画の長さ:5s、10s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
wan2.2-i2v-flash | 音声なし動画 2.1 モデルより 50% 高速。 | テキスト、画像 | 解像度オプション:480P、720P、1080P 動画の長さ:5s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
wan2.2-i2v-plus | 音声なし動画 2.1 モデルと比較して安定性と成功率が向上。 | テキスト、画像 | 解像度オプション:480P、1080P 動画の長さ:5s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
wanx2.1-i2v-plus | 音声なし動画 | テキスト、画像 | 解像度オプション:720P 動画の長さ:5s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
wanx2.1-i2v-turbo | 音声なし動画 | テキスト、画像 | 解像度オプション:480P、720P 動画の長さ:3s、4s、5s 定義済み仕様:30 fps、MP4 (H.264 エンコーディング) |
主な機能
マルチショット動画の作成
モデル:wan2.6-i2v-flash、wan2.6-i2v。
概要:ワイドショットからクローズアップへの切り替えなどを自動的に行います。この機能は、MV などのシナリオの作成に適しています。
パラメーター設定:
shot_type:"multi"である必要があります。prompt_extend:trueに設定して、最適化されたショット記述のためのインテリジェントな書き換えを有効にする必要があります。
入力プロンプト | 入力開始フレーム | 出力動画 (wan2.6、マルチショット動画) |
都市のファンタジーアートのシーン。ダイナミックなグラフィティアートのキャラクター。スプレーペイントでできた少年がコンクリートの壁で生き生きと動き出す。彼はクラシックでエネルギッシュなラッパーのポーズをとりながら、高速で英語のラップを披露する。シーンは夜の都市の鉄道橋の下。照明は一本の街灯から来ており、高エネルギーと驚くべきディテールに満ちた映画のような雰囲気を醸し出している。動画の音声はラップのみで、他の対話やノイズはない。 |
入力音声: |
Python SDK
DashScope Python SDK のバージョンが 1.25.8 以降であることを確認してください。SDK のインストールをご参照ください。import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
# 以下はシンガポールリージョンの URL です。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/model-studio/image-to-video-api-reference をご参照ください
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'
# 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください:api_key="sk-xxx"
# API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_async_call_i2v():
# 非同期呼び出し、task_id を返す
rsp = VideoSynthesis.async_call(api_key=api_key,
model='wan2.6-i2v-flash',
prompt='A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life on a concrete wall. He performs an English rap at high speed while striking a classic, energetic rapper pose. The scene is set at night under an urban railway bridge. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of the rap, with no other dialogue or noise.',
img_url="https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png",
audio_url="https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3",
resolution="720P",
duration=10,
shot_type="multi", # マルチショット
prompt_extend=True,
watermark=True,
negative_prompt="",
seed=12345)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print("task_id: %s" % rsp.output.task_id)
else:
print('Failed, status_code: %s, code: %s, message: %s' % (rsp.status_code, rsp.code, rsp.message))
# 非同期タスクの完了を待つ
rsp = VideoSynthesis.wait(task=rsp, api_key=api_key)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print(rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' % (rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
sample_async_call_i2v()Java SDK
DashScope Java SDK のバージョンが 2.22.6 以降であることを確認してください。SDK のインストールをご参照ください。import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;
public class Image2Video {
static {
// 以下はシンガポールリージョンの URL です。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/model-studio/image-to-video-api-reference をご参照ください
Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
}
// 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください:apiKey="sk-xxx"
// API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
//入力画像の URL を設定
static String imgUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png";
// 音声の URL を設定
static String audioUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3";
public static void image2video() throws ApiException, NoApiKeyException, InputRequiredException {
VideoSynthesis vs = new VideoSynthesis();
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.6-i2v-flash")
.prompt("A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life on a concrete wall. He performs an English rap at high speed while striking a classic, energetic rapper pose. The scene is set at night under an urban railway bridge. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of the rap, with no other dialogue or noise.")
.imgUrl(imgUrl)
.audioUrl(audioUrl)
.shotType("multi")
.duration(10)
.resolution("720P")
.negativePrompt("")
.promptExtend(true)
.watermark(true)
.seed(12345)
.build();
// 非同期呼び出し
VideoSynthesisResult task = vs.asyncCall(param);
System.out.println(JsonUtils.toJson(task));
System.out.println("please wait...");
//結果を取得
VideoSynthesisResult result = vs.wait(task, apiKey);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
image2video();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}curl
ステップ 1:タスクを作成してタスク ID を取得
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.6-i2v-flash",
"input": {
"prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.",
"img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png",
"audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
},
"parameters": {
"resolution": "720P",
"prompt_extend": true,
"duration": 10,
"shot_type":"multi"
}
}'ステップ 2:タスク ID を使用して結果を取得
前の API 呼び出しで返された task_id の値で {task_id} を置き換えます。
curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"音声と動画の同期
モデル:wan2.6-i2v-flash、wan2.6-i2v、wan2.5-i2v-preview。
概要:写真のキャラクターをアニメーション化して話したり歌ったりさせ、口の動きを音声に合わせます。その他の例については、「音声生成」をご参照ください。
パラメーター設定:
音声ファイルの提供:
audio_urlを渡します。モデルは音声ファイルに基づいて口の動きを合わせます。自動吹き替え:
audio_urlを渡さないでください。モデルはデフォルトで音声付きの動画を出力します。映像に基づいて背景の効果音、音楽、またはボーカルを自動的に生成します。
入力プロンプト | 入力開始フレーム | 出力動画 (音声付き) |
都市のファンタジーアートのシーン。ダイナミックなグラフィティアートのキャラクター。スプレーペイントでできた少年がコンクリートの壁で生き生きと動き出す。彼はクラシックでエネルギッシュなラッパーのポーズをとりながら、高速で英語のラップを披露する。シーンは夜の都市の鉄道橋の下。照明は一本の街灯から来ており、高エネルギーと驚くべきディテールに満ちた映画のような雰囲気を醸し出している。動画の音声はラップのみで、他の対話やノイズはない。 |
入力音声: |
Python SDK
DashScope Python SDK のバージョンが 1.25.8 以降であることを確認してください。SDK のインストールをご参照ください。import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
# 以下はシンガポールリージョンの URL です。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/model-studio/image-to-video-api-reference をご参照ください
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'
# 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください:api_key="sk-xxx"
# API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_async_call_i2v():
# 非同期呼び出し、task_id を返す
rsp = VideoSynthesis.async_call(api_key=api_key,
model='wan2.6-i2v-flash',
prompt='A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life on a concrete wall. He performs an English rap at high speed while striking a classic, energetic rapper pose. The scene is set at night under an urban railway bridge. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of the rap, with no other dialogue or noise.',
img_url="https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png",
audio_url="https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3",
resolution="720P",
duration=10,
prompt_extend=True,
watermark=True,
negative_prompt="",
seed=12345)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print("task_id: %s" % rsp.output.task_id)
else:
print('Failed, status_code: %s, code: %s, message: %s' % (rsp.status_code, rsp.code, rsp.message))
# 非同期タスクの完了を待つ
rsp = VideoSynthesis.wait(task=rsp, api_key=api_key)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print(rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' % (rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
sample_async_call_i2v()Java SDK
DashScope Java SDK のバージョンが 2.22.6 以降であることを確認してください。SDK のインストールをご参照ください。import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;
public class Image2Video {
static {
// 以下はシンガポールリージョンの URL です。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/model-studio/image-to-video-api-reference をご参照ください
Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
}
// 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください:apiKey="sk-xxx"
// API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
//入力画像の URL を設定
static String imgUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png";
// 音声の URL を設定
static String audioUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3";
public static void image2video() throws ApiException, NoApiKeyException, InputRequiredException {
VideoSynthesis vs = new VideoSynthesis();
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.6-i2v-flash")
.prompt("A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life on a concrete wall. He performs an English rap at high speed while striking a classic, energetic rapper pose. The scene is set at night under an urban railway bridge. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of the rap, with no other dialogue or noise.")
.imgUrl(imgUrl)
.audioUrl(audioUrl)
.duration(10)
.resolution("720P")
.negativePrompt("")
.promptExtend(true)
.watermark(true)
.seed(12345)
.build();
// 非同期呼び出し
VideoSynthesisResult task = vs.asyncCall(param);
System.out.println(JsonUtils.toJson(task));
System.out.println("please wait...");
//結果を取得
VideoSynthesisResult result = vs.wait(task, apiKey);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
image2video();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}curl
ステップ 1:タスクを作成してタスク ID を取得
音声ファイルの提供
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.5-i2v-preview",
"input": {
"prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.",
"img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png",
"audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
},
"parameters": {
"resolution": "480P",
"prompt_extend": true,
"duration": 10
}
}'自動吹き替え
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.5-i2v-preview",
"input": {
"prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.",
"img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"
},
"parameters": {
"resolution": "480P",
"prompt_extend": true,
"duration": 10
}
}'ステップ 2:タスク ID を使用して結果を取得
前の API 呼び出しで返された task_id の値で {task_id} を置き換えます。
curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"音声なし動画の生成
モデル:wan2.6-i2v-flash、wan2.2 およびそれ以前のモデル。
概要:動的ポスターやサイレントショートビデオなど、音声を必要としない視覚のみのシナリオに適しています。
パラメーター設定:
wan2.6-i2v-flash:デフォルトでは、このモデルは音声付きの動画を生成します。音声なしの動画を生成するには、明示的にaudio=falseを設定する必要があります。audio_urlを渡しても、audio=falseであれば出力はサイレントビデオとなり、音声なし動画として課金されます。wan2.2 およびそれ以前のモデル:これらのモデルはデフォルトでサイレントビデオを生成し、追加の構成は不要です。
プロンプト | 入力開始フレーム | 出力動画 (音声なし) |
草の上を走る猫 |
|
Python SDK
DashScope Python SDK のバージョンが 1.25.8 以降であることを確認してください。SDK のインストールをご参照ください。import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
# 以下はシンガポールリージョンの URL です。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/model-studio/image-to-video-api-reference をご参照ください
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'
# 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください:api_key="sk-xxx"
# API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください
api_key = os.getenv("DASHSCOPE_API_KEY")
def sample_async_call_i2v():
# 非同期呼び出し、task_id を返す
rsp = VideoSynthesis.async_call(api_key=api_key,
model='wan2.6-i2v-flash',
prompt='A cat running on the grass',
img_url="https://cdn.translate.alibaba.com/r/wanx-demo-1.png",
audio=False, # 音声なしの動画を出力するには、明示的に False に設定する必要があります
resolution="720P",
duration=5,
prompt_extend=True,
watermark=True,
negative_prompt="",
seed=12345)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print("task_id: %s" % rsp.output.task_id)
else:
print('Failed, status_code: %s, code: %s, message: %s' % (rsp.status_code, rsp.code, rsp.message))
# 非同期タスクの完了を待つ
rsp = VideoSynthesis.wait(task=rsp, api_key=api_key)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print(rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' % (rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
sample_async_call_i2v()Java SDK
DashScope Java SDK のバージョンが 2.22.6 以降であることを確認してください。SDK のインストールをご参照ください。import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;
public class Image2Video {
static {
// 以下はシンガポールリージョンの URL です。URL はリージョンによって異なります。詳細については、https://www.alibabacloud.com/help/model-studio/image-to-video-api-reference をご参照ください
Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
}
// 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください:apiKey="sk-xxx"
// API キーはリージョンによって異なります。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static void image2video() throws ApiException, NoApiKeyException, InputRequiredException {
VideoSynthesis vs = new VideoSynthesis();
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.6-i2v-flash")
.prompt("A cat running on the grass")
.imgUrl("https://cdn.translate.alibaba.com/r/wanx-demo-1.png")
.audio(false) /*音声なしの動画を出力するには、明示的に false に設定する必要があります*/
.duration(10)
.resolution("720P")
.negativePrompt("")
.promptExtend(true)
.watermark(true)
.seed(12345)
.build();
// 非同期呼び出し
VideoSynthesisResult task = vs.asyncCall(param);
System.out.println(JsonUtils.toJson(task));
System.out.println("please wait...");
//結果を取得
VideoSynthesisResult result = vs.wait(task, apiKey);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
image2video();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}curl
ステップ 1:タスクを作成してタスク ID を取得
wan2.6-i2v-flash
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.6-i2v-flash",
"input": {
"prompt": "A cat running on the grass",
"img_url": "https://cdn.translate.alibaba.com/r/wanx-demo-1.png"
},
"parameters": {
"audio": false,
"resolution": "720P",
"prompt_extend": true,
"watermark": true,
"duration": 5
}
}'wan2.2 およびそれ以前のモデル
curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
-H 'X-DashScope-Async: enable' \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "wan2.2-i2v-plus",
"input": {
"prompt": "A cat running on the grass",
"img_url": "https://cdn.translate.alibaba.com/r/wanx-demo-1.png"
},
"parameters": {
"resolution": "480P",
"prompt_extend": true
}
}'ステップ 2:タスク ID を使用して結果を取得
前の API 呼び出しで返された task_id の値で {task_id} を置き換えます。
curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"画像と音声の提供方法
入力画像
数:1。
入力メソッド:パブリックイメージ URL、ローカルファイルパス、または Base64 エンコード文字列。
コード例:3つの入力メソッド
Python SDK
import base64
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import mimetypes
import dashscope
# ベース URL を取得するには:https://www.alibabacloud.com/help/ja/model-studio/image-to-video-api-reference
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'
# 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください:api_key="sk-xxx"
# API キーを取得するには:https://www.alibabacloud.com/help/ja/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")
# --- ヘルパー関数:Base64 エンコーディング用 ---
# フォーマット:data:{MIME_type};base64,{base64_data}
def encode_file(file_path):
mime_type, _ = mimetypes.guess_type(file_path)
if not mime_type or not mime_type.startswith("image/"):
raise ValueError("Unsupported or unrecognized image format")
with open(file_path, "rb") as image_file:
encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
return f"data:{mime_type};base64,{encoded_string}"
"""
画像入力メソッド:
以下は 3 つの画像入力メソッドです。
1. パブリック URL を使用 - 公開されている画像に適しています。
2. ローカルファイルを使用 - ローカルでの開発やテストに適しています。
3. Base64 エンコーディングを使用 - 非公開の画像や暗号化された伝送が必要なシナリオに適しています。
"""
# [メソッド 1] 公開されている画像 URL を使用
# 例:公開画像 URL を使用
img_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"
# [メソッド 2] ローカルファイルを使用 (絶対パスと相対パスをサポート)
# フォーマット要件:file:// + ファイルパス
# 例 (絶対パス):
# img_url = "file://" + "/path/to/your/img.png" # Linux/macOS
# img_url = "file://" + "/C:/path/to/your/img.png" # Windows
# 例 (相対パス):
# img_url = "file://" + "./img.png" # 現在の実行可能ファイルのパスからの相対パス
# [メソッド 3] Base64 エンコードされた画像を使用
# img_url = encode_file("./img.png")
# 音声 URL を設定
audio_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
def sample_call_i2v():
# 同期呼び出し、結果を直接返す
print('Please wait...')
rsp = VideoSynthesis.call(api_key=api_key,
model='wan2.6-i2v-flash',
prompt='A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.',
img_url=img_url,
audio_url=audio_url,
resolution="480P",
duration=10,
prompt_extend=True,
watermark=False,
negative_prompt="",
seed=12345)
print(rsp)
if rsp.status_code == HTTPStatus.OK:
print("video_url:", rsp.output.video_url)
else:
print('Failed, status_code: %s, code: %s, message: %s' %
(rsp.status_code, rsp.code, rsp.message))
if __name__ == '__main__':
sample_call_i2v()Java SDK
// Copyright (c) Alibaba, Inc. and its affiliates.
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
public class Image2Video {
static {
// ベース URL を取得するには:https://www.alibabacloud.com/help/ja/model-studio/image-to-video-api-reference
Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
}
// 環境変数を設定していない場合は、次の行を Model Studio API キーに置き換えてください:apiKey="sk-xxx"
// API キーを取得するには:https://www.alibabacloud.com/help/ja/model-studio/get-api-key
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
/**
* 画像入力メソッド:3つのうち1つを選択してください。
*
* 1. パブリック URL を使用 - 公開されている画像に適しています。
* 2. ローカルファイルを使用 - ローカルでの開発やテストに適しています。
* 3. Base64 エンコーディングを使用 - 非公開の画像や暗号化された伝送が必要なシナリオに適しています。
*/
//[メソッド 1] パブリック URL
static String imgUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png";
//[メソッド 2] ローカルファイルパス (file://+絶対パス)
// static String imgUrl = "file://" + "/your/path/to/img.png"; // Linux/macOS
// static String imgUrl = "file://" + "/C:/your/path/to/img.png"; // Windows
//[メソッド 3] Base64 エンコーディング
// static String imgUrl = Image2Video.encodeFile("/your/path/to/img.png");
// 音声 URL を設定
static String audioUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3";
public static void image2video() throws ApiException, NoApiKeyException, InputRequiredException {
// パラメーターを設定
Map<String, Object> parameters = new HashMap<>();
parameters.put("prompt_extend", true);
parameters.put("watermark", false);
parameters.put("seed", 12345);
VideoSynthesis vs = new VideoSynthesis();
VideoSynthesisParam param =
VideoSynthesisParam.builder()
.apiKey(apiKey)
.model("wan2.6-i2v-flash")
.prompt("A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set under an urban railway bridge at night. The lighting comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of his rap, with no other dialogue or noise.")
.imgUrl(imgUrl)
.audioUrl(audioUrl)
.duration(10)
.parameters(parameters)
.resolution("480P")
.negativePrompt("")
.build();
System.out.println("Please wait...");
VideoSynthesisResult result = vs.call(param);
System.out.println(JsonUtils.toJson(result));
}
/**
* ファイルを Base64 文字列にエンコードします。
* @param filePath ファイルパス。
* @return フォーマットが data:{MIME_type};base64,{base64_data} の Base64 文字列。
*/
public static String encodeFile(String filePath) {
Path path = Paths.get(filePath);
if (!Files.exists(path)) {
throw new IllegalArgumentException("File does not exist: " + filePath);
}
// MIME タイプを検出
String mimeType = null;
try {
mimeType = Files.probeContentType(path);
} catch (IOException e) {
throw new IllegalArgumentException("Cannot detect file type: " + filePath);
}
if (mimeType == null || !mimeType.startsWith("image/")) {
throw new IllegalArgumentException("Unsupported or unrecognized image format");
}
// ファイルの内容を読み込んでエンコード
byte[] fileBytes = null;
try{
fileBytes = Files.readAllBytes(path);
} catch (IOException e) {
throw new IllegalArgumentException("Cannot read file content: " + filePath);
}
String encodedString = Base64.getEncoder().encodeToString(fileBytes);
return "data:" + mimeType + ";base64," + encodedString;
}
public static void main(String[] args) {
try {
image2video();
} catch (ApiException | NoApiKeyException | InputRequiredException e) {
System.out.println(e.getMessage());
}
System.exit(0);
}
}入力音声
数:1。
入力メソッド:
音声の提供には公開されている URL のみがサポートされています。このメソッドは HTTP または HTTPS プロトコルをサポートします。
出力動画
数:1。
出力動画の仕様:出力仕様はモデルによって異なります。「提供状況」をご参照ください。
出力動画 URL の有効期間:24 時間。
出力動画のディメンション:ディメンションは入力画像と
resolutionの設定によって決まります。モデルは、入力画像のアスペクト比を維持しながら、ターゲット値に近い総ピクセル数にスケーリングしようとします。エンコーディング標準のため、幅と高さは 16 の倍数でなければならず、モデルはディメンションをわずかに自動調整します。
例えば、入力画像が 750 × 1000 (アスペクト比 3:4 = 0.75) で、resolution = "720P" (ターゲットピクセル数は約 920,000) に設定した場合、最終的な出力は 816 × 1104 (アスペクト比 ≈ 0.739、総ピクセル数 ≈ 900,000) となり、幅と高さの両方が 16 の倍数になります。
課金とレート制限
無料クォータと単価については、「モデルの価格設定」をご参照ください。
レート制限については、「Wan シリーズ」をご参照ください。
課金の詳細:
課金は、正常に生成された動画の秒単位の長さに基づきます。
モデル呼び出しの失敗や処理エラーは、料金が発生したり、新規ユーザー向けの無料クォータを消費したりしません。
画像動画生成は節約プランもサポートしています。
API リファレンス
よくある質問
Q:なぜ動画のアスペクト比 (16:9 など) を直接設定できないのですか?
A:現在の API は、動画のアスペクト比を直接指定することをサポートしていません。resolution パラメーターを使用して動画の解像度を設定することしかできません。
resolution パラメーターは、固定の比率ではなく、動画の総ピクセル数を制御します。モデルは、最初の入力画像の元のアスペクト比を維持することを優先し、ビデオエンコーディングの要件を満たすために微調整を行います。幅と高さの両方が 16 の倍数である必要があります。
Q:SDK コードを実行すると「url error, please check url!」というエラーが表示されるのはなぜですか?
A:以下を確認してください:
DashScope Python SDK のバージョンが
1.25.8以降であること。DashScope Java SDK のバージョンが
2.22.6以降であること。
SDK のバージョンが古すぎると、「url error, please check url!」エラーが発生する可能性があります。SDK のアップグレードに関する詳細については、「SDK のアップグレード」をご参照ください。


