mcpField
A
alibabacloud-avatar-video

alibabacloud-avatar-video

github.com/aliyunクリエイティブ・メディア281124 回インストール1 日前に更新
リポジトリ

alibabacloud-avatar-video について

Alibaba CloudのAPIを使う、クリエイター向けのメディア生成スキルです。音声・画像生成、ポートレートの口パク動画、全身アニメーション、テンプレート型アバター配信に対応します。

主な機能

  1. 01肖像写真と音声から話す動画を生成
  2. 02全身人物に動きを適用
  3. 03テキストから音声や画像を生成
  4. 04画像から動画を生成するパイプライン
  5. 05LingMouのテンプレート型アバター配信

活用シーン

  1. 01肖像写真に合成音声を付ける
  2. 02参照ダンスを全身人物に適用
  3. 03テキストから画像を作り動画化
  4. 04企業向けテンプレート型アバター配信を制作

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/aliyun/alibabacloud-aiops-skills --skill alibabacloud-avatar-video

インストール後、Claude Code で/alibabacloud-avatar-videoを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
aa-api.md
emo-api.md
lingmou-api.md
oss-upload.md
ram-policies.md
scripts/
animate_anyone.py
avatar_video.py
demo_pipeline.py
image_to_video.py
input_validation.py
live_portrait.py
portrait_animate.py
qwen_tts.py
text_to_image.py

詳細

Human Avatar — Alibaba Cloud AI Video & Speech

機能の概要

機能スクリプトモデル/APIリージョン概要
LivePortraitlive_portrait.pyliveportraitcn-beijing肖像画像+音声/動画 → 話す動画、2段階
EMOportrait_animate.pyemo-v1cn-beijing肖像画像+音声 → 話す人物の動画、検出+生成
AA (AnimateAnyone)animate_anyone.pyanimate-anyone-gen2cn-beijing全身アニメーション:検出 → モーションテンプレート → 動画
T2Itext_to_image.pywan2.x-t2iマルチリージョンテキスト → 画像、デフォルトは wan2.2-t2i-flash
I2Vimage_to_video.pywan2.x-i2vマルチリージョン画像 → 動画。T2I→I2V パイプラインに対応。デフォルトは wan2.7-i2v-flash
Qwen TTSqwen_tts.pyqwen3-tts-*cn-beijing/Singaporeテキスト → 音声。シーンに応じてモデル/音声を自動選択
LingMouavatar_video.pyLingMou SDKcn-beijingテンプレートベースのデジタルヒューマンによる配信動画

クイック選択ガイド

Talking head (have audio/video already)     → LivePortrait
Talking head (no audio; synthesize first)   → Qwen TTS → LivePortrait
Full-body dance / motion                    → AA (AnimateAnyone)
Text → image                                → T2I (text_to_image)
Image → video                               → I2V (image_to_video)
Text → video end-to-end                     → T2I → I2V (image_to_video --t2i-prompt)
Enterprise digital human / template news    → LingMou (avatar_video)

環境設定

pip install requests==2.33.1 dashscope==1.25.15 oss2==2.19.1 numpy==1.26.4
# LingMou additionally:
pip install alibabacloud-lingmou20250527==1.7.0 alibabacloud-tea-openapi==0.4.4
export DASHSCOPE_API_KEY=sk-xxxx               # Beijing-region API key
export ALIBABA_CLOUD_ACCESS_KEY_ID=xxx         # OSS upload
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=xxx
export OSS_BUCKET=your-bucket
export OSS_ENDPOINT=oss-cn-beijing.aliyuncs.com

⚠️ cn-beijing と Singapore の API キーは互換性がありません。正しいリージョンのキーを使用してください。
OSS_ENDPOINT は https:// プレフィックスを付けても付けなくてもかまいません。スクリプトが正規化します。


1. LivePortrait — 話す人物の動画

使用する場面:肖像写真と音声があり、話す人物の動画を手早く作成したい場合。

流れ:

Step 1: liveportrait-detect (sync)  → pass=true
  ↓
Step 2: liveportrait        (async)  → video_url

画像:人物が1人の正面向きの肖像画像。顔がはっきり写り、遮られていないもの
音声:wav/mp3、15MB 未満、1秒~3分
動画入力:音声は自動的に抽出されます(ffmpeg)

# Image + audio file
python scripts/live_portrait.py \
  --image ./portrait.jpg \
  --audio ./speech.mp3 \
  --template normal --download

# Image + video (extract audio)
python scripts/live_portrait.py \
  --image ./portrait.jpg \
  --video ./speech_video.mp4 \
  --template active --download

# Public URLs
python scripts/live_portrait.py \
  --image-url "https://..." \
  --audio-url "https://..." \
  --mouth-strength 1.2 --download

