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

# 视频分析

### 支持的模型

目前极客智坊支持的在对话中进行视频分析的 AI 模型如下，主要是 Gemini 模型、GLM视觉模型、最新千问和豆包模型：

* `gemini-3.1-pro-preview`
* `gemini-3.1-pro-preview:fast-thinking`
* `gemini-3.1-flash-lite-preview`
* `gemini-3-flash-preview`
* `gemini-3-flash-preview:no-thinking`
* `gemini-2.5-pro`
* `gemini-2.5-pro:fast-thinking`
* `gemini-2.5-flash`
* `gemini-2.5-flash:no-thinking`
* `gemini-2.5-flash-lite`
* `gemini-2.0-flash`
* `gemini-2.0-flash-lite`
* `gemini-2.5-flash-lite:no-thinking`
* `gemini-2.5-flash-preview-09-2025`
* `gemini-2.5-flash-lite-preview-09-2025`
* `glm-5v-turbo`
* `glm-4.6v`
* `glm-4.5v`
* `qwen3.5-flash`
* `qwen3.5-plus`
* `qwen3.5-397b-a17b`
* `qwen3.5-35b-a3b`
* `qwen3.5-27b`
* `qwen3.5-122b-a10b`
* `qwen3.5-omni-flash`
* `qwen3.5-omni-plus`
* `qwen3.6-plus`
* `qwen3.6-flash`
* `qwen3.6-35b-a3b`
* `qwen3.6-27b`
* `doubao-seed-2.0-mini`
* `doubao-seed-2.0-lite`
* `doubao-seed-2.0-pro`
* `doubao-seed-2.0-code`
* `doubao-seed-1.8`
* `doubao-seed-1.6-flash`
* `doubao-seed-1.6`
* `doubao-seed-1.6-vision`
* `doubao-seed-1.6-lite`
* `doubao-seed-code-preview`

你也可以在[模型广场](https://geekai.co/models)中通过模型功能->视频理解进行筛选，获取所有支持视频理解的对话模型：

![在极客智坊模型广场筛选支持视频理解的对话模型](https://static.geekai.co/storage/2025/10/15/f9977742dd674c9a1726848c62f29df6.png)

视频处理能力包括：

* 描述、分割视频并提取信息
* 回答关于视频内容的问题
* 参考视频中的具体时间点

下面我们以 Gemini 模型为例，介绍一下视频分析的使用方法和注意事项，其他模型也是类似的。

### 视频格式和尺寸

Gemini 支持以下视频格式 MIME 类型：

* `video/mp4`
* `video/mpeg`
* `video/mov`
* `video/avi`
* `video/x-flv`
* `video/mpg`
* `video/webm`
* `video/wmv`
* `video/3gpp`

且上传视频 URL 必须是公网可访问的 URL。

在文件尺寸方面，Gemini 最大支持 2GB 文件，在视频时长方面，以上支持视频分析的 Gemini 模型（1M上下文）可处理长达 1 小时的视频。

### 视频对话示例

**基本示例**

对于 Gemini 2.5 以前的版本，每次请求只能上传一个视频：

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gemini-2.0-flash",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text", 
                    "text": "分析这段视频的内容"
                },
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "https://static.geekai.co/video/2025/10/14/8f64bf9bcf1b21fb3d7f55d6ae8c1552.mp4"
                    }
                }
            ]
        }
    ]
}'
```

**时间戳**

您可以通过 `MM:SS` 格式的时间戳，询问视频中特定时间点的问题：

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gemini-2.0-flash",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text", 
                    "text": "在 00:05 和 00:10 给出的示例是要向我们展示什么"
                },
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "https://static.geekai.co/video/2025/10/14/8f64bf9bcf1b21fb3d7f55d6ae8c1552.mp4"
                    }
                }
            ]
        }
    ]
}'
```

**转录视频并提供视觉描述**

Gemini 模型能够通过处理视频的音频轨道和视觉帧来转录视频内容并提供视觉描述：

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gemini-2.5-flash",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text", 
                    "text": "转录这个视频的音频内容，并为视频中的重要事件提供时间戳，同时提供视觉描述。"
                },
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "https://static.geekai.co/video/website.mp4"
                    }
                }
            ]
        }
    ]
}'
```

<Note>
  在生成视觉描述时，模型会以每秒 1 帧的速率对视频进行采样，此采样速率可能会影响描述的详细程度，尤其是在视觉变化快速的视频中。
</Note>

**多个视频**

对于 Gemini 2.5 及以后的版本，可以在一次请求中上传多个视频进行分析，最多可以上传 10 个：

```bash curl theme={null}
curl --location --request POST 'https://geekai.co/api/v1/chat/completions' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gemini-2.5-flash",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "text", 
                    "text": "分析这两段视频有什么不一样"
                },
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "https://static.geekai.co/video/2025/10/14/8f64bf9bcf1b21fb3d7f55d6ae8c1552.mp4"
                    }
                },
                {
                    "type": "video_url",
                    "video_url": {
                        "url": "https://static.geekai.co/video/2025/10/14/dba448a408a2dbe394adc889e13b43ce.mp4"
                    }
                }
            ]
        }
    ]
}'
```

尽管如此，对于复杂任务，为获得最佳效果，每次提示请求请仅使用一个视频。

视频对话响应结果和普通的文本对话一样：

```json theme={null}
{
    "id": "a74bf0c3-1a7e-4ad4-b233-6ee9b850ae66",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "这两段视频主要有以下几点不同：\n\n1.  **车辆颜色不同：** 第一段视频中的车是浅蓝色或白色，而第二段视频中的车是深蓝色。\n2.  **拍摄角度/视角不同：**\n    *   第一段视频的视角是从车辆的侧前方，摄像机似乎在围绕车辆进行环绕式拍摄，展示车辆的侧面和行进姿态，车辆是横向从画面左侧向右侧移动。\n    *   第二段视频的视角是从车辆的后方，摄像机面向车辆的尾部，记录车辆驶离的场景，车辆是径直向画面远处驶去。\n3.  **车辆相对摄像机的运动方向不同：** 第一段视频中车辆是“驶过”摄像机（横向移动），而第二段视频中车辆是“驶离”摄像机（纵向远去）。\n\n**共同点：**\n*   **车型相同：** 两段视频中的车看起来是同一款车型（丰田GR86或斯巴Z BRZ，2022+款）。\n*   **拍摄环境相同：** 都在阳光明媚的沙漠公路环境下拍摄，背景有山脉，道路标记（双黄线）也一致。\n*   **拍摄技术类似：** 均使用了360度全景相机进行拍摄，通过后期剪辑调整了视角，使得画面看起来非常流畅且视角独特（例如，车辆下方的影子会随视角旋转，这是360相机隐形自拍杆的常见效果）。\n*   **音效类似：** 都包含了车辆行驶时的引擎和排气声。"
            },
            "finish_reason": "stop"
        }
    ],
    "model": "gemini-2.5-flash",
    "object": "chat.completion",
    "usage": {
        "prompt_tokens": 6441,
        "completion_tokens": 357,
        "total_tokens": 8665,
        "completion_tokens_details": {
            "reasoning_tokens": 1867
        }
    }
}
```

**额外费用**

视频的每一秒都会被进行 Token 化处理，具体如下：

* 单帧：默认每帧为 258 Token
* 音频：每秒 32 token
* 元数据也会参与统计

所以折算下来，视频每秒对应约 300 token，这将作为 `prompt_tokens` 参与计费。
