Transcriptions - Transcribe
音频文件的同步转录。
POST {endpoint}/speechtotext/transcriptions:transcribe?api-version=2025-10-15
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
audio
|
formData |
file (binary) |
要转录的音频文件的内容。 音频文件的音频时长必须小于 2 小时,大小必须小于 250 MB。 |
|
|
definition
|
formData |
string |
听录请求的元数据。 此字段包含类型为 |
|
|
endpoint
|
path | True |
string |
支持的认知服务终结点(协议和主机名,例如: https://westus.api.cognitive.microsoft.com)。 |
|
api-version
|
query | True |
string |
请求的 API 版本。 |
请求头
Media Types: "multipart/form-data"
| 名称 | 必需 | 类型 | 说明 |
|---|---|---|---|
| Ocp-Apim-Subscription-Key | True |
string |
在此处提供认知服务帐户密钥。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
好的 |
|
| Other Status Codes |
出现了错误。 |
安全性
Ocp-Apim-Subscription-Key
在此处提供认知服务帐户密钥。
类型:
apiKey
在:
header
示例
Transcribe an audio file
示例请求
POST {endpoint}/speechtotext/transcriptions:transcribe?api-version=2025-10-15
示例响应
{
"durationMilliseconds": 2000,
"combinedPhrases": [
{
"text": "Weather"
}
],
"phrases": [
{
"offsetMilliseconds": 40,
"durationMilliseconds": 320,
"text": "Weather",
"words": [
{
"text": "weather",
"offsetMilliseconds": 40,
"durationMilliseconds": 320
}
],
"locale": "en-US",
"confidence": 0.78983736
}
]
}
定义
| 名称 | 说明 |
|---|---|
|
Channel |
每个频道的完整成绩单。 |
|
Detailed |
详细错误代码 |
| Error |
错误 |
|
Error |
ErrorCode |
|
Inner |
InnerError |
| Phrase |
转录的短语。 |
|
Transcribe |
转录作的结果。 |
| Word |
显示形式中带有时间戳的单词。 |
ChannelCombinedPhrases
每个频道的完整成绩单。
| 名称 | 类型 | 说明 |
|---|---|---|
| channel |
integer (int32) |
从 0 开始的通道索引。 仅当启用了通道分离时才存在。 |
| text |
string |
听录的文本。 |
DetailedErrorCode
详细错误代码
| 值 | 说明 |
|---|---|
| InvalidParameterValue |
参数值无效。 |
| InvalidRequestBodyFormat |
请求正文格式无效。 |
| EmptyRequest |
空请求。 |
| MissingInputRecords |
缺少输入记录。 |
| InvalidDocument |
无效的文档。 |
| ModelVersionIncorrect |
型号版本不正确。 |
| InvalidDocumentBatch |
无效的单据批处理。 |
| UnsupportedLanguageCode |
不支持的语言代码。 |
| DataImportFailed |
数据导入失败。 |
| InUseViolation |
使用中违规。 |
| InvalidLocale |
区域设置无效。 |
| InvalidBaseModel |
基本模型无效。 |
| InvalidAdaptationMapping |
无效的适应映射。 |
| InvalidDataset |
数据集无效。 |
| InvalidTest |
测试无效。 |
| FailedDataset |
数据集失败。 |
| InvalidModel |
模型无效。 |
| InvalidTranscription |
转录无效。 |
| InvalidPayload |
有效负载无效。 |
| InvalidParameter |
参数无效。 |
| EndpointWithoutLogging |
没有日志记录的端点。 |
| InvalidPermissions |
权限无效。 |
| InvalidPrerequisite |
先决条件无效。 |
| InvalidProductId |
产品 ID 无效。 |
| InvalidSubscription |
订阅无效。 |
| InvalidProject |
项目无效。 |
| InvalidProjectKind |
项目类型无效。 |
| InvalidRecordingsUri |
无效的记录 uri。 |
| OnlyOneOfUrlsOrContainerOrDataset |
只有 url 或容器或数据集之一。 |
| ExceededNumberOfRecordingsUris |
超过记录数量。 |
| InvalidChannels |
无效的通道。 |
| ModelMismatch |
模型不匹配。 |
| ProjectGenderMismatch |
项目性别不匹配。 |
| ModelDeprecated |
模型已弃用。 |
| ModelExists |
模型存在。 |
| ModelNotDeployable |
模型不可部署。 |
| EndpointNotUpdatable |
终结点不可更新。 |
| SingleDefaultEndpoint |
单个默认终结点。 |
| EndpointCannotBeDefault |
终结点不能是默认的。 |
| InvalidModelUri |
模型 uri 无效。 |
| SubscriptionNotFound |
找不到订阅。 |
| QuotaViolation |
配额违规。 |
| UnsupportedDelta |
不支持的增量。 |
| UnsupportedFilter |
不支持的过滤器。 |
| UnsupportedPagination |
不支持的分页。 |
| UnsupportedDynamicConfiguration |
不支持的动态配置。 |
| UnsupportedOrderBy |
不支持的订单。 |
| NoUtf8WithBom |
没有带有 bom 的 utf8。 |
| ModelDeploymentNotCompleteState |
模型部署未完成状态。 |
| SkuLimitsExist |
存在 SKU 限制。 |
| DeployingFailedModel |
部署失败的模型。 |
| UnsupportedTimeRange |
不支持的时间范围。 |
| InvalidLogDate |
日志日期无效。 |
| InvalidLogId |
日志 ID 无效。 |
| InvalidLogStartTime |
日志开始时间无效。 |
| InvalidLogEndTime |
日志结束时间无效。 |
| InvalidTopForLogs |
日志的顶部无效。 |
| InvalidSkipTokenForLogs |
日志的跳过令牌无效。 |
| DeleteNotAllowed |
不允许删除。 |
| Forbidden |
已禁止。 |
| DeployNotAllowed |
不允许部署。 |
| UnexpectedError |
意外错误。 |
| InvalidCollection |
集合无效。 |
| InvalidCallbackUri |
回调 uri 无效。 |
| InvalidSasValidityDuration |
SAS 有效期无效。 |
| InaccessibleCustomerStorage |
无法访问客户存储。 |
| UnsupportedClassBasedAdaptation |
不支持的基于类的适应。 |
| InvalidWebHookEventKind |
无效的 Web 挂钩事件类型。 |
| InvalidTimeToLive |
无效的生存时间。 |
| InvalidSourceAzureResourceId |
源 Azure 资源 ID 无效。 |
| ModelCopyAuthorizationExpired |
已过期的 ModelCopyAuthorization。 |
| EndpointLoggingNotSupported |
不支持终结点日志记录。 |
| NoLanguageIdentified |
语言识别不识别任何语言。 |
| MultipleLanguagesIdentified |
语言识别识别多种语言。 无法确定主要语言。 |
| InvalidAudioFormat |
不支持输入音频的格式。 |
| BadChannelConfiguration |
数据、配置或应用程序要求中的音频通道之间存在不匹配。 |
| InvalidChannelSpecification |
不支持在转录请求中选择通道(例如,既未选择 0 也未选择 1)。 |
| AudioLengthLimitExceeded |
音频文件超过允许的最大持续时间。 |
| EmptyAudioFile |
音频文件为空。 |
Error
错误
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
ErrorCode |
|
| details |
Error[] |
有关错误和/或预期策略的其他支持性详细信息。 |
| innerError |
InnerError |
|
| message |
string |
高级错误消息。 |
| target |
string |
错误的源。 例如,如果文档无效,则为“文档”或“文档 ID”。 |
ErrorCode
ErrorCode
| 值 | 说明 |
|---|---|
| InvalidRequest |
表示无效的请求错误代码。 |
| InvalidArgument |
表示无效的参数错误代码。 |
| InternalServerError |
表示内部服务器错误错误代码。 |
| ServiceUnavailable |
表示服务不可用错误代码。 |
| NotFound |
表示未找到错误代码。 |
| PipelineError |
表示管道错误错误代码。 |
| Conflict |
表示冲突错误代码。 |
| InternalCommunicationFailed |
表示内部通信失败错误代码。 |
| Forbidden |
表示禁止的错误代码。 |
| NotAllowed |
表示不允许的错误代码。 |
| Unauthorized |
表示未经授权的错误代码。 |
| UnsupportedMediaType |
表示不受支持的媒体类型错误代码。 |
| TooManyRequests |
表示请求过多错误代码。 |
| UnprocessableEntity |
表示无法处理的实体错误代码。 |
InnerError
InnerError
| 名称 | 类型 | 说明 |
|---|---|---|
| code |
详细错误代码 |
|
| details |
object |
有关错误和/或预期策略的其他支持性详细信息。 |
| innerError |
InnerError |
|
| message |
string |
高级错误消息。 |
| target |
string |
错误的源。 例如,如果文档无效,则为“文档”或“文档 ID”。 |
Phrase
转录的短语。
| 名称 | 类型 | 说明 |
|---|---|---|
| channel |
integer (int32) |
从 0 开始的通道索引。 仅当启用了通道分离时才存在。 |
| confidence |
number (float) |
短语的置信度值。 |
| durationMilliseconds |
integer (int32) |
短语的持续时间(以毫秒为单位)。 |
| locale |
string |
短语的区域设置。 |
| offsetMilliseconds |
integer (int32) |
短语的起始偏移量(以毫秒为单位)。 |
| speaker |
integer (int32) |
分配给音频中检测到的每个说话人的唯一整数,没有特定顺序。 仅当启用了说话人分类时才会出现。 |
| text |
string |
短语的转录文本。 |
| words |
Word[] |
构成短语的单词。 仅当启用了单词级时间戳时才会出现。 |
TranscribeResult
转录作的结果。
| 名称 | 类型 | 说明 |
|---|---|---|
| combinedPhrases |
每个频道的完整脚本。 |
|
| durationMilliseconds |
integer (int32) |
音频的持续时间(以毫秒为单位)。 |
| phrases |
Phrase[] |
转录结果被分割为短语。 |
Word
显示形式中带有时间戳的单词。
| 名称 | 类型 | 说明 |
|---|---|---|
| durationMilliseconds |
integer (int32) |
单词的持续时间(以毫秒为单位)。 |
| offsetMilliseconds |
integer (int32) |
单词的起始偏移量(以毫秒为单位)。 |
| text |
string |
识别的单词,包括标点符号。 |