You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure批量语音转文字API无法将转录文件存入容器指定目录

Azure语音转文字批量转录API指定目录存储解决方案

问题原因

Azure语音转文字批量转录API的destination_container_url参数仅用于指定目标存储容器,并不支持直接在URL中附加目录路径来指定存储位置,这就是你填入目录路径后API仍将文件存放在根目录的原因。

可行解决方案

1. 通过outputFilenameFormat参数指定目录路径

在提交批量转录请求时,在请求体的properties字段中添加outputFilenameFormat配置,将目录路径包含在文件名模板里,API会自动创建对应的虚拟目录结构(Azure Blob存储的目录是虚拟的,无需提前创建)。

示例请求体片段:

{
  "contentUrls": ["https://your-storage.blob.core.windows.net/source/audio1.wav"],
  "destinationContainerUrl": "https://your-storage.blob.core.windows.net/destination?<SAS_TOKEN>",
  "properties": {
    "outputFilenameFormat": "transcriptions/2024-q3/{audioFileName}.json"
  }
}

这里transcriptions/2024-q3/就是你需要的目录结构,API会把转录后的文件存入该路径下。

2. 转录完成后移动文件

如果无法修改请求参数,可以等转录任务完成后,通过Azure Blob Storage工具或SDK将根目录的文件移动到目标目录:

  • 使用Azure CLI命令:
az storage blob move \
  --container-name destination \
  --source-blob audio1.json \
  --destination-blob transcriptions/2024-q3/audio1.json \
  --account-name your-storage-account
  • 或者用Python SDK(azure-storage-blob)编写脚本批量移动。

注意事项

  • 确保destination_container_url对应的SAS令牌拥有写入、创建权限,否则无法创建虚拟目录和写入文件。
  • 目录路径使用正斜杠/作为分隔符,符合Azure Blob存储的路径规范。

内容的提问来源于stack exchange,提问作者Rumit dev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 13:52:05