すべてのプロダクト
Search
ドキュメントセンター

Alibaba Cloud Model Studio:Wan - 画像から動画へ API リファレンス

最終更新日:Feb 11, 2026

Wan の画像から動画へモデルは、最初のフレームの画像テキストプロンプトをもとに滑らかな動画を生成します。

関連ドキュメント: ユーザーガイド

利用範囲

正常に API を呼び出すためには、モデル、エンドポイント URL、API キーがすべて同一リージョンに属している必要があります。クロスリージョンでの呼び出しは失敗します。

説明

このトピックのサンプルコードはシンガポールリージョンを対象としています。

HTTP 呼び出し

画像から動画へタスクの完了には通常 1~5 分程度かかるため、API では非同期呼び出しが採用されています。全体の処理フローは、以下の 2 つのコアステップで構成されます:タスクの作成 → 結果のポーリング

ステップ 1:タスクを作成し、タスク ID を取得

シンガポール

POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

米国 (バージニア)

POST https://dashscope-us.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

北京

POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

説明
  • タスク作成後は、返されたtask_idを使用して結果を照会します。task_idの有効期限は 24 時間です。重複したタスクを作成しないでください。代わりにポーリングにより結果を取得してください。

  • 初心者向けチュートリアルについては、Postmanをご参照ください。

リクエストパラメーター

マルチショットナラティブ

この機能は、wan2.6 モデルのみでサポートされています。

"prompt_extend": trueおよび"shot_type":"multi"を設定することで有効化できます。

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"
    }
}'

自動ダビング

この機能は、wan2.6 および wan2.5 モデルのみでサポートされています。

input.audio_urlを指定しない場合、モデルは動画の内容に基づいて、マッチするバックグラウンド音楽または効果音を自動生成します。

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
    }
}'

音声ファイルを指定する

この機能は、wan2.6 および wan2.5 モデルのみでサポートされています。

動画のバックグラウンド音楽またはナレーションを指定するには、カスタム音声ファイルの URL をinput.audio_urlパラメーターに渡します。

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
    }
}'

無音動画の生成

以下のモデルのみが無音動画の生成をサポートしています:

  • wan2.6-i2v-flash: 無音動画を生成するには、明示的にparameters.audio = falseを設定する必要があります。

  • wan2.2 およびwan2.1 モデル: 無音動画がデフォルトで生成されます。追加のパラメーターは不要です。

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
    }
}'

ネガティブプロンプトの使用

ネガティブプロンプトパラメーターを使用して、生成された動画に「花」が含まれないようにします。

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",
        "negative_prompt": "flowers",
        "img_url": "https://cdn.translate.alibaba.com/r/wanx-demo-1.png"
    },
    "parameters": {
        "resolution": "480P",
        "prompt_extend": true
    }
}'
ヘッダー

Content-Type 文字列 (必須)

リクエストのコンテンツタイプ。値は必ずapplication/jsonである必要があります。

Authorization 文字列 (必須)

Model Studio API キーを使用した認証資格情報。

例: Bearer sk-xxxx

X-DashScope-Async 文字列 (必須)

非同期処理を有効化します。HTTP リクエストは非同期処理のみをサポートするため、値は必ずenableである必要があります。

重要

このヘッダーが存在しない場合、「current user api does not support synchronous calls」というエラーが返されます。

リクエスト本文

model 文字列 (必須)

モデル名。モデルおよび料金に関する詳細は、「モデル料金」をご参照ください。

例: wan2.6-i2v-flash。

input オブジェクト (必須)

プロンプトなどの基本的な入力情報。

プロパティ

prompt 文字列 (任意)

テキストプロンプトとは、生成したい画像に含める要素や視覚的な特徴を記述するものです。

中国語および英語の両方がサポートされています。各文字は 1 単位としてカウントされます。制限を超えたテキストは自動的に切り捨てられます。長さ制限はモデルバージョンによって異なります:

  • wan2.6 および wan2.5 モデル: 最大 1,500 文字。

  • wan2.2 およびwan2.1 モデル: 最大 800 文字。

例: 草の上で走る小さな猫。

プロンプトに関するヒントについては、「テキストから動画へ・画像から動画へ向けのプロンプトガイド」をご参照ください。

