swift - iPhone 的 FLAC 录音未使用 Google Speech API 进行转换
问题描述
我已配置AVAudioRecorder
如下以录制 Flac 格式的音频
记录仪配置
let settings: [String: Any] = [
AVFormatIDKey: Int(kAudioFormatFLAC),
AVSampleRateKey: 16000,
AVNumberOfChannelsKey: 1,
AVLinearPCMBitDepthKey: 16,
AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue,
AVLinearPCMIsBigEndianKey: false,
AVLinearPCMIsFloatKey: false,
]
录音会议
recordingSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with: [.allowBluetooth,.defaultToSpeaker])
文件记录成功并在设备中播放良好,也成功上传到后端服务。
问题某些音频文件无法使用Google Speech API
---->来自 Google Speech API 的问题
- 文件不包含 FLAC 标头
- soxi FAIL 格式:无法打开输入文件“636737069431546112.flac”:解码元数据时出现 FLAC 错误
解决方案
推荐阅读
- ionic-framework - Ionic Linking to ionic pro error in "cordova plugin add cordova-plugin-ionic"
- regex - Symfony - 一条消息用于多个断言
- graphql - 如何在多种类型上使用 GraphQL 片段
- sql - Oracle SQL 中的自联接 - 基于 1 个相同列和 1 个不同列选择行
- excel - VB6检查Excel工作簿是否打开
- bash - bash sqlite3 变量不会插入数据库
- javascript - 使用 jquery 计算表中切换的行数
- docusignapi - ConfigureJwtAuthorizationFlowByKey 返回 null
- android - Gradle 挂在 :app:transformDexWithInstantRunSlicesApkForDebug
- docker - 大厅任务是否会覆盖 docker 图像入口点?