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

# 视频分析

> 使用 gemini-3-pro-preview-file 模型通过 URL 分析视频内容

## 概述

`gemini-3-pro-preview-file` 模型支持通过 `file_data.file_uri` 直接分析任意可访问的视频文件 URL，无需预先上传文件。

> \[!NOTE]
>
> * **接口**：`POST /v1beta/models/gemini-3-pro-preview-file:generateContent`
> * **当前仅支持视频分析**，支持 MP4、MOV、AVI、FLV、MKV、WebM 等常见格式
> * `mime_type` 可选，未提供时会尝试自动推断

## 基础示例

```bash theme={null}
curl -X POST "$BASE_URL/v1beta/models/gemini-3-pro-preview-file:generateContent" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [
        {"text": "请总结这个视频"},
        {"file_data": {"file_uri": "https://example.com/demo.mp4", "mime_type": "video/mp4"}}
      ]
    }]
  }'
```

## 请求参数

### file\_data 对象

| 参数          | 类型     | 必填 | 说明                       |
| ----------- | ------ | -- | ------------------------ |
| `file_uri`  | string | ✅  | 视频文件的公开可访问 URL           |
| `mime_type` | string | ❌  | 文件 MIME 类型，如 `video/mp4` |

## 应用场景

### 视频内容总结

```bash theme={null}
curl -X POST "$BASE_URL/v1beta/models/gemini-3-pro-preview-file:generateContent" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [
        {"text": "请详细描述这个视频的内容，包括场景、人物、动作和对话"},
        {"file_data": {"file_uri": "https://example.com/video.mp4"}}
      ]
    }]
  }'
```

### 视频问答

```bash theme={null}
curl -X POST "$BASE_URL/v1beta/models/gemini-3-pro-preview-file:generateContent" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [
        {"text": "视频中的人在做什么？背景音乐是什么风格？"},
        {"file_data": {"file_uri": "https://example.com/video.mp4", "mime_type": "video/mp4"}}
      ]
    }]
  }'
```

### 视频时间戳提取

```bash theme={null}
curl -X POST "$BASE_URL/v1beta/models/gemini-3-pro-preview-file:generateContent" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [
        {"text": "请列出这个视频的关键时间点和对应的内容描述"},
        {"file_data": {"file_uri": "https://example.com/video.mp4"}}
      ]
    }]
  }'
```

## 流式输出

```bash theme={null}
curl -N "$BASE_URL/v1beta/models/gemini-3-pro-preview-file:streamGenerateContent?alt=sse" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [
        {"text": "逐帧分析这个视频"},
        {"file_data": {"file_uri": "https://example.com/video.mp4"}}
      ]
    }]
  }'
```

## 注意事项

> \[!WARNING]
>
> * **仅支持单文件分析**，每次请求只能分析一个视频
> * 视频 URL 必须是公开可访问的
> * 大视频文件可能需要较长处理时间
> * 建议视频时长控制在合理范围内以获得最佳分析效果

## 相关文档

* [文本生成](/gemini/generate-content) - Gemini 基础对话与多模态功能
* [图片理解](/gemini/chat-image) - 图片分析能力