negative_prompt 文字列 (任意)

動画から除外したいコンテンツを記述するネガティブプロンプト。出力を制約するために使用します。

中国語および英語の両方がサポートされています。最大長は 500 文字です。制限を超えたテキストは自動的に切り捨てられます。

例: 低解像度、エラー、最悪の品質、低品質、変形、余分な指、不適切な比率。

img_url 文字列 (必須)

最初のフレームの画像の URL または Base64 エンコーディングデータ。

画像の制約条件:

  • フォーマット: JPEG、JPG、PNG(アルファチャンネルなし)、BMP、WEBP。

  • 解像度: 幅および高さは 360~2,000 ピクセルの間であること。

  • ファイルサイズ: 最大 10 MB。

サポートされる入力形式:

  1. パブリック URL:

    • HTTP および HTTPS がサポートされています。

    • 例: https://cdn.translate.alibaba.com/r/wanx-demo-1.png。

  2. Base64 エンコーディング画像文字列:

    • データフォーマット: data:{MIME_type};base64,{base64_data}

    • 例: data:image/png;base64,GDU7MtCZzEbTbmRZ......(長さの都合で省略)。

    • 詳細については、「入力画像」をご参照ください。

audio_url 文字列 (任意)

サポートされるモデル: wan2.6 および wan2.5 モデル。

音声ファイルの URL。モデルはこの音声を使用して動画を生成します。

サポートされる入力形式:

  1. パブリック URL:

    • HTTP および HTTPS がサポートされています。

    • 例: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/xxx.mp3。

音声の制約条件:

  • フォーマット: wav、mp3。

  • 再生時間: 3~30 秒。

  • ファイルサイズ: 最大 15 MB。

  • オーバーフロー処理: 音声の再生時間がduration値(5 秒または 10 秒)を超える場合、システムは先頭の 5 秒または 10 秒に切り捨てます。音声の再生時間が動画の再生時間より短い場合、残りの部分は無音になります。たとえば、音声が 3 秒で動画が 5 秒の場合、最初の 3 秒は音声があり、最後の 2 秒は無音になります。

例: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3。

parameters オブジェクト (任意)

解像度、再生時間、プロンプト再書き込み、ウォーターマークなど、動画処理パラメーター。

プロパティ

resolution 文字列 (任意)

重要

解像度は直接課金に影響します。同一モデルにおいては、1080P > 720P > 480P となります。呼び出し前に料金を確認してください。「モデル料金」をご参照ください。

生成される動画の解像度レベルを指定し、明瞭度(総ピクセル数)を調整します。モデルは選択されたレベルに基づいて類似の総ピクセル数にスケールします。動画の縦横比は、入力画像(img_url)の縦横比にほぼ一致します。「よくある質問」をご参照ください。

デフォルト値および選択肢は、モデルパラメーターによって異なります:

  • wan2.6-i2v-flash: 選択肢: 720P、1080P。デフォルト: 1080P

  • wan2.6-i2v: 選択肢: 720P、1080P。デフォルト: 1080P

  • wan2.6-i2v-us: 選択肢: 720P、1080P。デフォルト: 1080P

  • wan2.5-i2v-preview: 選択肢: 480P、720P、1080P。デフォルト: 1080P

  • wan2.2-i2v-flash: 選択肢: 480P、720P。デフォルト: 720P

  • wan2.2-i2v-plus: 選択肢: 480P、1080P。デフォルト: 1080P

  • wan2.1-i2v-turbo: 選択肢: 480P、720P。デフォルト: 720P

  • wan2.1-i2v-plus: 選択肢: 720P。デフォルト: 720P

例: 1080P。

duration 整数 (任意)

重要

再生時間は直接課金に影響します。課金単位は秒単位です。再生時間が長いほどコストが高くなります。呼び出し前に料金を確認してください。「モデル料金」をご参照ください。

生成される動画の再生時間(秒単位)。有効値はモデルパラメーターによって異なります:

  • wan2.6-i2v-flash: 2~15 の整数。デフォルト: 5。

  • wan2.6-i2v: 2~15 の整数。デフォルト: 5。

  • wan2.6-i2v-us: 選択肢: 5、10、15。デフォルト: 5。

  • wan2.5-i2v-preview: 選択肢: 5、10。デフォルト: 5。

  • wan2.2-i2v-plus: 固定値 5 秒(設定不可)。

  • wan2.2-i2v-flash: 固定値 5 秒(設定不可)。

  • wan2.1-i2v-plus: 固定値 5 秒(設定不可)。

  • wan2.1-i2v-turbo: 選択肢: 3、4、5。デフォルト: 5。

