0

我使用 MicroSoft Video indexer 来运行视频智能并从用户视频输入中提取有用的特征/内容。我一直在使用 Web 界面,但现在我需要使用 Rest API 来自动执行此操作。

有两种方法可以指定要上传的视频文件。一种是摄取原始字节,另一种是引用云上视频文件的地址(推荐)。请参阅API 文档

问题是我在指定 Google Cloud Storage 存储桶上的文件时遇到问题。我了解您必须指定公开可用文件的 URL,我通过提供视频文件的签名 URL 来做到这一点。但它一直给我下面的错误,当我指定上传到 Cloudinary 的同一视频文件的地址时,不会发生这种错误。

{
  "ErrorType": "INVALID_INPUT",
  "Message": "Url content type 'application/xml' is not supported. Only audio and video files are supported. You can find the supported types here: https://docs.microsoft.com/ro-ro/azure/media-services/media-services-media-encoder-standard-formats. Trace id: '7e9e2626-6dd3-4e9b-8b06-5991cfdb896c"
}

供参考,这里有2个地址:

  1. Cloudinary:https ://res.cloudinary.com/account-id/video/upload/v1612773239/VideoAI/Elen_Hyundai_high.mp4
  2. GCS: https://storage.googleapis.com/project-id.appspot.com/video-files/filename?GoogleAccessId=firebase-adminsdk-some-service-account-key.com&Expires=1612857836&Signature=Rog3NWpzqXINxPWQl9sLLP8eDASNEglUehL6YkMB90YXRIWGk8PZOYGpUB9MVgTXKtFe4IjbR0tRuDUVhCeIhFTfL3kR2YXCZ3mqbOYOQlzfasq4YE4FtGiN40gNicjiLbJbq8vq4pMIwRfSirSOV92t9ev5ydPcW0BgICfd5n6QOhCvLx%2FpPgonCuGtK82Zyu21M%2BFRxuqmDTfCsZwP0fxfzwoZblusEFxIxpZFiXtow27EBYy3Dqv062UWhPuLhSyBKnFIHReaSaRcfwRVMF4Sw849eeMLGYdqHSy9LOVsw% 2FcYTJenjM4bqoj1jqSduh8A%2FmGkN3rFRok3aT4qjw%3D%3D

如果您需要测试它,我可以提供实际的 URL。

4

1 回答 1

2

好的,我通过编码signedURL从 GCS 获取的查询参数路径解决了这个问题,然后将其添加到videoUrl发送到 MicroSoft Video Indexer (MVI) 的参数中

const temp = signedURL.split('?')

videoUrl = temp[0] + encodeURIComponent(`?${temp[1]}`)

这是因为 MVIdecodeURIComponent在 vi​​deoUrl 上运行 - 因此目标是使结果等于 GCS 发送的原始 url:

  const bucketFile = bucket.file(filePath)
  const [signedURL] = await bucketFile.getSignedUrl({
    action: 'read',
    expires: 3600 * 1000, // 1hr or add-your-expiration,
  })
于 2021-02-09T09:38:43.130 回答