微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

视频索引器 API INVALID_INPUT - 索引预设“DefaultWithNoiseReduction”无效

如何解决视频索引器 API INVALID_INPUT - 索引预设“DefaultWithNoiseReduction”无效

一段时间以来,我一直使用 Video Indexer API 从我的应用程序上传视频,但从昨天开始,我开始遇到 INVALID_INPUT 错误

以下是我在 Python 中调用 POST 上传 API 的方式:

vi_location = 'southeastasia'
vi_account_id = 'some-account-id'  # replaced with actual account ID
video_language = 'en-US'
name = 'test-video-name'
access_token = 'some-access-token'  # replaced with actual access token generated with Accesstoken endpoint

params = {
    'streamingPreset': 'Default','indexingPreset': 'DefaultWithNoiseReduction','language': video_language,'name': video_name,'accesstoken': access_token
}

files = {
    'file': open('some-file-name.mp4','rb')
}

upload_video_req = requests.post('https://api.videoindexer.ai/{loc}/Accounts/{acc_id}/Videos'.format(
        loc=vi_location,acc_id=vi_account_id
    ),params=params,files=files
)  # here's where it generates the error message

这是从 API 响应生成的消息。

{"ErrorType":"INVALID_INPUT","Message":"Indexing preset \'DefaultWithNoiseReduction\' is invalid. Trace id: \'5086aa05-14d3-4f9a-928e-c2159a14705e"}

根据文档,索引预设的允许值如下:

The indexing preset to use. Allowed values: DefaultWithNoiseReduction/Default/AudioOnly/VideoOnly/Basic/BasicAudio/BasicVideo/Advanced/AdvancedAudio/AdvancedVideo

我尝试了两件事:

  1. 在请求标头中添加 Ocp-Apim-Subscription-Key,如果我要传入访问令牌,以前似乎不需要
  2. DefaultWithNoiseReduction 切换到 Default,这似乎允许 API 调用通过,但是,它随后在为视频编制索引时显示错误

Problem Indexing Video

通过控制台/仪表板手动上传视频似乎可行,因此可能只是 API 端点出现了一些问题。

任何帮助将不胜感激!


更新 2021-02-01:似乎将索引预设更改为 Default 现在可以正常工作了。但是,DefaultWithNoiseReduction 的问题仍然存在。

解决方法

我认为 DefaultWithNoiseReduction 可能已被弃用或与 Default 合并。

如果您有兴趣,可以rasie a support ticket to confirm。以下是我的测试结果。

测试步骤:

use offical sample code and test it,我设置indexingPreset=DefaultWithNoiseReduction如下。

queryParams = CreateQueryString(
    new Dictionary<string,string>()
    {
        {"accessToken",accountInfo.AccessToken},{"language","English"},{ "indexingPreset","DefaultWithNoiseReduction"}
    }
);

当我调试 videoGetIndexResult 时,我得到 "indexingPreset":"Default",

enter image description here

根据测试,在C#代码中,DefaultWithNoiseReduction已被弃用或忽略,可能会被Default所取代。

Python SDK 代码可能没有及时更新。所以它导致了你之前的问题。

为了进一步验证我的猜测,我在Video Indexer Portal中发现,在高级选项中,只剩下3种indexingPreset了。

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。