例: 5。

prompt_extend ブール値 (任意)デフォルト値はtrue

プロンプト再書き込みを有効化するかどうか。有効化すると、LLM が入力プロンプトを再書き込みします。これは短いプロンプトの生成品質を大幅に向上させますが、処理時間も増加します。

  • true

  • false

例: true

shot_type 文字列 (任意)

サポートされるモデル: wan2.6 モデル。

生成される動画が単一の連続ショットを使用するか、複数の切り替えショットを使用するかを指定します。

有効化条件: "prompt_extend": true の場合にのみ有効になります。

パラメーター優先順位: shot_type > prompt。たとえば、shot_type を "single" に設定した場合、プロンプトに「マルチショット動画を生成」と記述されていても、モデルは単一ショット動画を出力します。

有効値:

  • single(デフォルト): 単一ショット動画を出力します。

  • multi: マルチショット動画を出力します。

例: single。

説明

このパラメーターを使用して、製品デモ向けの単一ショットや短編映画向けのマルチショットなど、ナラティブ構造を厳密に制御できます。

audio ブール値 (任意)

重要

音声設定は直接課金に影響します。音声付き動画と無音動画では料金が異なります。呼び出し前に料金を確認してください。「モデル料金」をご参照ください。

サポートされるモデル: wan2.6-i2v-flash。

音声付き動画を生成するかどうかを指定します。

パラメーター優先順位: audio > audio_url。つまり、audio=false を指定した場合、audio_url を指定していても出力は無音となり、無音動画の料金が適用されます。

有効値:

  • true(デフォルト): 音声付き動画を出力します。

  • false: 無音動画を出力します。

例: true。

watermark ブール値 (任意)

動画の右下隅に「AI Generated」というウォーターマークを追加するかどうかを指定します。

  • false(デフォルト): ウォーターマークを追加しません。

  • true: ウォーターマークを追加します。

例: false。

seed 整数 (任意)

乱数シード。値の範囲: [0, 2147483647]

指定しない場合、システムがランダムなシードを生成します。再現性を高めるには、シード値を固定してください。

注: モデル生成の確率的性質により、同一のシードであっても毎回同一の結果が保証されるわけではありません。

例: 12345。

レスポンスパラメーター

成功時のレスポンス

task_id を保存し、タスクのステータスおよび結果を照会します。

{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

エラー時のレスポンス

タスク作成に失敗しました。問題を解決するには、「エラーコード」をご参照ください。

{
    "code": "InvalidApiKey",
    "message": "No API-key provided.",
    "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}

output オブジェクト

タスク出力情報。

プロパティ

task_id 文字列

タスクの ID。最大 24 時間まで照会可能です。

task_status 文字列

タスクのステータス。

列挙値

  • PENDING

  • RUNNING

  • SUCCEEDED

  • FAILED

  • CANCELED

  • UNKNOWN: タスクが存在しない、またはステータスが不明

request_id 文字列

リクエストの一意の識別子。トレースおよびトラブルシューティングに使用します。

code 文字列

エラーコード。リクエストが失敗した場合にのみ返されます。「エラーコード」の詳細をご参照ください。

message 文字列

詳細なエラーメッセージ。リクエストが失敗した場合にのみ返されます。「エラーコード」の詳細をご参照ください。

ステップ 2:タスク ID による結果の照会

シンガポール

GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}

米国 (バージニア)

GET https://dashscope-us.aliyuncs.com/api/v1/tasks/{task_id}

北京

GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}

説明
  • ポーリングの推奨事項: 動画生成には数分かかることがあります。結果を取得するには、15 秒などの適切な間隔でポーリングを行うことを推奨します。

  • タスクステータスの遷移: PENDING → RUNNING → SUCCEEDED または FAILED。

  • 結果の URL: タスクが成功すると、ビデオの URL が返されます。この URL は 24 時間 有効です。URL を取得した後は、すぐにビデオをダウンロードして、Object Storage Service (OSS) などの永続的なストレージサービスに保存する必要があります。

  • task_id の有効期限: 24 時間。この期間を過ぎると結果を照会できなくなり、API はUNKNOWNというタスクステータスを返します。