モーションテンプレート:

  • normal(デフォルト、中程度の動き)
  • calm(落ち着いた動き。ニュース/ストーリーテリング向け)
  • active(活発な動き。歌唱/司会向け)

2. Qwen TTS — テキストから音声への変換

使用する場面:テキストから音声ファイルを生成する場合(LivePortrait、EMO などで使用)。

デフォルトモデル:qwen3-tts-vd-realtime-2026-01-15

シーンに応じたモデルの自動選択
シーン --scene推奨モデル推奨音声
default / brandqwen3-tts-vd-realtime-2026-01-15Cherry
news / documentary / advertisingqwen3-tts-instruct-flash-realtimeSerena / Ethan
audiobook / dramaqwen3-tts-instruct-flash-realtimeCherry / Dylan
customer_service / chatbot / educationqwen3-tts-flash-realtimeAnna / Ethan
ecommerce / short_videoqwen3-tts-flash-realtimeCherry / Chelsie
使用可能な音声
音声特徴
Cherry明るく甘い女性の声。広告/オーディオブック/吹き替え向け
Serena落ち着いた知的な女性の声。ニュース/解説/企業向け
Ethan安定感のある温かい男性の声。教育/ドキュメンタリー/研修向け
Dylan表現力豊かな男性の声。ラジオドラマ/ゲームのナレーション向け
Anna穏やかで親しみやすい女性の声。サポート/アシスタント/日常会話向け
Chelsie若々しく爽やかな女性の声。ショート動画/eコマース向け
Thomas低く印象的な男性の声。ブランド/広告向け
Luna温かく柔らかな女性の声。瞑想/ストーリーテリング向け
# Default (qwen3-tts-vd-realtime + Cherry)
python scripts/qwen_tts.py --text "Hello, welcome to Qwen TTS." --download

# Match by scene
python scripts/qwen_tts.py --text "Today's market..." --scene news --download
python scripts/qwen_tts.py --text "Once upon a time..." --scene audiobook --download

# Style via instructions
python scripts/qwen_tts.py \
  --text "Dear students..." \
  --model qwen3-tts-instruct-flash-realtime \
  --instructions "Warm tone, steady pace, suitable for teaching" \
  --download

# List options
python scripts/qwen_tts.py --list-voices
python scripts/qwen_tts.py --list-models

3. T2I — Wan 2.x テキストから画像への変換

使用する場面:テキストから画像を生成する場合(必要に応じて I2V に入力できます)。

# Default model (wan2.2-t2i-flash, fast)
python scripts/text_to_image.py \
  --prompt "A woman in Hanfu in a peach blossom forest, cinematic, 4K, soft light" \
  --size 960*1696 --download

# Higher quality
python scripts/text_to_image.py \
  --prompt "..." --model wan2.2-t2i-plus --size 1280*1280 --download

# Latest (Wan 2.6)
python scripts/text_to_image.py \
  --prompt "..." --model wan2.6-t2i --size 1280*1280 --n 1 --download

モデル:

  • wan2.2-t2i-flash(デフォルト、高速、テストに最適)
  • wan2.2-t2i-plus(より高品質)
  • wan2.6-t2i(最新。対応アスペクト比が多く、同期呼び出し)

一般的なサイズ:1280*1280(1:1)/960*1696(9:16)/1696*960(16:9)


4. I2V — Wan 2.x 画像から動画への変換

使用する場面:画像を動きのある動画に変換する場合。先に T2I を使うことで、テキストから動画への変換にも対応します。

# Local image → video
python scripts/image_to_video.py \
  --image ./portrait.jpg \
  --prompt "She turns slowly and smiles; dress and petals drift gently" \
  --model wan2.7-i2v \
  --resolution 720P --duration 5 --download

# Pipeline: text → image → video
python scripts/image_to_video.py \
  --t2i-prompt "A woman in Hanfu in a peach blossom forest" \
  --prompt "She turns slowly; petals fall; poetic mood" \
  --download --output result.mp4

# With background music
python scripts/image_to_video.py \
  --image ./portrait.jpg \
  --audio-url "https://..." \
  --prompt "..." --download

モデル:

  • wan2.7-i2v(デフォルト。音声を含む。5秒/10秒)
  • wan2.5-i2v-preview(高品質プレビュー)
  • wan2.2-i2v-plus(音声内蔵なし。より高速)

5. AA AnimateAnyone — 全身アニメーション

使用場面:全身写真+参照モーション動画 → ダンス/モーション動画。

要件:

  • 画像:人物1人、正面向きの全身、頭からつま先まで、アスペクト比0.5~2.0
  • 動画:最初のフレームから全身がフレーム内に収まっていること。mp4/avi/mov、fps ≥ 24、2~60秒

3つの手順:

Step 1: animate-anyone-detect-gen2   (sync)  → check_pass=true
  ↓
