> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdn-fly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kling 人脸识别

> 检测源视频中的人脸，为对口型生成建立会话。

人脸识别是 Kling 对口型工作流的**第一步**。它分析视频中的人脸，返回 `session_id`，后续[对口型生成](/zh/guides/model-api/kuaishou/kling-lip-sync)接口必须使用这个 `session_id`。

## 工作流概览

```
identify-face  →  session_id  →  advanced-lip-sync  →  task_id  →  轮询结果
```

`session_id` 将视频与人脸分析结果绑定在一起。没有它，对口型生成无法进行。

## 视频要求

* 视频中必须包含**至少一张清晰可见、正对镜头的人脸**
* 人脸光线充足，无严重遮挡，效果更好
* 视频必须可通过公网 URL 访问，或使用 Kling 之前生成的视频 ID（`video_id`）

## 快速示例

```bash cURL theme={null}
curl https://dayu.cdn-fly.com/kling/v1/videos/identify-face \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "video_url": "https://example.com/person-speaking.mp4"
  }'
```

```python Python theme={null}
import requests

response = requests.post(
    "https://dayu.cdn-fly.com/kling/v1/videos/identify-face",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
    },
    json={"video_url": "https://example.com/person-speaking.mp4"}
)

data = response.json()
session_id = data["data"]["session_id"]
face_count = len(data["data"]["face_list"])
print(f"Session ID: {session_id}（检测到 {face_count} 张人脸）")
```

## 请求参数

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `video_url` | string | 二选一 | 源视频的公网 URL |
| `video_id` | string | 二选一 | Kling 已生成视频的 ID |

## 返回结果

该接口为**同步**调用，结果立即返回，无需轮询。

| 字段 | 说明 |
| - | - |
| `data.session_id` | 传给对口型接口的会话 ID |
| `data.face_list[]` | 视频中检测到的所有人脸 |
| `face_list[].face_id` | 各人脸的唯一标识 |
| `face_list[].face_rect` | 人脸边框 `{x, y, width, height}`（像素） |

视频中有多人时，`face_list` 会包含多个条目。

> **[下一步：对口型生成](/zh/guides/model-api/kuaishou/kling-lip-sync)**
>
> 使用 session\_id 生成对口型视频。

> **[API 参考](/zh/api-reference/model-api/kuaishou/kling-identify-face)**
>
> 查看 Kling 人脸识别的交互式 API 文档。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.