リクエストパラメーター

タスク結果の照会

{task_id} を、前の API 呼び出しで返されたtask_idの値に置き換えます。

curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"
ヘッダー

Authorization 文字列 (必須)

Model Studio API キーを使用した認証資格情報。

例: Bearer sk-xxxx

URL パスパラメーター

task_id 文字列 (必須)

照会対象のタスクの ID。

レスポンスパラメーター

タスク成功時

動画 URL は 24 時間のみ保持され、その後自動的にパージされます。生成された動画は速やかに保存してください。

{
    "request_id": "2ca1c497-f9e0-449d-9a3f-xxxxxx",
    "output": {
        "task_id": "af6efbc0-4bef-4194-8246-xxxxxx",
        "task_status": "SUCCEEDED",
        "submit_time": "2025-09-25 11:07:28.590",
        "scheduled_time": "2025-09-25 11:07:35.349",
        "end_time": "2025-09-25 11:17:11.650",
        "orig_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.",
        "video_url": "https://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/xxx.mp4?Expires=xxx"
    },
    "usage": {
        "duration": 10,
        "input_video_duration": 0,
        "output_video_duration": 10,
        "video_count": 1,
        "SR": 720
    }
}

タスク失敗時

タスクが失敗した場合、task_status は FAILED に設定され、エラーコードおよびメッセージが返されます。問題を解決するには、「エラーコード」をご参照ください。

{
    "request_id": "e5d70b02-ebd3-98ce-9fe8-759d7d7b107d",
    "output": {
        "task_id": "86ecf553-d340-4e21-af6e-a0c6a421c010",
        "task_status": "FAILED",
        "code": "InvalidParameter",
        "message": "The size is not match xxxxxx"
    }
}

タスク照会の有効期限切れ

task_id の有効期限は 24 時間です。この期間を過ぎると照会は失敗し、以下のエラーメッセージが返されます。

{
    "request_id": "a4de7c32-7057-9f82-8581-xxxxxx",
    "output": {
        "task_id": "502a00b1-19d9-4839-a82f-xxxxxx",
        "task_status": "UNKNOWN"
    }
}

output オブジェクト

タスク出力情報。

プロパティ

task_id 文字列

タスクの ID。最大 24 時間まで照会可能です。

task_status 文字列

タスクのステータス。

列挙値

  • PENDING

  • RUNNING

  • SUCCEEDED

  • FAILED

  • CANCELED

  • UNKNOWN: タスクが存在しない、またはステータスが不明

ポーリング中のステータス遷移:

  • PENDING → RUNNING → SUCCEEDED または FAILED

  • 最初の照会では、通常 PENDING または RUNNING が返されます

  • SUCCEEDED ステータスでは、レスポンスに生成された動画の URL が含まれます

  • FAILED ステータスでは、エラーメッセージを確認して再試行する必要があります

submit_time 文字列

タスクが送信された時刻。時刻は UTC+8 です。フォーマット: YYYY-MM-DD HH:mm:ss.SSS

scheduled_time 文字列

タスクの実行が開始された時刻。時刻は UTC+8 です。フォーマット: YYYY-MM-DD HH:mm:ss.SSS

end_time 文字列

タスクが完了した時刻。時刻は UTC+8 です。フォーマット: YYYY-MM-DD HH:mm:ss.SSS

video_url 文字列

生成された動画の URL。task_status が SUCCEEDED の場合にのみ返されます。

URL の有効期限は 24 時間です。H.264 エンコーディングの MP4 形式で動画をダウンロードするために使用します。

orig_prompt 文字列

元の入力プロンプト。これはpromptリクエストパラメーターの値です。

actual_prompt 文字列

prompt_extend=true の場合、システムが入力プロンプトを知的に再書き込みします。このフィールドには、生成に使用された最適化されたプロンプトが返されます。

  • prompt_extend=false の場合、このフィールドは返されません。

  • 注: wan2.6 モデルでは、prompt_extend の値に関係なく、このフィールドは返されません。

