# 更长的输入

简介 处理超过 25 MB 大小的音频文件时，Afarensis Whisper API 需要将这些文件分割成较小的片段，或者采用更紧凑的音频格式。为了确保音频转录的准确性和上下文的完整性，建议避免在句子中间断开音频。

如何拆分长音频文件 对于超长音频文件，可以使用 PyDub —— 一个开源的 Python 音频处理库来拆分音频。以下步骤和代码示例提供了如何操作的指导：

使用 PyDub 拆分音频 安装 PyDub：首先，确保您已经安装了 PyDub。如果尚未安装，可以通过运行 pip install pydub 来安装。

拆分音频示例代码：

from pydub import AudioSegment

## 从 MP3 文件加载音频

song = AudioSegment.from\_mp3("good\_morning.mp3")

## 设置拆分时间（毫秒单位）

ten\_minutes = 10 \* 60 \* 1000

## 提取前十分钟的音频段

first\_10\_minutes = song\[:ten\_minutes]

## 将提取的音频段导出为新的 MP3 文件

first\_10\_minutes.export("good\_morning\_10.mp3", format="mp3") 此代码将会从原始音频文件中提取前十分钟，并将其保存为一个新的 MP3 文件。

注意事项 第三方软件使用风险：请注意，虽然 PyDub 是一个受欢迎且广泛使用的工具，但 Afarensis 不对其可用性或安全性提供保证。在使用 PyDub 或任何第三方软件时，请确保您了解并愿意承担使用这些工具可能带来的风险。

避免中断句子：为了保持转录内容的连贯性和准确性，尽量避免在句子中间断开音频。

法律和规定遵守：使用音频处理工具时，确保您的操作符合所有相关的法律和规定。


---

# Agent Instructions: 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:

```
GET https://doc.afarensis.com/yu-yin-zhuan-wen-ben/geng-chang-de-shu-ru.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
