Я использую API Video Intelligence для создания транскрипции видеофайла в формате mp4.
Я загружаю его в корзину, а затем отправляю gs: // uri в API, но получаю сообщение об ошибке:
(node:23945) UnhandledPromiseRejectionWarning: Error: 13 INTERNAL:
at Object.callErrorFromStatus (/Users/heitorfig/Desenvolvimento/a11yado-2/node_modules/@grpc/grpc-js/build/src/call.js:30:26)
at Http2CallStream.<anonymous> (/Users/heitorfig/Desenvolvimento/a11yado-2/node_modules/@grpc/grpc-js/build/src/client.js:96:33)
at Http2CallStream.emit (events.js:208:15)
at /Users/heitorfig/Desenvolvimento/a11yado-2/node_modules/@grpc/grpc-js/build/src/call-stream.js:75:22
at processTicksAndRejections (internal/process/task_queues.js:75:11
(node:23945) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:23945) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Это сценарий, который я использую для отправки видео:
const request = {
inputUri: 'gs://' + c.bucket + '/' + c.name,
features: ['SPEECH_TRANSCRIPTION'],
videoContext: videoContext,
};
const [operation] = await client.annotateVideo(request);
console.log('Waiting for operation to complete...');
const [operationResult] = await operation.promise();
console.log('Word level information:');
const alternative =
operationResult.annotationResults[0].speechTranscriptions[0]
.alternatives[0];
alternative.words.forEach(wordInfo => {
const start_time =
wordInfo.startTime.seconds + wordInfo.startTime.nanos * 1e-9;
const end_time = wordInfo.endTime.seconds + wordInfo.endTime.nanos * 1e-9;
console.log('\t' + start_time + 's - ' + end_time + 's: ' + wordInfo.word);
});
console.log('Transcription: ' + alternative.transcript);