【问题标题】:google speech api gaxerror谷歌语音 api gaxerror
【发布时间】:2018-02-16 13:54:08
【问题描述】:

我正在使用 Google Speech API 转录音频文件,使用以下 Python 脚本 https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/speech/cloud-client/transcribe_async.py 和以下命令:

python transcribe_async.py 1503489730.193982.flac

我得到的回应是这个:

Waiting for operation to complete...
Traceback (most recent call last):
  File "transcribe_async.py", line 102, in <module>
    transcribe_file(args.path)
  File "transcribe_async.py", line 52, in transcribe_file
    response = operation.result(timeout=200)
  File "/home/toto/anaconda3/lib/python3.5/site-packages/google/gax/__init__.py", line 596, in result
    raise GaxError(self._operation.error.message)
google.gax.errors.GaxError

我无法弄清楚错误是什么。可能是音频参数配置错了,我真的不知道。

谢谢

【问题讨论】:

    标签: python google-api speech-recognition speech-to-text google-speech-api


    【解决方案1】:

    Linear16 是唯一可接受的异步格式。 Uncompressed 16-bit signed little-endian samples (Linear PCM). This is the only encoding that may be used by AsyncRecognize.documentation

    您可以像这样将 mp3 转换为 raw:

    sox async.mp3 -t raw --channels=1 --bits=16 --rate=16000 --encoding=signed-integer --endian=little async.raw
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-16
      • 1970-01-01
      • 2023-04-09
      • 1970-01-01
      • 2017-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多