一段时间以来,我一直在使用 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
我尝试了两件事:
- 在请求标头中添加
Ocp-Apim-Subscription-Key
,如果我要传递访问令牌,以前似乎不需要 - 切换
DefaultWithNoiseReduction
到Default
并且似乎允许 API 调用通过,但是,它随后在索引视频时显示错误。
通过控制台/仪表板手动上传视频似乎可行,因此可能只是 API 端点存在一些问题。
任何帮助将不胜感激!
2021-02-01 更新:似乎将索引预设更改为Default
现在可以使用。但是,DefaultWithNoiseReduction 的问题仍然存在。