首页 > 解决方案 > Google Speech to Text Error: Specify FLAC encoding to match file header

问题描述

I am trying the Google Speech to Text sample for PHP. https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/speech

I was able to transcribe the raw file correctly:

php speech.php transcribe test/data/audio32KHz.raw

But when I tried doing the same for a FLAC file (provided by Google in the sample)

php speech.php transcribe test/data/audio32KHz.flac

I got this error.

In ApiException.php line 139:

  {                                                              
      "message": "Specify FLAC encoding to match file header.",  
      "code": 3,                                                 
      "status": "INVALID_ARGUMENT",                              
      "details": []                                              
  }                                                              

I tried passing encoding too but that didn't work. I get the same error.

php speech.php transcribe --encoding FLAC test/data/audio32KHz.flac

标签: phpgoogle-cloud-platformspeech-to-text

解决方案


使用 AWS 转录。它很容易开发,而且他们的文档要好得多。

亚马逊关心 AWS。谷歌不关心谷歌云。


推荐阅读