> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-zh/shi-pin-sheng-cheng/framepack.md).

# FramePack 视频生成

使用 FramePack 在 Clore.ai 上仅用 6GB VRAM 生成 AI 视频

FramePack 是 AI 视频生成领域的一项突破：它可以使用 **仅 6GB 显存**生成长达 2 分钟的视频。基于 HunyuanVideo 架构，FramePack 的核心创新在于高效打包帧，使 GPU 显存占用无论视频长度如何都保持恒定。这使得原本受限的低价 GPU 也能用于 AI 视频生成。

## 主要特性

* **最低 6GB 显存**：可在 RTX 3060、RTX 3070，甚至 GTX 1060 上运行！
* **最长 2 分钟视频**：无论视频长度如何，显存占用都保持恒定
* **图像转视频**：用文本提示为任意图像添加动画
* **包含 Web UI**：基于 Gradio 的界面，使用方便
* **基于 HunyuanVideo**：采用腾讯的视频扩散架构
* **开源**：GitHub，且正在积极开发中

## 需求

| 组件     | 最低           | 推荐            |
| ------ | ------------ | ------------- |
| GPU    | GTX 1060 6GB | RTX 4090 24GB |
| 显存     | 6GB          | 12GB+         |
| 内存     | 16GB         | 32GB          |
| 磁盘     | 30GB         | 50GB          |
| CUDA   | 12.8+        | 12.8+         |
| Python | 3.10+        | 3.11          |

**推荐的 Clore.ai GPU**：RTX 3080 10GB（$0.05–0.19/小时）——低成本也能有很棒的画质！

### 速度参考

| GPU           | 每帧耗时   | 60 帧视频（30fps 下约 2 秒） |
| ------------- | ------ | -------------------- |
| RTX 3060 12GB | 约 30 秒 | 约 30 分钟              |
| RTX 3080 10GB | \~18 秒 | 约 18 分钟              |
| RTX 4080 16GB | \~12 秒 | 约 12 分钟              |
| RTX 4090 24GB | \~8 秒  | \~8 分钟               |
| RTX 5090 32GB | \~5 秒  | \~5 分钟               |

## 安装

```bash
# 克隆仓库
git clone https://github.com/lllyasviel/FramePack.git
cd FramePack

# 创建 conda 环境（推荐）
conda create -n framepack python=3.11 -y
conda activate framepack

# 安装依赖
pip install -r requirements.txt

# 安装带 CUDA 的 PyTorch
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
```

### Docker 安装

```bash
docker run --gpus all -p 7860:7860 \
  -v ~/.cache/huggingface:/root/.cache/huggingface \\
  -v ./outputs:/app/outputs \
  ghcr.io/lllyasviel/framepack:latest
```

## 快速开始 — Web UI

使用 FramePack 最简单的方法：

```bash
cd FramePack
python app.py --port 7860

# 对于低显存（6GB）：
python app.py --port 7860 --low-vram

# 访问 http://localhost:7860
```

**Web UI 工作流程：**

1. 上传源图像（第一帧）
2. 输入描述动作的文本提示（“镜头缓慢放大”，“人物向前走”）
3. 设置视频长度（帧数）
4. 点击生成
5. 下载 MP4

## 用法

FramePack 是一个 **Gradio 网页应用**，不是 Python 库。主要交互界面是 Web UI。

### Web UI 工作流

1. 打开 `http://localhost:7860` 启动后
2. 上传源图像（将作为第一帧）
3. 输入描述所需动作的文本提示
4. 设置帧数（越多 = 视频越长）
5. 点击 **生成** → 等待 → 下载 MP4

### 通过 Gradio Client 访问 API

你可以使用 Gradio API 以程序方式调用 FramePack：

```python
from gradio_client import Client

# 连接到正在运行的 FramePack 实例
client = Client("http://localhost:7860")

# 通过图像 + 提示词生成视频
result = client.predict(
    "input_photo.jpg",                              # 源图像
    "the person smiles and turns their head slowly", # 提示词
    60,                                              # 帧数
    7.5,                                             # 引导系数
    30,                                              # 推理步数
    42,                                              # 随机种子
    api_name="/generate"
)
print(f"视频已保存到：{result}")
```

### 使用 Gradio Client 批量处理

```python
from gradio_client import Client
import glob

client = Client("http://localhost:7860")

prompts = [
    ("photo1.jpg", "柔和灯光下的轻微镜头推进"),
    ("photo2.jpg", "风吹动头发，云朵移动"),
    ("photo3.jpg", "缓慢拉远，展示完整场景"),
]

for img_path, prompt in prompts:
    result = client.predict(img_path, prompt, 60, 7.5, 30, -1, api_name="/generate")
    print(f"完成：{img_path} → {result}")
```

## 分辨率指南

| 显存   | 最大分辨率    | 质量     |
| ---- | -------- | ------ |
| 6GB  | 512×512  | 适合社交媒体 |
| 8GB  | 640×640  | 细节更好   |
| 10GB | 512×768  | 竖屏/横屏  |
| 12GB | 768×768  | 高质量    |
| 24GB | 1024×768 | 最佳质量   |

## 给 Clore.ai 用户的建议

* **经济实惠**：这是少数能在廉价 GPU 上运行的视频 AI 模型之一（RTX 3060 仅 $0.03–0.07/小时！）
* **使用 `--low-vram` 标志**：6–8GB GPU 必备——会自动启用 CPU 卸载
* **512×512 就可以**：用于社交媒体（TikTok、Reels），512px 完全足够
* **更长 ≠ 更多显存**：与其他视频模型不同，FramePack 保持显存恒定——可以自由生成更长视频
* **预下载模型**：首次运行会下载约 15GB。运行一次后，你的 Clore 会话就会缓存这些模型
* **与超分放大结合**：先生成 512×512，再用 Real-ESRGAN 放大到 2K/4K

## 提示词技巧

好的提示词应描述 **动作**，而不只是外观：

```
✅ "the camera slowly pans right, revealing a mountain landscape"
✅ "the person blinks and smiles gently, wind moves their hair"
✅ "zoom out slowly, showing the full building"

❌ "a beautiful sunset"（未描述动作）
❌ "high quality, 4K, detailed"（风格词帮助不大）
```

## 故障排查

| 问题          | 解决方案                                                  |
| ----------- | ----------------------------------------------------- |
| CUDA 内存不足   | 使用 `--low-vram` 标志，分辨率降至 512×512                      |
| 生成非常慢       | 6GB GPU 属正常情况（约 30 秒/帧）。使用 RTX 4090 可获得 4 倍速度         |
| 黑屏/损坏帧      | 更新 PyTorch： `pip install torch --upgrade`             |
| 模型下载卡住      | 检查磁盘空间（需要 30GB 可用空间）。尝试 `HF_HUB_ENABLE_HF_TRANSFER=1` |
| Web UI 无法启动 | 检查 7860 端口是否可用： `lsof -i :7860`                       |

## 延伸阅读

* [GitHub 仓库](https://github.com/lllyasviel/FramePack)
* [HunyuanVideo（基础模型）](https://github.com/Tencent/HunyuanVideo)
* [Clore.ai GPU 对比](/guides/guides_v2-zh/ru-men-zhi-nan/gpu-comparison.md) — 为你的需求找到最便宜的 GPU


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-zh/shi-pin-sheng-cheng/framepack.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