code 文字列

エラーコード。リクエストが失敗した場合にのみ返されます。「エラーコード」の詳細をご参照ください。

message 文字列

詳細なエラーメッセージ。リクエストが失敗した場合にのみ返されます。「エラーコード」の詳細をご参照ください。

usage オブジェクト

出力統計情報。成功した結果に対してのみカウントされます。

プロパティ

wan2.6 モデルが返すパラメーター

input_video_duration 整数

入力動画の再生時間(秒単位)。入力動画はサポートされていないため、この値は固定で 0 です。

output_video_duration 整数

wan2.6 モデルでのみ返されます。

出力動画の再生時間(秒単位)。input.duration の値と等しくなります。

duration 整数

総動画再生時間。課金に使用されます。

課金計算式: duration=input_video_duration+output_video_duration

SR 整数

wan2.6 モデルでのみ返されます。生成された動画の解像度レベル。例: 720。

video_count 整数

生成された動画の数。固定値は 1 です。

audioブール値

wan2.6-i2v-flash モデルでのみ返されます。出力動画に音声があるかどうかを示します。

wan2.2 および wan2.5 モデルが返すパラメーター

duration 整数

生成された動画の再生時間(秒単位)。有効値: 5、10。

課金計算式: コスト = 動画秒数 × 単価。

SR 整数

生成された動画の解像度。有効値: 480、720、1080。

video_count 整数

生成された動画の数。固定値は 1 です。

wan2.1 モデルが返すパラメーター

video_duration 整数

生成された動画の再生時間(秒単位)。有効値: 3、4、5。

課金計算式: コスト = 動画秒数 × 単価。

video_ratio 文字列

生成された動画の縦横比。固定値は standard です。

video_count 整数

生成された動画の数。固定値は 1 です。

request_id 文字列

リクエストの一意の識別子。トレースおよびトラブルシューティングに使用します。

DashScope SDK 呼び出し

SDK のパラメーター名は、HTTP API とほぼ一致します。パラメーター構造は言語固有の規則に合わせて調整されています。

画像から動画へタスクの完了には通常 1~5 分程度かかるため、SDK は HTTP の非同期呼び出しフローをラップし、同期および非同期の両方の呼び出し方法をサポートしています。

実際の処理時間はキューの長さおよびサービスの実行状況に依存します。結果を待つ際は、しばらくお待ちください。

Python SDK 呼び出し

重要

以下のコードを実行する前に、DashScope Python SDK のバージョンが最低でも1.25.8以上であることを確認してください。

バージョンが古すぎる場合、「url error, please check url!」などのエラーが発生することがあります。「SDK のインストール」に従って SDK を更新してください。

モデルのリージョンに応じて、base_http_api_url を設定します:

シンガポール

dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'

米国 (バージニア)

dashscope.base_http_api_url = 'https://dashscope-us.aliyuncs.com/api/v1'

北京

dashscope.base_http_api_url = 'https://dashscope.aliyuncs.com/api/v1'

サンプルコード

同期呼び出し

同期呼び出しでは、動画の生成および結果の返却が完了するまでブロックされます。この例では、パブリック URL、Base64 エンコーディング、ローカルファイルパスの 3 種類の画像入力方法を示します。

リクエスト例
import base64
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import mimetypes
import dashscope

# シンガポールリージョンの URL。URL の取得先: https://www.alibabacloud.com/help/en/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/zh/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("サポートされていない、または認識できない画像フォーマット")
    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('しばらくお待ちください...')
    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="720P",
                              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('失敗しました。status_code: %s、code: %s、message: %s' %
              (rsp.status_code, rsp.code, rsp.message))


if __name__ == '__main__':
    sample_call_i2v()
レスポンス例
video_url は 24 時間有効です。動画を速やかにダウンロードしてください。
{
    "status_code": 200,
    "request_id": "2794c7a3-fe8c-4dd4-a1b7-xxxxxx",
    "code": null,
    "message": "",
    "output": {
        "task_id": "c15d5b14-07c4-4af5-b862-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
        "submit_time": "2026-01-22 23:24:46.527",
        "scheduled_time": "2026-01-22 23:24:46.565",
        "end_time": "2026-01-22 23:25:59.978",
        "orig_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."
    },
    "usage": {
        "video_count": 1,
        "video_duration": 0,
        "video_ratio": "",
        "duration": 10,
        "input_video_duration": 0,
        "output_video_duration": 10,
        "audio": true,
        "SR": 720
    }
}

