我在我的 node.js 应用程序中使用 Google Cloud Speech API。这托管在 Google Compute Engine 中。我使用 Google Storage 作为 Speech To Text 的输入源。每当我使用 <1 mb 的音频文件时,一切正常。但是对于大于该文件的文件,它开始失败而没有任何适当的错误消息。下面是我使用的代码和我得到的错误
speechClient.startRecognition('gs://bucket-name/filename.flac', {
encoding: 'FLAC',
sampleRate: 16000
}, function(err, operation, apiResponse){
if(err){
console.log('FIRST FAILURE');
console.log({
error: err,
response: apiResponse
});
callback({
error: err,
response: apiResponse
}, null);
}
else{
operation
.on('error', function(err) {
callback({
error: err
}, null);
})
.on('complete', function(transcript) {
callback(null, transcript);
});
}
})
错误
FIRST FAILURE
{"error":{"code":400,"metadata":{"_internal_repr":{}}},"response":null}
还注意到,对于一个 45 秒的剪辑,它只给了我几(大约 15)秒的成绩单。