Step 2: animate-anyone-template-gen2 (async)  → template_id (~3–5 min)
  ↓
Step 3: animate-anyone-gen2          (async)  → video_url (~3–5 min)
# Local files (auto convert + OSS upload)
python scripts/animate_anyone.py \
  --image ./portrait_fullbody.jpg \
  --video ./dance.mp4 \
  --download --output result.mp4

# Use image as background
python scripts/animate_anyone.py \
  --image ./portrait.jpg --video ./dance.mp4 \
  --use-ref-img-bg --video-ratio 9:16 --download

# Skip Step 2 (existing template_id)
python scripts/animate_anyone.py \
  --image ./portrait.jpg \
  --template-id "AACT.xxx.xxx" --download

自動変換:動画のwebm/mkv/flv → mp4、画像のwebp/heic → jpg。fpsが24未満の場合は、24 fpsに正規化します。


6. EMO — 話す顔(レガシー)

注意:LivePortraitを優先してください。より厳密なリップシンクが必要な場合はEMOが適しています。

python scripts/portrait_animate.py \
  --image ./portrait.jpg \
  --audio ./speech.mp3 \
  --download

7. LingMou — 企業向けテンプレート動画

使用場面:企業のデジタルヒューマンによるニュース、テンプレートベースの放送、任意のキャラクター画像を使った台本の読み上げ。

新しいワークフロー(template_idは指定しないことを推奨)
  • ユーザーが**template_idを指定した場合**:そのテンプレートを使って生成します。
  • template_idが指定されていない場合:
    1. アカウントにある既存の放送テンプレートを一覧表示します。
    2. 1つ以上ある場合は、ランダムに1つ選んで作成します。
    3. ない場合は、公開テンプレートを取得し、アカウントに最大3つコピーします。
    4. コピーしたテンプレートからランダムに1つ選び、続行します。
  • 注意事項:公開テンプレートをコピーしても、コピーはまだ完全な「レンダリング可能」なテンプレートになっていない場合があります。コピーの一部は下書きのままで、クリップ、アセット、変数のバインディングが不足していることがあります。LingMouで完成させてください。
  • ユーザーが画像だけを提供し、台本なしで「話す動画を作って」と依頼した場合:生成前に読み上げる原稿を確認してください。
scripts/avatar_video.pyでできること
  • --list-templates:アカウントのテンプレートを一覧表示
  • --list-public-templates:公開テンプレートを一覧表示(SDK 1.7.0以降)
  • --copy-public-templates:公開テンプレートを最大3つコピー(SDK 1.7.0以降)
  • --template-idを省略:既存のテンプレートをランダムに使用
  • ローカルのテンプレートが空の場合:フォールバックとして公開テンプレートのコピーを自動的に試行
  • --show-template-detail:テンプレートの詳細と置換可能な変数を表示
  • 入力テキストをテンプレートのテキスト変数に入力(text_content/test_textを優先)
  • 公開テンプレートのコピー直後に生成が失敗した場合、テンプレートの補完が必要な可能性を明確なエラーとして表示(エラーを通知せずに失敗することはありません)
# List templates
python scripts/avatar_video.py --list-templates

# Public templates (SDK 1.7.0+)
python scripts/avatar_video.py --list-public-templates

# Copy up to 3 public templates (SDK 1.7.0+)
python scripts/avatar_video.py --copy-public-templates

# No template_id — random existing template
python scripts/avatar_video.py \
  --text "Hello, welcome to today's tech news." \
  --download

# Specific template_id
python scripts/avatar_video.py \
  --template-id "BS1b2WNnRMu4ouRzT4clY9Jhg" \
  --text "Hello, welcome to today's tech news." \
  --download

# Detail for randomly chosen template
python scripts/avatar_video.py \
  --show-template-detail \
  --text "This is a test script for broadcast."
会話での使用方法

ユーザーが次のように依頼した場合:

  • 「この画像から話す動画を作って」
  • 「デジタルヒューマンの放送を作って」
  • 「画像をアップロードしてニュースを読ませて」

次の手順に従います:

  1. 読み上げる原稿や台本がすでに提供されているか確認します。
  2. 提供されていない場合は、**「読み上げる正確な台本は何ですか? 箇条書きでいただければ、放送用の原稿に整えることもできます。」**と尋ねます。
  3. 台本を受け取ったら、LingMouを実行します。既存のテンプレートをランダムに使用することを優先し、ローカルにない場合は公開テンプレートのコピーを試します。
  4. ユーザーがポートレートをアップロードしていても、テンプレートAPIがその画像を使用しない場合は、この方法はテンプレート駆動型であることを説明します。画像を使った話す顔の動画には、LivePortraitまたはEMOを使用してください。

APIリファレンスへのリンク

コメント