介绍
# Avatar Video Generation Skill
此技能允许您使用 Flyworks(又称 HiFly 飞影数字人)生成视频。可用功能: 1. **公共数字人视频**:使用预制的高度逼真数字人,通过文本或音频创建视频。 2. **会说话照片**:通过单张图片和文本/音频创建“会说话的照片”视频。 3. **声音克隆**:从音频样本中克隆声音,用于 TTS。
有关详细文档,请参阅 [references/](references/) 文件夹: - [authentication.md](references/authentication.md) - API 令牌设置 - [avatars.md](references/avatars.md) - 使用数字人 - [voices.md](references/voices.md) - 声音选择与克隆 - [video-generation.md](references/video-generation.md) - 视频创建工作流
## API 令牌与限制
此技能适用于默认的免费版令牌,但存在一些限制: - **水印**:生成的视频将带有水印。 - **时长限制**:视频时长限制为 30 秒。
**要移除限制:** 1. 在 [hifly.cc](https://hifly.cc) 或 [flyworks.ai](https://flyworks.ai) 注册。 2. 从 [用户设置](https://hifly.cc/setting) 获取您的 API 密钥。 3. 设置环境变量:`export HIFLY_API_TOKEN="your_token_here"`
## 工具
### `scripts/hifly_client.py`
所有操作的主要入口点。
#### 用法
```bash # List available public avatars python scripts/hifly_client.py list_public_avatars
# List available public voices python scripts/hifly_client.py list_public_voices
# Create a video with a public avatar (TTS) python scripts/hifly_client.py create_video --type tts --text "Hello world" --avatar "avatar_id_or_alias" --voice "voice_id_or_alias"
# Create a video with a public avatar (Audio URL or File) python scripts/hifly_client.py create_video --audio "https://... or path/to/audio.mp3" --avatar "avatar_id_or_alias"
# Create a talked photo video using bundled assets python scripts/hifly_client.py create_talking_photo --image assets/avatar.png --title "Bundled Avatar"
# Clone a voice using bundled assets python scripts/hifly_client.py clone_voice --audio assets/voice.MP3 --title "Bundled Voice"
# Check status of generated tasks python scripts/hifly_client.py check_task --id "TASK_ID"
# Manage local aliases (saved in memory.json) python scripts/hifly_client.py manage_memory add my_avatar "av_12345" python scripts/hifly_client.py manage_memory list ```
## 示例
### 1. 创建一个简单的问候视频 ```bash # First find a voice and avatar python scripts/hifly_client.py list_public_avatars python scripts/hifly_client.py list_public_voices
# Generate python scripts/hifly_client.py create_video --type tts --text "Welcome to our service." --avatar "av_public_01" --voice "voice_public_01" ```
### 2. 使用自定义会说话照片 ```bash # Create the avatar from an image URL python scripts/hifly_client.py create_talking_photo --image "https://mysite.com/photo.jpg" --title "CEO Photo" # Output will give you an Avatar ID, e.g., av_custom_99
# Save it to memory python scripts/hifly_client.py manage_memory add ceo av_custom_99
# Generate video using the new avatar python scripts/hifly_client.py create_video --type tts --text "Here is the quarterly report." --avatar ceo --voice "voice_public_01" ```
## Agent 行为指南
在协助用户生成视频时,请遵循以下准则:
### 需要选择声音
**视频生成同时需要文本 AND 声音。** 如果用户提供了文本但没有提供声音:
1. **首先检查本地内存**:运行 `manage_memory list` 查看用户是否保存了任何声音别名。 2. **请用户选择**: - "我看到您想用文本 '[text]' 创建视频。您想使用哪个声音?" - 如果他们有保存的声音:"您有这些已保存的声音:[list]。还是您更倾向于使用公共声音?" - 如果没有保存的声音:"您想使用公共声音,还是先从音频样本克隆您自己的声音?"
3. **帮助他们选择**: - 查看公共声音:`list_public_voices` - 克隆声音:`clone_voice --audio [file] --title [name]`
### 完整工作流示例
对于类似*"用我的照片创建一个会说话的照片视频,内容是 '这是我的 AI 分身'"*的提示:
1. 询问:"您想为您的 AI 分身使用哪个声音?您可以使用公共声音或克隆您自己的声音。" 2. 如果他们想克隆:帮助他们使用 `clone_voice` 3. 使用文本和声音创建会说话照片: ```bash python scripts/hifly_client.py create_talking_photo \ --image user_photo.jpg \ --text "this is my AI twin" \ --voice SELECTED_VOICE_ID \ --title "My AI Twin" ```
### 保存以备后用
创建数字人或克隆声音后,主动提出保存它们: ```bash python scripts/hifly_client.py manage_memory add my_avatar AVATAR_ID --kind avatar python scripts/hifly_client.py manage_memory add my_voice VOICE_ID --kind voice ```