非同期呼び出し

この例では非同期呼び出しを示します。即時にタスク ID を返却しますが、結果の取得または完了の待機が必要です。

リクエスト例
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope

# シンガポールリージョンの URL。URL の取得先: https://www.alibabacloud.com/help/en/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/zh/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")

# パブリックにアクセス可能な画像 URL の使用
img_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"

# 音声 URL の設定
audio_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"


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 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="720P",
                                    duration=10,
                                    prompt_extend=True,
                                    watermark=False,
                                    negative_prompt="",
                                    seed=12345)
    print(rsp)
    if rsp.status_code == HTTPStatus.OK:
        print("task_id: %s" % rsp.output.task_id)
    else:
        print('失敗しました。status_code: %s、code: %s、message: %s' %
              (rsp.status_code, rsp.code, rsp.message))

    # 非同期タスク情報の取得
    status = VideoSynthesis.fetch(task=rsp, api_key=api_key)
    if status.status_code == HTTPStatus.OK:
        print(status.output.task_status)
    else:
        print('失敗しました。status_code: %s、code: %s、message: %s' %
              (status.status_code, status.code, status.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('失敗しました。status_code: %s、code: %s、message: %s' %
              (rsp.status_code, rsp.code, rsp.message))


if __name__ == '__main__':
    sample_async_call_i2v()
レスポンス例

1. タスク作成時のレスポンス例

{
    "status_code": 200,
    "request_id": "6dc3bf6c-be18-9268-9c27-xxxxxx",
    "code": "",
    "message": "",
    "output": {
        "task_id": "686391d9-7ecf-4290-a8e9-xxxxxx",
        "task_status": "PENDING",
        "video_url": ""
    },
    "usage": null
}

2. タスク結果照会時のレスポンス例

video_url は 24 時間有効です。動画を速やかにダウンロードしてください。
{
    "status_code": 200,
    "request_id": "2794c7a3-fe8c-4dd4-a1b7-xxxxxx",
    "code": null,
    "message": "",
    "output": {
        "task_id": "c15d5b14-07c4-4af5-b862-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
        "submit_time": "2026-01-22 23:24:46.527",
        "scheduled_time": "2026-01-22 23:24:46.565",
        "end_time": "2026-01-22 23:25:59.978",
        "orig_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."
    },
    "usage": {
        "video_count": 1,
        "video_duration": 0,
        "video_ratio": "",
        "duration": 10,
        "input_video_duration": 0,
        "output_video_duration": 10,
        "audio": true,
        "SR": 720
    }
}

Java SDK 呼び出し

重要

以下のコードを実行する前に、DashScope Java SDK のバージョンが最低でも2.22.6以上であることを確認してください。

バージョンが古すぎる場合、「url error, please check url!」などのエラーが発生することがあります。「SDK のインストール」に従って SDK を更新してください。

モデルのリージョンに応じて、baseHttpApiUrl を設定します:

シンガポール

Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";

米国 (バージニア)

Constants.baseHttpApiUrl = "https://dashscope-us.aliyuncs.com/api/v1";

北京

Constants.baseHttpApiUrl = "https://dashscope.aliyuncs.com/api/v1";

サンプルコード

同期呼び出し

同期呼び出しでは、動画の生成および結果の返却が完了するまでブロックされます。この例では、パブリック URL、Base64 エンコーディング、ローカルファイルパスの 3 種類の画像入力方法を示します。

リクエスト例
// 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。URL の取得先: https://www.alibabacloud.com/help/en/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/zh/model-studio/get-api-key
    static String apiKey = System.getenv("DASHSCOPE_API_KEY");
    
    /**
     * 画像入力方法: 以下の 3 つのうちいずれかを選択してください。
     *
     * 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("720P")
                        .negativePrompt("")
                        .build();
        System.out.println("しばらくお待ちください...");
        VideoSynthesisResult result = vs.call(param);
        System.out.println(JsonUtils.toJson(result));
    }
    
     /**
     * ファイルを Base64 文字列にエンコード
     * @param filePath ファイルパス
     * @return MIME_type と Base64 データを含むフォーマット: data:{MIME_type};base64,{base64_data}
     */
    public static String encodeFile(String filePath) {
        Path path = Paths.get(filePath);
        if (!Files.exists(path)) {
            throw new IllegalArgumentException("ファイルが存在しません: " + filePath);
        }
        // MIME タイプの検出
        String mimeType = null;
        try {
            mimeType = Files.probeContentType(path);
        } catch (IOException e) {
            throw new IllegalArgumentException("ファイルタイプを検出できません: " + filePath);
        }
        if (mimeType == null || !mimeType.startsWith("image/")) {
            throw new IllegalArgumentException("サポートされていない、または認識できない画像フォーマット");
        }
        // ファイル内容の読み取りおよびエンコード
        byte[] fileBytes = null;
        try{
            fileBytes = Files.readAllBytes(path);
        } catch (IOException e) {
            throw new IllegalArgumentException("ファイル内容を読み取れません: " + 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);
    }
}
レスポンス例
video_url は 24 時間有効です。動画を速やかにダウンロードしてください。
{
    "request_id": "87c091bb-7a3c-4904-8501-xxxxxx",
    "output": {
        "task_id": "413ed6e4-5f3a-4f57-8d58-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
        "orig_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.",
        "submit_time": "2026-01-22 23:25:45.729",
        "scheduled_time": "2026-01-22 23:25:45.771",
        "end_time": "2026-01-22 23:26:44.942"
    },
    "usage": {
        "video_count": 1,
        "duration": 10.0,
        "input_video_duration": 0.0,
        "output_video_duration": 10.0,
        "SR": "720"
    },
    "status_code": 200,
    "code": "",
    "message": ""
}

非同期呼び出し

この例では非同期呼び出しを示します。即時にタスク ID を返却しますが、結果の取得または完了の待機が必要です。

リクエスト例
// Copyright (c) Alibaba, Inc. and its affiliates.

import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisListResult;
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.task.AsyncTaskListParam;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;

import java.util.HashMap;
import java.util.Map;

public class Image2Video {

    static {
        // シンガポールリージョンの URL。URL の取得先: https://www.alibabacloud.com/help/en/model-studio/image-to-video-api-reference
        Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
    }

    // 環境変数を設定していない場合、次の行を Model Studio API キーに置き換えてください: api_key="sk-xxx"
    // API キーの取得先: https://www.alibabacloud.com/help/zh/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 {
        // パラメーターの設定
        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("720P")
                        .negativePrompt("")
                        .build();
        // 非同期呼び出し
        VideoSynthesisResult task = vs.asyncCall(param);
        System.out.println(JsonUtils.toJson(task));
        System.out.println("しばらくお// Copyright (c) Alibaba, Inc. and its affiliates.

import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisListResult;
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.task.AsyncTaskListParam;
import com.alibaba.dashscope.utils.JsonUtils;
import com.alibaba.dashscope.utils.Constants;

import java.util.HashMap;
import java.util.Map;

public class Image2Video {

    static {
        // シンガポールリージョンの URL。URL の取得先: https://www.alibabacloud.com/help/en/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/zh/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 {
        // パラメーターの設定
        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("720P")
                        .negativePrompt("")
                        .build();
        // 非同期呼び出し
        VideoSynthesisResult task = vs.asyncCall(param);
        System.out.println(JsonUtils.toJson(task));
        System.out.println("しばらくお待ちください...");

        // 結果の取得
        VideoSynthesisResult result = vs.wait(task, apiKey);
        System.out.println(JsonUtils.toJson(result));
    }

    // タスク一覧の取得
    public static void listTask() throws ApiException, NoApiKeyException {
        VideoSynthesis is = new VideoSynthesis();
        AsyncTaskListParam param = AsyncTaskListParam.builder().build();
        param.setApiKey(apiKey);
        VideoSynthesisListResult result = is.list(param);
        System.out.println(result);
    }

    // 単一タスク結果の取得
    public static void fetchTask(String taskId) throws ApiException, NoApiKeyException {
        VideoSynthesis is = new VideoSynthesis();
        // DASHSCOPE_API_KEY が環境変数として設定されている場合、apiKey は null にできます
        VideoSynthesisResult result = is.fetch(taskId, apiKey);
        System.out.println(result.getOutput());
        System.out.println(result.getUsage());
    }

    public static void main(String[] args) {
        try {
            image2video();
        } catch (ApiException | NoApiKeyException | InputRequiredException e) {
            System.out.println(e.getMessage());
        }
        System.exit(0);
    }
}
レスポンス例

1. タスク作成時のレスポンス例

{
    "request_id": "5dbf9dc5-4f4c-9605-85ea-xxxxxxxx",
    "output": {
        "task_id": "7277e20e-aa01-4709-xxxxxxxx",
        "task_status": "PENDING"
    }
}

2. タスク結果照会時のレスポンス例

video_url は 24 時間有効です。動画を速やかにダウンロードしてください。
{
    "request_id": "87c091bb-7a3c-4904-8501-xxxxxx",
    "output": {
        "task_id": "413ed6e4-5f3a-4f57-8d58-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
        "orig_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.",
        "submit_time": "2026-01-22 23:25:45.729",
        "scheduled_time": "2026-01-22 23:25:45.771",
        "end_time": "2026-01-22 23:26:44.942"
    },
    "usage": {
        "video_count": 1,
        "duration": 10.0,
        "input_video_duration": 0.0,
        "output_video_duration": 10.0,
        "SR": "720"
    },
    "status_code": 200,
    "code": "",
    "message": ""
}

制限事項

  • データ有効期限: task_id および動画 URL は 24 時間のみ保持されます。有効期限を過ぎると、照会またはダウンロードができなくなります。

  • コンテンツモデレーション: 入力コンテンツ(プロンプト、画像など)および出力動画は、コンテンツセキュリティレビューの対象となります。違反がある場合、「IPInfringementSuspect」や「DataInspectionFailed」などのエラーが返されます。「エラーメッセージ」をご参照ください。

  • ネットワークアクセス構成: 動画リンクは Alibaba Cloud OSS に保存されます。セキュリティポリシーにより業務システムから外部 OSS リンクにアクセスできない場合は、以下の OSS ドメインをネットワークアクセスホワイトリストに追加してください。

    # OSS ドメイン一覧
    dashscope-result-bj.oss-cn-beijing.aliyuncs.com
    dashscope-result-hz.oss-cn-hangzhou.aliyuncs.com
    dashscope-result-sh.oss-cn-shanghai.aliyuncs.com
    dashscope-result-wlcb.oss-cn-wulanchabu.aliyuncs.com
    dashscope-result-zjk.oss-cn-zhangjiakou.aliyuncs.com
    dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com
    dashscope-result-hy.oss-cn-heyuan.aliyuncs.com
    dashscope-result-cd.oss-cn-chengdu.aliyuncs.com
    dashscope-result-gz.oss-cn-guangzhou.aliyuncs.com
    dashscope-result-wlcb-acdr-1.oss-cn-wulanchabu-acdr-1.aliyuncs.com

エラーコード

モデル呼び出しが失敗しエラーが返された場合は、「エラーメッセージ」を参照してトラブルシューティングを行ってください。

よくある質問

Q: 特定の縦横比(例: 3:4)で動画を生成するにはどうすればよいですか?

A: 出力動画の縦横比は、入力最初のフレーム画像(img_url)によって決定されます。ただし、厳密な比率(例: 正確な 3:4)は保証されません。若干の偏差が生じる可能性があります。

偏差が生じる理由: モデルは入力画像の比率をベースラインとして使用し、ターゲット総ピクセル数(解像度で設定)に基づいて最も近い有効な解像度を計算します。幅と高さは 16 の倍数である必要があるため、わずかな調整が行われます。そのため、出力比率は正確な 3:4 にはなりませんが、非常に近い値になります。

: 入力画像 750×1000(縦横比 3:4 = 0.75)、解像度 = "720P"(ターゲット約 920,000 ピクセル)の場合、出力は 816×1104(縦横比 ≈ 0.739、約 900,000 ピクセル)になります。

ベストプラクティス:

  1. 入力制御: 目標とする縦横比を持つ画像を最初のフレームとして使用します。

  2. 後処理: 厳密な比率が必要な場合は、編集ツールを使用して生成された動画をトリミングまたはパディングします。