在我的 iOS 应用程序中,我尝试使用 iOS 10 的最新功能(语音 API)转录预先录制的音频。
包括文档在内的多个来源均表示,语音 API(更具体地说是 SFSpeechRecognizer)的音频持续时间限制为 1 分钟。
在我的代码中,我发现任何长度约为 15 秒或更长的音频文件都会出现以下错误。
错误域=kAFAssistantErrorDomain代码=203“SessionId=com.siri.cortex.ace.speech.session.event.SpeechSessionId@50a8e246,消息=30000毫秒后超时等待命令”UserInfo={NSLocalizedDescription=SessionId=com.siri.cortex .ace.speech.session.event.SpeechSessionId@50a8e246,消息=30000毫秒后等待命令超时,NSUnderlyingError=0x170248c40 {Error Domain=SiriSpeechErrorDomain Code=100“(null)”}}
我在互联网上进行了搜索,但未能找到解决方案。也有人遇到过同样的问题。有些人怀疑这是 Nuance 的问题。
还值得注意的是,我确实从转录过程中得到了部分结果。
这是我的 iOS 应用程序的代码。` // 创建语音识别器请求对象。让 srRequest = SFSpeechURLRecognitionRequest(url: 位置) srRequest.shouldReportPartialResults = false
sr?.recognitionTask(with: srRequest) { (result, error) in
if let error = error {
// Something wrong happened
print(error.localizedDescription)
} else {
if let result = result {
print(4)
print(result.bestTranscription.formattedString)
if result.isFinal {
print(5)
transcript = result.bestTranscription.formattedString
print(result.bestTranscription.formattedString)
// Store the transcript into the database. …Run Code Online (Sandbox Code Playgroud) 我将音频文件存储在Google云端存储上(通过Firebase存储).
我需要使用FFMPEG将音频文件从立体声(两个声道)转换为单声道(一个声道).
如何在Google Cloud Platform上执行上述转换?
更新: 我怀疑有一种可能性是使用Google Compute Engine创建虚拟机,安装ffmpeg,并以某种方式获得对音频文件的访问权限.
我不确定这是最好的方式还是可能的.所以我还在调查.